1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-07-03 16:40:45 +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 @@ 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