Updated intllib support (thanks fat115)

This commit is contained in:
TenPlus1 2017-08-04 11:05:01 +01:00
parent ca153f3f6a
commit 8b624d57dd
7 changed files with 217 additions and 40 deletions

View file

@ -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

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

59
locale/de.po Normal file
View file

@ -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 <EMAIL@ADDRESS>, 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!"

View file

@ -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!

55
locale/fr.po Normal file
View file

@ -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 <EMAIL@ADDRESS>, 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 <peppy@twang-factory.com>\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 !"

54
locale/template.pot Normal file
View file

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

View file

@ -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! =