Translations now use get_translator

This commit is contained in:
Peppy 2019-11-21 00:23:39 +01:00
parent ce8b297ce6
commit 7001f2103f
7 changed files with 24 additions and 152 deletions

View File

@ -1,10 +1,8 @@
local S = minetest.get_translator("axinite")
axinite = {}
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
axinite.intllib = S
axinite.get_translator = S
local path = minetest.get_modpath("axinite")
dofile(path.."/nodes.lua")

View File

@ -1,45 +0,0 @@
-- 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

10
locale/axinite.fr.tr Normal file
View File

@ -0,0 +1,10 @@
# textdomain: axinite
Can use /setpoint and /point=Est autorisé à utiliser /setpoint et /point
Teleport you to your second_home point=Vous téléporte à votre l'emplacement de votre seconde maison
Teleported to point!=Téléporté à votre seconde maison !
Set a point using /setpoint=Définissez d'abord l'emplacement de votre seconde maison avec /setpoint
Set your point=Définit l'emplacement de votre seconde maison
Point set!=L'emplacement de votre seconde maison est enregistré !
Teleport you to spawn point.=Vous téléporte à l'emplacement de votre seconde maison.
Teleported to spawn!=Téléporté au point de départ !

View File

@ -1,51 +0,0 @@
# 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: Axinite\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-02 10:03+0200\n"
"PO-Revision-Date: 2018-04-02 10:08+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 2.0.4\n"
"Last-Translator: Peppy <peppy@twang-factory.com>\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Language: fr\n"
#: utilities.lua
msgid "Can use /setpoint and /point"
msgstr "Est autorisé à utiliser /setpoint et /point"
#: utilities.lua
msgid "Teleport you to your second_home point"
msgstr "Vous téléporte à votre l'emplacement de votre seconde maison"
#: utilities.lua
msgid "Teleported to point!"
msgstr "Téléporté à votre seconde maison !"
#: utilities.lua
msgid "Set a point using /setpoint"
msgstr "Définissez d'abord l'emplacement de votre seconde maison avec /setpoint"
#: utilities.lua
msgid "Set your point"
msgstr "Définit l'emplacement de votre seconde maison"
#: utilities.lua
msgid "Point set!"
msgstr "L'emplacement de votre seconde maison est enregistré !"
#: utilities.lua
msgid "Teleport you to spawn point."
msgstr "Vous téléporte à l'emplacement de votre seconde maison."
#: utilities.lua
msgid "Teleported to spawn!"
msgstr "Téléporté au point de départ !"

10
locale/template Normal file
View File

@ -0,0 +1,10 @@
# textdomain: axinite
Can use /setpoint and /point=
Teleport you to your second_home point=
Teleported to point!=
Set a point using /setpoint=
Set your point=
Point set!=
Teleport you to spawn point.=
Teleported to spawn!=

View File

@ -1,50 +0,0 @@
# 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: Axinite\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-02 10:03+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\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 2.0.4\n"
#: utilities.lua
msgid "Can use /setpoint and /point"
msgstr ""
#: utilities.lua
msgid "Teleport you to your second_home point"
msgstr ""
#: utilities.lua
msgid "Teleported to point!"
msgstr ""
#: utilities.lua
msgid "Set a point using /setpoint"
msgstr ""
#: utilities.lua
msgid "Set your point"
msgstr ""
#: utilities.lua
msgid "Point set!"
msgstr ""
#: utilities.lua
msgid "Teleport you to spawn point."
msgstr ""
#: utilities.lua
msgid "Teleported to spawn!"
msgstr ""

View File

@ -1,4 +1,4 @@
local S = axinite.intllib
local S = axinite.get_translator
----------- SET POINT