add translation support to font formspec

This commit is contained in:
Niklp09 2023-06-12 18:41:45 +02:00
parent 14394b2a0f
commit 78218051f4
4 changed files with 12 additions and 2 deletions

View File

@ -16,6 +16,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
--]]
local S = font_api.S
local FS = function(...) return minetest.formspec_escape(S(...)) end
local modname = minetest.get_current_modname()
local contexts = {}
@ -101,9 +104,9 @@ local function show_font_formspec(playername)
table.sort(fonts)
local fs = string.format(
"size[4,%s]%s%s%sbutton_exit[0,%s;4,1;cancel;Cancel]",
"size[4,%s]%s%s%sbutton_exit[0,%s;4,1;cancel;%s]",
#fonts + 0.8, default.gui_bg, default.gui_bg_img, default.gui_slots,
#fonts)
#fonts, FS("Cancel"))
for line = 1, #fonts do
local font = font_api.get_font(fonts[line])

View File

@ -23,6 +23,9 @@ font_api = {}
font_api.name = minetest.get_current_modname()
font_api.path = minetest.get_modpath(font_api.name)
-- Translation support
font_api.S = minetest.get_translator(font_api.name)
-- Inclusions
-------------

View File

@ -0,0 +1,2 @@
# textdomain: font_api
Cancel=Schließen

View File

@ -0,0 +1,2 @@
# textdomain: font_api
Cancel=