Switch to new intllib system using gettext

This commit is contained in:
LNJ 2017-02-20 19:28:07 +01:00 committed by Auke Kok
parent 15f86d36c1
commit 214bd005e7
7 changed files with 362 additions and 89 deletions

View File

@ -5,3 +5,6 @@ all: release
release:
VERSION=`git describe --tags`; \
git archive --format zip --output "$(PROJECT)-$${VERSION}.zip" --prefix=$(PROJECT)/ master
poupdate:
../intllib/tools/xgettext.sh *.lua

View File

@ -59,18 +59,14 @@ settings.difficult = {
}
-- Intllib
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s) return s end
end
crops.intllib = S
local worldpath = minetest.get_worldpath()
local modpath = minetest.get_modpath(minetest.get_current_modname())
-- Load support for intllib.
local S, NS = dofile(modpath .. "/intllib.lua")
crops.intllib = S
dofile(modpath .. "/crops_settings.txt")
if io.open(worldpath .. "/crops_settings.txt", "r") == nil then

44
intllib.lua Normal file
View File

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

155
locale/fr.po Normal file
View File

@ -0,0 +1,155 @@
# 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-02-20 19:13+0100\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"
#: cooking.lua:23
msgid "Unbaked clay bowl"
msgstr "Bol en argile crue"
#: cooking.lua:37
msgid "Clay bowl"
msgstr "Bol en terre cuite"
#: cooking.lua:49
msgid "Bowl of vegetable stew"
msgstr "Bol de soupe de légumes"
#: cooking.lua:62
msgid "Bowl of uncooked vegetable stew"
msgstr "Bol de soupe de légumes non-cuite"
#: corn.lua:17
msgid "Corn"
msgstr "Mais"
#: corn.lua:47
msgid "Corn Cob"
msgstr "Epis de mais"
#: corn.lua:58
msgid "Corn on the Cob"
msgstr "Epis de mais grillé"
#: corn.lua:71 corn.lua:104 corn.lua:139 corn.lua:177 corn.lua:198 corn.lua:234
#: corn.lua:273 corn.lua:303
msgid "Corn plant"
msgstr "Plant de Mais"
#: init.lua:91 init.lua:95
msgid "Defaulting to \"normal\" difficulty settings"
msgstr "Réglage par default : \"normal\""
#: init.lua:99
msgid "[crops] Hydration and dehydration mechanics are enabled."
msgstr "[crops] Les mécaniques d'hydratation et déshydratation sont activées."
#: init.lua:108
msgid "Unable to find plant"
msgstr "Impossible de trouver la plante"
#: init.lua:108
msgid "in crops table"
msgstr "dans le tableau crops"
#: melon.lua:24
msgid "Melon seed"
msgstr "Graine de Pastèque"
#: melon.lua:52 melon.lua:73
msgid "Melon plant"
msgstr "Pied de Pastèque"
#: melon.lua:88
msgid "Melon slice"
msgstr "Tranche de Pastèque"
#: melon.lua:103
msgid "Melon"
msgstr "Pastèque"
#: polebean.lua:26
msgid "Green Bean"
msgstr "Haricot vert"
#: polebean.lua:151
msgid "Beanpoles"
msgstr "Tuteur pour haricots"
#: polebean.lua:183
msgid "Green bean seed"
msgstr "Graine de haricot vert"
#: polebean.lua:216
msgid "Green Bean plant"
msgstr "Plant de haricot vert"
#: polebean.lua:232
msgid "green bean plant"
msgstr "plant de haricot vert"
#: potato.lua:17
msgid "Potato eyes"
msgstr "Yeux de pomme de terre"
#: potato.lua:50
msgid "Potato plant"
msgstr "Plant de pomme de terre"
#: potato.lua:70
msgid "Potato"
msgstr "Pomme de terre"
#: potato.lua:85
msgid "Soil with potatoes"
msgstr "Terre labourée avec pommes de terres"
#: pumpkin.lua:24
msgid "Pumpkin seed"
msgstr "Graines de citrouille"
#: pumpkin.lua:52 pumpkin.lua:73
msgid "Pumpkin plant"
msgstr "Plant de citrouille"
#: pumpkin.lua:88
msgid "Roasted pumpkin"
msgstr "Citrouille grillée"
#: pumpkin.lua:109
msgid "Pumpkin"
msgstr "Citrouille"
#: tomato.lua:17
msgid "Tomato seed"
msgstr "Graines de tomate"
#: tomato.lua:48 tomato.lua:68 tomato.lua:103
msgid "Tomato plant"
msgstr "Pied de tomate"
#: tomato.lua:122
msgid "Tomato"
msgstr "Tomate"
#: tools.lua:16
msgid "Watering Can"
msgstr "Arrosoir"
#: tools.lua:80
msgid "Hydrometer"
msgstr "Hydromètre"

View File

@ -1,40 +0,0 @@
Defaulting to \"normal\" difficulty settings = Réglage par default : \"normal\"
[crops] Hydration and dehydration mechanics are enabled. = [crops] Les mécaniques d'hydratation et déshydratation sont activées.
Unable to find plant = Impossible de trouver la plante
in crops table = dans le tableau crops
Unbaked clay bowl = Bol en argile crue
Clay bowl = Bol en terre cuite
Bowl of vegetable stew = Bol de soupe de légumes
Bowl of uncooked vegetable stew = Bol de soupe de légumes non-cuite
Corn = Mais
Corn Cob = Epis de mais
Corn on the Cob = Epis de mais grillé
Corn plant = Plant de Mais
Melon seed = Graine de Pastèque
Melon plant = Pied de Pastèque
Melon slice = Tranche de Pastèque
Melon = Pastèque
Beanpole = Tuteur pour haricots
Green Bean = Haricot vert
Green bean seed = Graine de haricot vert
Green Bean plant = Plant de haricot vert
Potato eyes = Yeux de pomme de terre
Potato plant = Plant de pomme de terre
Potato = Pomme de terre
Soil with potatoes = Terre labourée avec pommes de terres
Pumpkin seed = Graines de citrouille
Pumpkin plant = Plant de citrouille
Roasted pumpkin = Citrouille grillée
Pumpkin = Citrouille
Tomato seed = Graines de tomate
Tomato plant = Pied de tomate
Tomato = Tomate
Watering Can = Arrosoir
Hydrometer = Hydromètre

155
locale/template.pot Normal file
View File

@ -0,0 +1,155 @@
# 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-02-20 19:26+0100\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"
#: cooking.lua:23
msgid "Unbaked clay bowl"
msgstr ""
#: cooking.lua:37
msgid "Clay bowl"
msgstr ""
#: cooking.lua:49
msgid "Bowl of vegetable stew"
msgstr ""
#: cooking.lua:62
msgid "Bowl of uncooked vegetable stew"
msgstr ""
#: corn.lua:17
msgid "Corn"
msgstr ""
#: corn.lua:47
msgid "Corn Cob"
msgstr ""
#: corn.lua:58
msgid "Corn on the Cob"
msgstr ""
#: corn.lua:71 corn.lua:104 corn.lua:139 corn.lua:177 corn.lua:198 corn.lua:234
#: corn.lua:273 corn.lua:303
msgid "Corn plant"
msgstr ""
#: init.lua:91 init.lua:95
msgid "Defaulting to \"normal\" difficulty settings"
msgstr ""
#: init.lua:99
msgid "[crops] Hydration and dehydration mechanics are enabled."
msgstr ""
#: init.lua:108
msgid "Unable to find plant"
msgstr ""
#: init.lua:108
msgid "in crops table"
msgstr ""
#: melon.lua:24
msgid "Melon seed"
msgstr ""
#: melon.lua:52 melon.lua:73
msgid "Melon plant"
msgstr ""
#: melon.lua:88
msgid "Melon slice"
msgstr ""
#: melon.lua:103
msgid "Melon"
msgstr ""
#: polebean.lua:26
msgid "Green Bean"
msgstr ""
#: polebean.lua:151
msgid "Beanpoles"
msgstr ""
#: polebean.lua:183
msgid "Green bean seed"
msgstr ""
#: polebean.lua:216
msgid "Green Bean plant"
msgstr ""
#: polebean.lua:232
msgid "green bean plant"
msgstr ""
#: potato.lua:17
msgid "Potato eyes"
msgstr ""
#: potato.lua:50
msgid "Potato plant"
msgstr ""
#: potato.lua:70
msgid "Potato"
msgstr ""
#: potato.lua:85
msgid "Soil with potatoes"
msgstr ""
#: pumpkin.lua:24
msgid "Pumpkin seed"
msgstr ""
#: pumpkin.lua:52 pumpkin.lua:73
msgid "Pumpkin plant"
msgstr ""
#: pumpkin.lua:88
msgid "Roasted pumpkin"
msgstr ""
#: pumpkin.lua:109
msgid "Pumpkin"
msgstr ""
#: tomato.lua:17
msgid "Tomato seed"
msgstr ""
#: tomato.lua:48 tomato.lua:68 tomato.lua:103
msgid "Tomato plant"
msgstr ""
#: tomato.lua:122
msgid "Tomato"
msgstr ""
#: tools.lua:16
msgid "Watering Can"
msgstr ""
#: tools.lua:80
msgid "Hydrometer"
msgstr ""

View File

@ -1,40 +0,0 @@
Defaulting to \"normal\" difficulty settings =
[crops] Hydration and dehydration mechanics are enabled. =
Unable to find plant =
in crops table =
Unbaked clay bowl =
Clay bowl =
Bowl of vegetable stew =
Bowl of uncooked vegetable stew =
Corn =
Corn Cob =
Corn on the Cob =
Corn plant =
Melon seed =
Melon plant =
Melon slice =
Melon =
Beanpole =
Green Bean =
Green bean seed =
Green Bean plant =
Potato eyes =
Potato plant =
Potato =
Soil with potatoes =
Pumpkin seed =
Pumpkin plant =
Roasted pumpkin =
Pumpkin =
Tomato seed =
Tomato plant =
Tomato =
Watering Can =
Hydrometer =