1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-07-12 21:10:31 +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=