added intllib support and russian translation

master
TenPlus1 2017-08-28 11:22:18 +01:00
parent 42887e0abc
commit 8bd2e86e87
7 changed files with 165 additions and 9 deletions

View File

@ -19,6 +19,6 @@ Changelog:
- 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.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)

View File

@ -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
local dpath = minetest.get_modpath("default") .. "/schematics/"
@ -104,7 +109,7 @@ if minetest.get_modpath("screwdriver") then
if screwdriver and screwdriver.handler then
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",
groups = {not_in_creative_inventory = 1},
@ -347,7 +352,7 @@ end
-- Special items
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",
tiles = {"default_obsidian_glass.png^[brighten"},
use_texture_alpha = true,

View File

@ -1,3 +1,4 @@
default
tnt?
screwdriver?
intllib?

View File

@ -3,6 +3,11 @@ lucky_block = {}
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)
local function punchy(pos, player)
@ -11,7 +16,7 @@ local function punchy(pos, player)
damage_groups = {fleshy = 5}
}, 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
@ -40,7 +45,7 @@ local function bushy(pos, player)
player_inv:set_stack("main", i, "default:dry_shrub")
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
@ -370,7 +375,7 @@ local lucky_block = function(pos, digger)
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
elseif action == "dro" then
@ -565,7 +570,7 @@ end
-- lucky block itself
minetest.register_node('lucky_block:lucky_block', {
description = "Lucky Block",
description = S("Lucky Block"),
tiles = {{
name = "lucky_block_animated.png",
animation = {
@ -603,7 +608,7 @@ minetest.register_craft({
-- 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 = {{
name="lucky_block_super_animated.png",
animation = {
@ -654,6 +659,6 @@ minetest.register_node('lucky_block:super_lucky_block', {
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)

45
intllib.lua Normal file
View 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
View 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
View 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 ""