aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rw-r--r--depends.txt1
-rw-r--r--init.lua20
-rw-r--r--intllib.lua45
-rw-r--r--locale/de.po46
-rw-r--r--locale/ru.po46
-rw-r--r--locale/template.pot46
7 files changed, 202 insertions, 9 deletions
diff --git a/README.md b/README.md
index 4b218c1..9c12b1d 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Fork of the original [abjphabet mod](https://forum.minetest.net/viewtopic.php?f=
Letter blocks can be created with the Letter Machine or given with /giveme ehlphabet:(ascii decimal)
Example: `/giveme ehlphabet:65` will give you a block with the letter [**A**] on it.
-http://www.asciitable.com/
+https://www.asciitable.com/
For UTF-8 characters add one more identifier /giveme ehlphabet:(first byte decimal)_(second byle decimal)
@@ -30,6 +30,7 @@ To customize the look and size of letters, you need to know basic HTML and CSS a
## License
Textures are licensed under CC-BY-SA 3.0
+See LICENSE file
## Changelist
@@ -37,4 +38,6 @@ Textures are licensed under CC-BY-SA 3.0
2018-03-29 support for UTF-8 and cyrillic letters added
-2018-03-31 german letters added \ No newline at end of file
+2018-03-31 german letters added
+
+2018-04-01 intllib support added with russian and german languages \ No newline at end of file
diff --git a/depends.txt b/depends.txt
index 562cf63..198fe8a 100644
--- a/depends.txt
+++ b/depends.txt
@@ -1 +1,2 @@
default
+intllib?
diff --git a/init.lua b/init.lua
index 2ed13fe..aee817b 100644
--- a/init.lua
+++ b/init.lua
@@ -18,6 +18,10 @@ local characters = {}
ehlphabet = {}
ehlphabet.path = minetest.get_modpath(minetest.get_current_modname())
+-- Intllib
+local S, NS = dofile(ehlphabet.path .. "/intllib.lua")
+ehlphabet.intllib = S
+
local function table_merge(t1, t2)
for k, v in ipairs(t2) do
table.insert(t1, v)
@@ -40,7 +44,7 @@ local create_alias = true
-- generate all available blocks
for _, name in ipairs(characters) do
- local desc = "The '" .. name .. "' Character"
+ local desc = S("Ehlphabet Block '@1'", name)
local byte = name:byte()
local mb = is_multibyte(name)
local file, key
@@ -58,7 +62,7 @@ for _, name in ipairs(characters) do
minetest.register_node(
key,
{
- description = "Ehlphabet Block '" .. name .. "'",
+ description = desc,
tiles = {"ehlphabet_" .. file .. ".png"},
paramtype2 = "facedir", -- neu
on_rotate = screwdriver.rotate_simple , -- neu
@@ -81,7 +85,7 @@ end
minetest.register_node(
"ehlphabet:machine",
{
- description = "Letter Machine",
+ description = S("Letter Machine"),
tiles = {
"ehlphabet_machine_top.png",
"ehlphabet_machine_bottom.png",
@@ -102,7 +106,7 @@ minetest.register_node(
if player then
minetest.chat_send_player(
player:get_player_name(),
- "You cannot dig the Letter Machine with blocks inside"
+ S("You cannot dig the @1 with blocks inside", S("Letter Machine"))
)
end -- end if player
return false
@@ -119,11 +123,11 @@ minetest.register_node(
meta:set_string(
"formspec",
"invsize[8,6;]" ..
- "field[3.8,.5;1,1;lettername;Letter;]" ..
+ "field[3.8,.5;1,1;lettername;" .. S("Letter") .. ";]" ..
"list[current_name;input;2.5,0.2;1,1;]" ..
"list[current_name;output;4.5,0.2;1,1;]" ..
"list[current_player;main;0,2;8,4;]" ..
- "button[2.54,-0.25;3,4;name;Blank -> Letter]"
+ "button[2.54,-0.25;3,4;name;" .. S("Blank -> Letter") .. "]"
)
local inv = meta:get_inventory()
inv:set_size("input", 1)
@@ -160,7 +164,7 @@ minetest.register_alias("abjphabet:machine", "ehlphabet:machine")
minetest.register_node(
"ehlphabet:block",
{
- description = "Ehlphabet Block (blank)",
+ description = S("Ehlphabet Block (blank)"),
tiles = {"ehlphabet_000.png"},
groups = {cracky = 3}
}
@@ -192,3 +196,5 @@ minetest.register_craft({
recipe = {"ehlphabet:block"},
type = "shapeless"
})
+
+-- print(S("[MOD] Elphabet is loaded"))
diff --git a/intllib.lua b/intllib.lua
new file mode 100644
index 0000000..6669d72
--- /dev/null
+++ b/intllib.lua
@@ -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
diff --git a/locale/de.po b/locale/de.po
new file mode 100644
index 0000000..8fda8b1
--- /dev/null
+++ b/locale/de.po
@@ -0,0 +1,46 @@
+# German translation of ehlphabet mod
+# Copyright (C) 2018 Sam Hocevar
+# This file is distributed under the same license as the ehlphabet package.
+# CodeXP <codexp@gmx.net>, 2018.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: ehlphabet\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-04-01 00:10+0200\n"
+"PO-Revision-Date: \n"
+"Last-Translator: CodeXP <codexp@gmx.net>\n"
+"Language-Team: \n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: init.lua
+msgid "Ehlphabet Block '@1'"
+msgstr "Ehlphabet Block '@1'"
+
+#: init.lua
+msgid "Letter Machine"
+msgstr "Zeichenmaschine"
+
+#: init.lua
+msgid "You cannot dig the @1 with blocks inside"
+msgstr "Du kannst die @1 nicht wegräumen solange sie gefüllt ist"
+
+#: init.lua
+msgid "Letter"
+msgstr "Zeichen"
+
+#: init.lua
+msgid "Blank -> Letter"
+msgstr "Blanko -> Zeichen"
+
+#: init.lua
+msgid "Ehlphabet Block (blank)"
+msgstr "Ehlphabet Block (Blanko)"
+
+#: init.lua
+msgid "[MOD] Elphabet is loaded"
+msgstr "[MOD] Elphabet wurde geladen"
diff --git a/locale/ru.po b/locale/ru.po
new file mode 100644
index 0000000..40b0537
--- /dev/null
+++ b/locale/ru.po
@@ -0,0 +1,46 @@
+# Russian translation of ehlphabet mod
+# Copyright (C) 2018 Sam Hocevar
+# This file is distributed under the same license as the ehlphabet package.
+# CodeXP <codexp@gmx.net>, 2018.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: ehlphabet\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-04-01 00:10+0200\n"
+"PO-Revision-Date: \n"
+"Last-Translator: CodeXP <codexp@gmx.net>\n"
+"Language-Team: \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 "Ehlphabet Block '@1'"
+msgstr "Блок эльфавита '@1'"
+
+#: init.lua
+msgid "Letter Machine"
+msgstr "Станок букв"
+
+#: init.lua
+msgid "You cannot dig the @1 with blocks inside"
+msgstr "Ты не можеш убрать @1 пока он наполнен блоками"
+
+#: init.lua
+msgid "Letter"
+msgstr "Буква"
+
+#: init.lua
+msgid "Blank -> Letter"
+msgstr "Бланк -> Буква"
+
+#: init.lua
+msgid "Ehlphabet Block (blank)"
+msgstr "Блок эльфавита (бланк)"
+
+#: init.lua
+msgid "[MOD] Elphabet is loaded"
+msgstr "[MOD] Эльфавит загружен"
diff --git a/locale/template.pot b/locale/template.pot
new file mode 100644
index 0000000..01d083c
--- /dev/null
+++ b/locale/template.pot
@@ -0,0 +1,46 @@
+# German translation of ehlphabet mod
+# Copyright (C) 2018 Sam Hocevar
+# This file is distributed under the same license as the ehlphabet package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: ehlphabet\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-04-01 00:10+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=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: init.lua
+msgid "Ehlphabet Block '@1'"
+msgstr ""
+
+#: init.lua
+msgid "Letter Machine"
+msgstr ""
+
+#: init.lua
+msgid "You cannot dig the @1 with blocks inside"
+msgstr ""
+
+#: init.lua
+msgid "Letter"
+msgstr ""
+
+#: init.lua
+msgid "Blank -> Letter"
+msgstr ""
+
+#: init.lua
+msgid "Ehlphabet Block (blank)"
+msgstr ""
+
+#: init.lua
+msgid "[MOD] Elphabet is loaded"
+msgstr ""