1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2024-06-29 14:50:18 +02:00

replace intllib

This commit is contained in:
Niklp09 2023-06-11 14:31:01 +02:00
parent 49143feccb
commit a50f095ae5
41 changed files with 136 additions and 335 deletions

View File

@ -22,10 +22,8 @@ boards = {}
boards.name = minetest.get_current_modname()
boards.path = minetest.get_modpath(boards.name)
-- Load support for intllib.
local S, NS = dofile(boards.path.."/intllib.lua")
boards.intllib = S
local F = function(...) return minetest.formspec_escape(S(...)) end
-- Translation support
local S = minetest.get_translator(boards.name)
-- Load font
dofile(boards.path.."/font_tinycurs.lua")
@ -34,9 +32,9 @@ local function set_formspec(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[6,4]"..default.gui_bg..default.gui_bg_img..default.gui_slots..
"textarea[0.5,0.7;5.5,3;display_text;"..F("Text")..";${display_text}]"..
"button_exit[3,3.5;2,1;ok;"..F("Write").."]"..
"button_exit[1,3.5;2,1;wipe;"..F("Wipe").."]")
"textarea[0.5,0.7;5.5,3;display_text;"..S("Text")..";${display_text}]"..
"button_exit[3,3.5;2,1;ok;"..S("Write").."]"..
"button_exit[1,3.5;2,1;wipe;"..S("Wipe").."]")
end
-- On boards, everyone is allowed to write and wipe

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

View File

@ -0,0 +1,6 @@
# textdomain: boards
Text=Text
Write=Schreiben
Wipe=Abwischen
Black board=Schwarze Tafel
Green board=Grüne Tafel

View File

@ -1,3 +1,6 @@
# textdomain: boards
Text=
Write=
Wipe=
Black board=Tableau noir
Green board=Tableau vert

View File

@ -1,3 +1,6 @@
# textdomain: boards
Text=
Write=
Wipe=
Black board=Papan hitam
Green board=

View File

@ -1,3 +1,6 @@
# textdomain: boards
Text=
Write=
Wipe=
Black board=
Green board=

View File

@ -22,9 +22,8 @@ ontime_clocks = {}
ontime_clocks.name = minetest.get_current_modname()
ontime_clocks.path = minetest.get_modpath(ontime_clocks.name)
-- Load support for intllib.
local S, NS = dofile(ontime_clocks.path.."/intllib.lua")
ontime_clocks.intllib = S
-- Translation support
ontime_clocks.S = minetest.get_translator(ontime_clocks.name)
dofile(ontime_clocks.path.."/common.lua")
dofile(ontime_clocks.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

View File

@ -0,0 +1,7 @@
# textdomain: ontime_clocks
Green digital clock=Grüne Digitaluhr
Red digital clock=Rote Digitaluhr
White clock=Weiße Uhr
Frameless clock=Rahmenlose Uhr
Frameless gold clock=Rahmenlose goldene Uhr
Frameless white clock=Rahmenlose weiße Uhr

View File

@ -2,4 +2,3 @@ name = ontime_clocks
title = Ontime Clocks
description = Clocks displaing real ingame time
depends = default,dye,display_api
optional_depends = intllib

View File

@ -18,7 +18,7 @@
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
--]]
local S = ontime_clocks.intllib
local S = ontime_clocks.S
local function clock_on_construct(pos)
local timer = minetest.get_node_timer(pos)

View File

@ -18,9 +18,6 @@
along with signs. If not, see <http://www.gnu.org/licenses/>.
--]]
local S = signs.intllib
local F = function(...) return minetest.formspec_escape(S(...)) end
-- Generic callback for show_formspec displayed formspecs of "sign" mod
minetest.register_on_player_receive_fields(function(player, formname, fields)

View File

@ -22,9 +22,8 @@ signs = {}
signs.name = minetest.get_current_modname()
signs.path = minetest.get_modpath(signs.name)
-- Load support for intllib.
local S, NS = dofile(signs.path.."/intllib.lua")
signs.intllib = S
-- Translation support
signs.S = minetest.get_translator(signs.name)
dofile(signs.path.."/common.lua")
dofile(signs.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

14
signs/locale/signs.de.txt Normal file
View File

@ -0,0 +1,14 @@
# textdomain: signs
Close=Schließen
Edit=Bearbeiten
Title=Titel
Text=Text
Title font=Titel Schriftart
Write=Schreiben
(right-click to read more text)=(Rechtsklick für mehr Text)
Wooden sign=Hölzernes Schild
Wooden long sign=Langes hölzernes Schild
Wooden direction sign=Hölzerner Wegweiser
Poster=Poster
Small label=Kleines Etikett
Label=Etikett

View File

@ -1,4 +1,10 @@
# textdomain: signs
Close=
Edit=
Title=
Text=
Title font=
Write=
(right-click to read more text)=(Clic-droit pour afficher le texte entier)
Wooden sign=
Wooden long sign=

View File

@ -1,4 +1,10 @@
# textdomain: signs
Close=
Edit=
Title=
Text=
Title font=
Write=
(right-click to read more text)=(klik-kanan untuk baca teks penuh)
Wooden sign=
Wooden long sign=

View File

@ -1,4 +1,10 @@
# textdomain: signs
Close=
Edit=
Title=
Text=
Title font=
Write=
(right-click to read more text)=
Wooden sign=
Wooden long sign=

View File

@ -2,4 +2,3 @@ name = signs
title = Signs
description = Basic signs and posters with text display using signs_api
depends = default,dye,signs_api
optional_depends = intllib

View File

@ -18,8 +18,7 @@
along with signs. If not, see <http://www.gnu.org/licenses/>.
--]]
local S = signs.intllib
local F = function(...) return minetest.formspec_escape(S(...)) end
local S = signs.S
-- Poster specific formspec
local function display_poster(pos, node, player)
@ -47,11 +46,11 @@ local function display_poster(pos, node, player)
minetest.formspec_escape(meta:get_string("text"))))
if minetest.is_protected(pos, player:get_player_name()) then
fs = string.format("%sbutton_exit[2.5,8;2,1;ok;%s]", fs, F("Close"))
fs = string.format("%sbutton_exit[2.5,8;2,1;ok;%s]", fs, S("Close"))
else
fs = string.format(
"%sbutton[1,8;2,1;edit;%s]button_exit[4,8;2,1;ok;%s]",
fs, F("Edit"), F("Close"))
fs, S("Edit"), S("Close"))
end
minetest.show_formspec(player:get_player_name(), fname, fs)
end
@ -70,10 +69,10 @@ local function edit_poster(pos, node, player)
textarea[0.5,1.7;6,6;text;%s;%s]
button[1.25,7;2,1;font;%s]
button_exit[3.25,7;2,1;write;%s]]=],
default.gui_bg, default.gui_bg_img, default.gui_slots, F("Title"),
default.gui_bg, default.gui_bg_img, default.gui_slots, S("Title"),
minetest.formspec_escape(meta:get_string("display_text")),
F("Text"), minetest.formspec_escape(meta:get_string("text")),
F("Title font"), F("Write"))
S("Text"), minetest.formspec_escape(meta:get_string("text")),
S("Title font"), S("Write"))
minetest.show_formspec(player:get_player_name(), fname, fs)
end
end

View File

@ -22,10 +22,8 @@ signs_api = {}
signs_api.name = minetest.get_current_modname()
signs_api.path = minetest.get_modpath(signs_api.name)
-- Load support for intllib.
local S, NS = dofile(signs_api.path.."/intllib.lua")
signs_api.intllib = S
local F = function(...) return minetest.formspec_escape(S(...)) end
-- Translation support
local S = minetest.get_translator(signs_api.name)
function signs_api.set_display_text(pos, text, font)
local meta = minetest.get_meta(pos)
@ -50,22 +48,22 @@ function signs_api.set_formspec(pos)
local fs, y
if maxlines == 1 then
fs = "field[0.5,0.7;5.5,1;display_text;"..F("Text")..
fs = "field[0.5,0.7;5.5,1;display_text;"..S("Text")..
";${display_text}]"
y = 1.2
else
local extralabel = ""
if maxlines then
extralabel = F(" (first %s lines only)"):format(maxlines)
extralabel = S(" (first %s lines only)"):format(maxlines)
end
fs = "textarea[0.5,0.7;5.5,2;display_text;"..F("Text")..""..
fs = "textarea[0.5,0.7;5.5,2;display_text;"..S("Text")..""..
extralabel..";${display_text}]"
y = 2.4
end
fs = fs.."button[1,"..y..";2,1;font;"..F("Font").."]"
fs = fs.."button_exit[3,"..y..";2,1;ok;"..F("Write").."]"
fs = fs.."button[1,"..y..";2,1;font;"..S("Font").."]"
fs = fs.."button_exit[3,"..y..";2,1;ok;"..S("Write").."]"
y = y + 0.8
fs = "size[6,"..y.."]"..default.gui_bg..
default.gui_bg_img..default.gui_slots..fs

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

View File

@ -0,0 +1,5 @@
# textdomain: signs_api
Text=Text
(first %s lines only)= (nur die ersten %s-Zeilen)
Font=Schriftart
Write=Schreiben

View File

@ -1,10 +1,5 @@
# textdomain: signs_api
Text=Texte
Write=Écrire
(first %s lines only)= (uniquement les %s premières lignes)
Title=Titre
Close=Fermer
(right-click to read more text)=(Clic-droit pour afficher le texte entier)
Wooden direction sign=Panneau de direction en bois
Poster=Affiche
Textd=Texte
Font=
Write=Écrire

View File

@ -1,9 +1,5 @@
# textdomain: signs_api
Text=Teks
Write=Tulis
(first %s lines only)= (%s baris pertama sahaja)
Title=Tajuk
Close=Tutup
(right-click to read more text)=(klik-kanan untuk baca teks penuh)
Wooden direction sign=Papan tanda arah kayu
Poster=Poster
Font=
Write=Tulis

View File

@ -0,0 +1,5 @@
# textdomain: signs_api
Text=
(first %s lines only)=
Font=
Write=

View File

@ -2,4 +2,3 @@ name = signs_api
title = Signs API
description = A library providing various helper functions for registereing signs with text display
depends = default,display_api,font_api
optional_depends = intllib

View File

@ -23,9 +23,8 @@ signs_road = {}
signs_road.name = minetest.get_current_modname()
signs_road.path = minetest.get_modpath(signs_road.name)
-- Load support for intllib.
local S, NS = dofile(signs_road.path.."/intllib.lua")
signs_road.intllib = S
-- Translation support
signs_road.S = minetest.get_translator(signs_road.name)
dofile(signs_road.path.."/nodes.lua")
dofile(signs_road.path.."/crafts.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

View File

@ -0,0 +1,15 @@
# textdomain: signs_road
Blue street sign=Blaues Straßenschild
Large banner=Großes Banner
Red and white town sign=Rot-weißes Ortsschild
White street sign=Weißes Straßenschild
Blue road sign=Blaues Straßenschild
Green road sign=Grünes Straßenschild
Yellow road sign=Gelbes Straßenschild
Red road sign=Rotes Straßenschild
Black direction sign=Schwarzer Wegweiser
White direction sign=Weißer Wegweiser
Blue direction sign=Blauer Wegweiser
Green direction sign=Grüner Wegweiser
Yellow direction sign=Gelber Wegweiser
Red direction sign=Roter Wegweiser

View File

@ -2,4 +2,3 @@ name = signs_road
title = Signs Road
description = Various road signs with text display using signs_api
depends = default,dye,signs_api
optional_depends = intllib

View File

@ -19,7 +19,7 @@
along with signs_road. If not, see <http://www.gnu.org/licenses/>.
--]]
local S = signs_road.intllib
local S = signs_road.S
local models = {
blue_street_sign = {

View File

@ -18,7 +18,7 @@
along with steles. If not, see <http://www.gnu.org/licenses/>.
--]]
local S = steles.intllib
local S = steles.S
steles.materials = {
'default:stone',

View File

@ -22,9 +22,8 @@ steles = {}
steles.name = minetest.get_current_modname()
steles.path = minetest.get_modpath(steles.name)
-- Load support for intllib.
local S, NS = dofile(steles.path.."/intllib.lua")
steles.intllib = S
-- Translation support
steles.S = minetest.get_translator(steles.name)
dofile(steles.path.."/config.lua")
dofile(steles.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

View File

@ -0,0 +1,9 @@
# textdomain: steles
Stone Stele=Stein Stele
Sandstone Stele=Sandstein Stele
Desert Stone Stele=Wüstenstein Stele
Marble Stele=Mamor Stele
Granite Stele=Granit Stele
Displayed text (3 lines max)=Angezeigter Text (max. 3 Zeilen)
Font=Schriftart
Write=Schreiben

View File

@ -4,3 +4,6 @@ Sandstone Stele=Stèle en grès
Desert Stone Stele=Stèle en pierre du désert
Marble Stele=Stèle en marbre
Granite Stele=Stèle en granit
Displayed text (3 lines max)=
Font=
Write=

View File

@ -4,3 +4,6 @@ Sandstone Stele=Tulisan Batu Pasir
Desert Stone Stele=Tulisan Batu Gurun
Marble Stele=Tulisan Marmar
Granite Stele=Tulisan Granit
Displayed text (3 lines max)=
Font=
Write=

View File

@ -4,3 +4,6 @@ Sandstone Stele=
Desert Stone Stele=
Marble Stele=
Granite Stele=
Displayed text (3 lines max)=
Font=
Write=

View File

@ -2,4 +2,4 @@ name = steles
title = Steles
description = Stone steles with text display on them
depends = default,display_api,font_api
optional_depends = intllib,technic
optional_depends = technic

View File

@ -18,8 +18,7 @@
along with steles. If not, see <http://www.gnu.org/licenses/>.
--]]
local S = steles.intllib
local F = function(...) return minetest.formspec_escape(S(...)) end
local S = steles.S
display_api.register_display_entity("steles:text")
@ -69,8 +68,8 @@ for i, material in ipairs(steles.materials) do
button[1,3;2,1;font;%s]
button_exit[3,3;2,1;ok;%s]]=],
default.gui_bg, default.gui_bg_img, default.gui_slots,
F("Displayed text (3 lines max)"),
F("Font"), F("Write")))
S("Displayed text (3 lines max)"),
S("Font"), S("Write")))
display_api.on_construct(pos)
end,
on_destruct = display_api.on_destruct,