diff --git a/init.lua b/init.lua index 312ae52..7035e45 100755 --- a/init.lua +++ b/init.lua @@ -1,23 +1,13 @@ ---= Teleport Potion mod 0.8 by TenPlus1 +--= Teleport Potion mod by TenPlus1 -- Create teleport potion or pad, place then right-click to enter coords -- and step onto pad or walk into the blue portal light, portal closes after -- 10 seconds, pad remains, potions are throwable... SFX are license Free... --- Intllib -local S - -if minetest.get_modpath("intllib") then - S = intllib.Getter() -else - S = function(s, a, ...) a = {a, ...} - return s:gsub("@(%d+)", function(n) - return a[tonumber(n)] - end) - end - -end +-- Load support for intllib. +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") -- max teleport distance 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..2e9df77 --- /dev/null +++ b/locale/de.po @@ -0,0 +1,59 @@ +# 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 , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-14 08:37+0200\n" +"PO-Revision-Date: 2016-05-27 08:38+0200\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.12\n" +"Last-Translator: Xanthin\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: de\n" + +#: init.lua +msgid "Teleport Potion (place and right-click to enchant location)" +msgstr "" +"Teleportationstrank (platzieren und rechtsklicken,\n" +"um Standort zu verzaubern)" + +#: init.lua +msgid "Enter teleport coords (e.g. 200,20,-200)" +msgstr "Koordinaten eingeben (z.B. 200,20,-200)" + +#: init.lua +msgid "Right-click to enchant teleport location" +msgstr "Rechtsklick um Teleportationsort zu verzaubern" + +#: init.lua +msgid "Potion failed!" +msgstr "Trank misslungen!" + +#: init.lua +msgid "Teleport Pad (place and right-click to enchant location)" +msgstr "" +"Teleportationsfeld (platzieren und rechtsklicken,\n" +"um Standort zu verzaubern)" + +#: init.lua +msgid "Enter teleport coords (e.g. 200,20,-200,Home)" +msgstr "Koordinaten eingeben (z.B. 200,20,-200,Haus)" + +#: init.lua +msgid "Teleport to @1" +msgstr "Teleportiere nach @1" + +#: init.lua +msgid "Pad Active (@1,@2,@3)" +msgstr "Feld aktiv (@1,@2,@3)" + +#: init.lua +msgid "Teleport Pad coordinates failed!" +msgstr "Teleportationsfeldkoordinaten fehlgeschlagen!" diff --git a/locale/de.txt b/locale/de.txt deleted file mode 100644 index 2d431d7..0000000 --- a/locale/de.txt +++ /dev/null @@ -1,14 +0,0 @@ -# German Translation for teleport_potion mod -# Deutsche Übersetzung der teleport_potion Mod -# last update: 2016/May/27 -# Author: Xanthin - -Teleport Potion (place and right-click to enchant location) = Teleportationstrank (platzieren und rechtsklicken,\num Standort zu verzaubern) -Enter teleport coords (e.g. 200,20,-200) = Koordinaten eingeben (z.B. 200,20,-200) -Right-click to enchant teleport location = Rechtsklick um Teleportationsort zu verzaubern -Potion failed! = Trank misslungen! -Teleport Pad (place and right-click to enchant location) = Teleportationsfeld (platzieren und rechtsklicken,\num Standort zu verzaubern) -Enter teleport coords (e.g. 200,20,-200,Home) = Koordinaten eingeben (z.B. 200,20,-200,Haus) -Teleport to @1 = Teleportiere nach @1 -Pad Active (@1,@2,@3) = Feld aktiv (@1,@2,@3) -Teleport Pad coordinates failed! = Teleportationsfeldkoordinaten fehlgeschlagen! \ No newline at end of file diff --git a/locale/fr.po b/locale/fr.po new file mode 100644 index 0000000..78cd2be --- /dev/null +++ b/locale/fr.po @@ -0,0 +1,55 @@ +# 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 , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-14 08:35+0200\n" +"PO-Revision-Date: 2017-05-14 08:37+0200\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.12\n" +"Last-Translator: Peppy \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"Language: fr\n" + +#: init.lua +msgid "Teleport Potion (place and right-click to enchant location)" +msgstr "Potion de téléportation (poser puis clic-droit pour enchanter l'emplacement)" + +#: init.lua +msgid "Enter teleport coords (e.g. 200,20,-200)" +msgstr "Saisissez les coordonnées de téléportation (ex : 200,20,-200)" + +#: init.lua +msgid "Right-click to enchant teleport location" +msgstr "Clic-droit pour enchanter l'emplacement de téléportation" + +#: init.lua +msgid "Potion failed!" +msgstr "La potion n'a pas fonctionné !" + +#: init.lua +msgid "Teleport Pad (place and right-click to enchant location)" +msgstr "Pad de téléportation (poser puis clic-droit pour enchanter l'emplacement)" + +#: init.lua +msgid "Enter teleport coords (e.g. 200,20,-200,Home)" +msgstr "Saisissez les coordonnées de téléportation (ex : 200,20,-200,Maison)" + +#: init.lua +msgid "Teleport to @1" +msgstr "Téléportation vers @1" + +#: init.lua +msgid "Pad Active (@1,@2,@3)" +msgstr "Pad activé (@1,@,2,@3)" + +#: init.lua +msgid "Teleport Pad coordinates failed!" +msgstr "Les coordonnées du pad sont inchangées !" diff --git a/locale/template.pot b/locale/template.pot new file mode 100644 index 0000000..3826160 --- /dev/null +++ b/locale/template.pot @@ -0,0 +1,54 @@ +# 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 , 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 \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: init.lua +msgid "Teleport Potion (place and right-click to enchant location)" +msgstr "" + +#: init.lua +msgid "Enter teleport coords (e.g. 200,20,-200)" +msgstr "" + +#: init.lua +msgid "Right-click to enchant teleport location" +msgstr "" + +#: init.lua +msgid "Potion failed!" +msgstr "" + +#: init.lua +msgid "Teleport Pad (place and right-click to enchant location)" +msgstr "" + +#: init.lua +msgid "Enter teleport coords (e.g. 200,20,-200,Home)" +msgstr "" + +#: init.lua +msgid "Teleport to @1" +msgstr "" + +#: init.lua +msgid "Pad Active (@1,@2,@3)" +msgstr "" + +#: init.lua +msgid "Teleport Pad coordinates failed!" +msgstr "" diff --git a/locale/template.txt b/locale/template.txt deleted file mode 100644 index f0cb26f..0000000 --- a/locale/template.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Template for translations of teleport_potion mod -# last update: 2016/May/27 - -Teleport Potion (place and right-click to enchant location) = -Enter teleport coords (e.g. 200,20,-200) = -Right-click to enchant teleport location = -Potion failed! = -Teleport Pad (place and right-click to enchant location) = -Enter teleport coords (e.g. 200,20,-200,Home) = -Teleport to @1 = -Pad Active (@1,@2,@3) = -Teleport Pad coordinates failed! = \ No newline at end of file