diff --git a/config.lua b/config.lua index 1b6dcaf..4adf080 100644 --- a/config.lua +++ b/config.lua @@ -1,39 +1,38 @@ - - +local S=physio_stress.intllib statistic_awards.hiking={ {basename="statisticawards_hiking", level=1, title="Walked 1000 miles", - description="You walked quite far. Keep going.", + description=S("You walked quite far. Keep going."), baseicon = "statistic_awards_hiking.png", threshold=1000, difficulty=0.001,}, {basename="statisticawards_hiking", level=2, title="Walked 10000 miles", - description="You walked quite far. Keep going.", + description=S("You walked quite far. Keep going."), baseicon = "statistic_awards_hiking.png", threshold=10000, difficulty=0.005,}, {basename="statisticawards_hiking", level=3, title="Walked 50000 miles", - description="You walked quite far. Keep going.", + description=S("You walked quite far. Keep going."), baseicon = "statistic_awards_hiking.png", threshold=50000, difficulty=0.01,}, {basename="statisticawards_hiking", level=4, title="Walked 100000 miles", - description="You walked quite far. Keep going.", + description=S("You walked quite far. Keep going."), baseicon = "statistic_awards_hiking.png", threshold=100000, difficulty=0.1,}, {basename="statisticawards_hiking", level=5, title="Walked 500000 miles", - description="You walked quite far. Keep going.", + description=S("You walked quite far. Keep going."), baseicon = "statistic_awards_hiking.png", threshold=500000, difficulty=1,}, @@ -42,21 +41,21 @@ statistic_awards.crafting={ {basename="statisticawards_crafting", level=1, title="crafted 100 items", - description="You crafted quite far. Keep going.", + description=S("You crafted quite much. Keep going."), baseicon = "statistic_awards_crafting.png", threshold=100, difficulty=0.001,}, {basename="statisticawards_crafting", level=2, title="Crafted 1000 items", - description="You crafted quite far. Keep going.", + description=S("You crafted quite much. Keep going."), baseicon = "statistic_awards_crafting.png", threshold=1000, difficulty=0.005,}, {basename="statisticawards_crafting", level=3, title="Crafted 5000 items", - description="You crafted quite far. Keep going.", + description=S("You crafted quite much. Keep going."), baseicon = "statistic_awards_crafting.png", threshold=5000, difficulty=0.01,}, @@ -65,14 +64,14 @@ statistic_awards.swimming={ {basename="statisticawards_swimming", level=1, title="Swam 100 miles", - description="You swam quite far. Keep going.", + description=S("You swam quite far. Keep going."), baseicon = "statistic_awards_swimming.png", threshold=100, difficulty=0.001,}, {basename="statisticawards_swimming", level=2, title="Swam 1000 miles", - description="You swam quite far. Keep going.", + description=S("You swam quite far. Keep going."), baseicon = "statistic_awards_swimming.png", threshold=1000, difficulty=0.005,}, @@ -86,14 +85,14 @@ statistic_awards.swimming={ {basename="statisticawards_swimming", level=4, title="Swam 10000 miles", - description="You swam quite far. Keep going.", + description=S("You swam quite far. Keep going."), baseicon = "statistic_awards_swimming.png", threshold=10000, difficulty=0.1,}, {basename="statisticawards_swimming", level=5, title="Swam 50000 miles", - description="You swam quite far. Keep going.", + description=S("You swam quite far. Keep going."), baseicon = "statistic_awards_swimming.png", threshold=50000, difficulty=1,}, @@ -103,7 +102,7 @@ statistic_awards.deaths={ {basename="statisticawards_deaths", level=1, title="Died 7 times", - description="You're cat is jealous about you.", + description=S("You're cat is jealous about you."), baseicon = "statistic_awards_death.png", threshold=7, difficulty=0.001,}, @@ -117,14 +116,14 @@ statistic_awards.deaths={ {basename="statisticawards_deaths", level=3, title="Died 1000 times", - description="Expert in death", + description=S("Expert in death"), baseicon = "statistic_awards_death.png", threshold=1000, difficulty=0.1,}, {basename="statisticawards_deaths", level=4, title="Died 5000 times", - description="Life is boring?", + description=S("Life is boring?"), baseicon = "statistic_awards_death.png", threshold=5000, difficulty=1,}, diff --git a/init.lua b/init.lua index ad06bef..07b68aa 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,8 @@ statistic_awards = {} statistic_awards.path = minetest.get_modpath("statistic_awards") statistic_awards.modname = minetest.get_current_modname() +local S = dofile(statistic_awards.path .. "/intllib.lua") +statistic_awards.intllib = S -- import settingtypes.txt basic_functions.import_settingtype(statistic_awards.path .. "/settingtypes.txt") 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 . + +-- 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..442759a --- /dev/null +++ b/locale/de.po @@ -0,0 +1,39 @@ +# German Translation for statistic_awards mod. +# Copyright (C) 2019 +# This file is distributed under the same license as the farming package. +# Xanthin. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1.27\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-02-14 HO:MI+ZONE\n" +"PO-Revision-Date: 2019-02-14 HO:MI+ZONE\n" +"Last-Translator: ademant\n" +"Language-Team: \n" +"Language: German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "You walked quite far. Keep going." +msgstr "Du bist schon weit gekommen. Weiter so." + +msgid "You crafted quite much. Keep going." +msgstr "Du hast schon viel hergestellt. Weiter so." + +msgid "You swam quite far. Keep going." +msgstr "Du bist schon weit geschwommen. Weiter so." + +msgid "You're cat is jealous about you." +msgstr "Deine Katze wird eifersüchtig." + +msgid "You like the danger." +msgstr "Du liebst wohl die Gefahr." + +msgid "Expert in death" +msgstr "Experte im Geschäft mit dem Tod" + +msgid "Life is boring?" +msgstr "Ist das Leben langweilig?"