Browse Source

add german translation (intllib)

master
codexp 4 years ago
parent
commit
d59c5fb7cd
  1. 1
      depends.txt
  2. 20
      init.lua
  3. 45
      intllib.lua
  4. 46
      locale/de.po
  5. 46
      locale/template.pot

1
depends.txt

@ -1 +1,2 @@
default
intllib?

20
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"},
groups = {cracky = 3, not_in_creative_inventory = 1, not_in_crafting_guide = 1}
}
@ -78,7 +82,7 @@ end
minetest.register_node(
"ehlphabet:machine",
{
description = "Letter Machine",
description = S("Letter Machine"),
tiles = {
"ehlphabet_machine_top.png",
"ehlphabet_machine_bottom.png",
@ -99,7 +103,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
@ -116,11 +120,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)
@ -157,7 +161,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}
}
@ -189,3 +193,5 @@ minetest.register_craft({
recipe = {"ehlphabet:block"},
type = "shapeless"
})
-- print(S("[MOD] Elphabet is loaded"))

45
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

46
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"

46
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 ""
Loading…
Cancel
Save