mirror of
https://notabug.org/TenPlus1/lucky_block.git
synced 2024-08-20 23:34:07 +02:00
added intllib support and russian translation
This commit is contained in:
parent
42887e0abc
commit
8bd2e86e87
@ -19,6 +19,6 @@ Changelog:
|
|||||||
- 0.4 - Added ability to add custom functions within lucky blocks
|
- 0.4 - Added ability to add custom functions within lucky blocks
|
||||||
- 0.5 - Explosions now have radius and fire setting, also added new blocks
|
- 0.5 - Explosions now have radius and fire setting, also added new blocks
|
||||||
- 0.6 - Use TNT mod for explosions and if not active do entity damage only
|
- 0.6 - Use TNT mod for explosions and if not active do entity damage only
|
||||||
- 0.7 - Added new floor feature to blocks and moreblocks support
|
- 0.7 - Added new floor feature and moreblocks support
|
||||||
|
|
||||||
Lucky Blocks: 136 (depending on mods enabled)
|
Lucky Blocks: 136 (depending on mods enabled)
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
|
|
||||||
|
-- Load support for intllib.
|
||||||
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
|
||||||
-- Default tree schematics
|
-- Default tree schematics
|
||||||
local dpath = minetest.get_modpath("default") .. "/schematics/"
|
local dpath = minetest.get_modpath("default") .. "/schematics/"
|
||||||
|
|
||||||
@ -104,7 +109,7 @@ if minetest.get_modpath("screwdriver") then
|
|||||||
|
|
||||||
if screwdriver and screwdriver.handler then
|
if screwdriver and screwdriver.handler then
|
||||||
minetest.register_tool(":screwdriver:screwdriver_magenta", {
|
minetest.register_tool(":screwdriver:screwdriver_magenta", {
|
||||||
description = "Super Mega Magenta Ultra Screwdriver 2500\n(left-click to rotate face, right-click to rotates axis)",
|
description = S("Super Mega Magenta Ultra Screwdriver 2500\n(left-click to rotate face, right-click to rotates axis)"),
|
||||||
inventory_image = "screwdriver.png^[colorize:#ff009970",
|
inventory_image = "screwdriver.png^[colorize:#ff009970",
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1},
|
||||||
|
|
||||||
@ -347,7 +352,7 @@ end
|
|||||||
|
|
||||||
-- Special items
|
-- Special items
|
||||||
minetest.register_node("lucky_block:void_mirror", {
|
minetest.register_node("lucky_block:void_mirror", {
|
||||||
description = "Void Mirror (Place to see through solid walls during daytime)",
|
description = S("Void Mirror (Place to see through solid walls during daytime)"),
|
||||||
drawtype = "normal",
|
drawtype = "normal",
|
||||||
tiles = {"default_obsidian_glass.png^[brighten"},
|
tiles = {"default_obsidian_glass.png^[brighten"},
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
default
|
default
|
||||||
tnt?
|
tnt?
|
||||||
screwdriver?
|
screwdriver?
|
||||||
|
intllib?
|
||||||
|
17
init.lua
17
init.lua
@ -3,6 +3,11 @@ lucky_block = {}
|
|||||||
lucky_schems = {}
|
lucky_schems = {}
|
||||||
|
|
||||||
|
|
||||||
|
-- Load support for intllib.
|
||||||
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
|
||||||
-- example custom function (punches player with 5 damage)
|
-- example custom function (punches player with 5 damage)
|
||||||
local function punchy(pos, player)
|
local function punchy(pos, player)
|
||||||
|
|
||||||
@ -11,7 +16,7 @@ local function punchy(pos, player)
|
|||||||
damage_groups = {fleshy = 5}
|
damage_groups = {fleshy = 5}
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
||||||
minetest.chat_send_player(player:get_player_name(), "Stop hitting yourself!")
|
minetest.chat_send_player(player:get_player_name(), S("Stop hitting yourself!"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +45,7 @@ local function bushy(pos, player)
|
|||||||
player_inv:set_stack("main", i, "default:dry_shrub")
|
player_inv:set_stack("main", i, "default:dry_shrub")
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.chat_send_player(player:get_player_name(), "Dry Shrub Takeover!")
|
minetest.chat_send_player(player:get_player_name(), S("Dry shrub takeover!"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -370,7 +375,7 @@ local lucky_block = function(pos, digger)
|
|||||||
|
|
||||||
effect(pos, 25, "tnt_smoke.png", 8, 8, 1, -10, 0)
|
effect(pos, 25, "tnt_smoke.png", 8, 8, 1, -10, 0)
|
||||||
|
|
||||||
minetest.chat_send_player(digger:get_player_name(), "Random Teleport!")
|
minetest.chat_send_player(digger:get_player_name(), S("Random Teleport!"))
|
||||||
|
|
||||||
-- drop items
|
-- drop items
|
||||||
elseif action == "dro" then
|
elseif action == "dro" then
|
||||||
@ -565,7 +570,7 @@ end
|
|||||||
|
|
||||||
-- lucky block itself
|
-- lucky block itself
|
||||||
minetest.register_node('lucky_block:lucky_block', {
|
minetest.register_node('lucky_block:lucky_block', {
|
||||||
description = "Lucky Block",
|
description = S("Lucky Block"),
|
||||||
tiles = {{
|
tiles = {{
|
||||||
name = "lucky_block_animated.png",
|
name = "lucky_block_animated.png",
|
||||||
animation = {
|
animation = {
|
||||||
@ -603,7 +608,7 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-- super lucky block
|
-- super lucky block
|
||||||
minetest.register_node('lucky_block:super_lucky_block', {
|
minetest.register_node('lucky_block:super_lucky_block', {
|
||||||
description = "Super Lucky Block (use Pick)",
|
description = S("Super Lucky Block (use pick)"),
|
||||||
tiles = {{
|
tiles = {{
|
||||||
name="lucky_block_super_animated.png",
|
name="lucky_block_super_animated.png",
|
||||||
animation = {
|
animation = {
|
||||||
@ -654,6 +659,6 @@ minetest.register_node('lucky_block:super_lucky_block', {
|
|||||||
|
|
||||||
|
|
||||||
minetest.after(0, function()
|
minetest.after(0, function()
|
||||||
print ("[MOD] Lucky Blocks loaded (" .. #lucky_list .. " in total)")
|
print (S("[MOD] Lucky Blocks loaded (@1 in total)", #lucky_list))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
45
intllib.lua
Normal file
45
intllib.lua
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
-- Fallback functions for when `intllib` is not installed.
|
||||||
|
-- Code released under Unlicense <http://unlicense.org>.
|
||||||
|
|
||||||
|
-- Get the latest version of this file at:
|
||||||
|
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||||
|
|
||||||
|
local function format(str, ...)
|
||||||
|
local args = { ... }
|
||||||
|
local function repl(escape, open, num, close)
|
||||||
|
if escape == "" then
|
||||||
|
local replacement = tostring(args[tonumber(num)])
|
||||||
|
if open == "" then
|
||||||
|
replacement = replacement..close
|
||||||
|
end
|
||||||
|
return replacement
|
||||||
|
else
|
||||||
|
return "@"..open..num..close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||||
|
end
|
||||||
|
|
||||||
|
local gettext, ngettext
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
if intllib.make_gettext_pair then
|
||||||
|
-- New method using gettext.
|
||||||
|
gettext, ngettext = intllib.make_gettext_pair()
|
||||||
|
else
|
||||||
|
-- Old method using text files.
|
||||||
|
gettext = intllib.Getter()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fill in missing functions.
|
||||||
|
|
||||||
|
gettext = gettext or function(msgid, ...)
|
||||||
|
return format(msgid, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||||
|
return format(n==1 and msgid or msgid_plural, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return gettext, ngettext
|
50
locale/ru.po
Normal file
50
locale/ru.po
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2017-05-14 08:34+0200\n"
|
||||||
|
"PO-Revision-Date: 2017-08-28 11:14+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: ru\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Stop hitting yourself!"
|
||||||
|
msgstr "Прекратите удары себя"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Dry shrub takeover!"
|
||||||
|
msgstr "Поглощение сухих кустов"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Random teleport!"
|
||||||
|
msgstr "Случайный телепорт!"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Lucky Block"
|
||||||
|
msgstr "Удачливый блок"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Super Lucky Block (use pick)"
|
||||||
|
msgstr "Супер удачливый блок (используйте кирку)"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "[MOD] Lucky Blocks loaded (@1 in total)"
|
||||||
|
msgstr "[MOD] Удачливый блок нагруженный (Всего @1)"
|
||||||
|
|
||||||
|
#: blocks.lua
|
||||||
|
msgid "Super Mega Magenta Ultra Screwdriver 2500\n(left-click to rotate face, right-click to rotates axis)"
|
||||||
|
msgstr "Пурпурная супер мега ультра отвёртка 2500\n(левая кнопка для вращения лицевой части, правая кнопка для вращения осей)"
|
||||||
|
|
||||||
|
#: blocks.lua
|
||||||
|
msgid "Void Mirror (Place to see through solid walls during daytime"
|
||||||
|
msgstr "Пустое зеркало (Установите, чтобы видеть сквозь сплошные стены в дневное время)"
|
50
locale/template.pot
Normal file
50
locale/template.pot
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2017-05-14 08:34+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Stop hitting yourself!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Dry shrub takeover!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Random teleport!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Lucky Block"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Super Lucky Block (use pick)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "[MOD] Lucky Blocks loaded (@1 in total)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: blocks.lua
|
||||||
|
msgid "Super Mega Magenta Ultra Screwdriver 2500\n(left-click to rotate face, right-click to rotates axis)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: blocks.lua
|
||||||
|
msgid "Void Mirror (Place to see through solid walls during daytime"
|
||||||
|
msgstr ""
|
Loading…
Reference in New Issue
Block a user