1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-07-15 22:40:27 +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

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