1
0
mirror of https://github.com/mt-mods/signs_lib.git synced 2024-11-13 05:10:18 +01:00

Make a bunch of strings translatable

This commit is contained in:
Wuzzy 2023-07-04 11:01:39 +02:00
parent ed3a679bca
commit b9f6b9269e
2 changed files with 12 additions and 9 deletions

15
api.lua
View File

@ -1,6 +1,7 @@
-- signs_lib api, backported from street_signs
local S = signs_lib.S
local FS = function(...) return minetest.formspec_escape(S(...)) end
local has_default_mod = minetest.get_modpath("default")
local function log(level, messagefmt, ...)
@ -1278,7 +1279,7 @@ minetest.register_lbm({
minetest.register_chatcommand("regen_signs", {
params = "",
privs = {server = true},
description = "Skims through all currently-loaded sign-bearing mapblocks, clears away any entities within each sign's node space, and regenerates their text entities, if any.",
description = S("Skims through all currently-loaded sign-bearing mapblocks, clears away any entities within each sign's node space, and regenerates their text entities, if any."),
func = function(player_name, params)
local allsigns = {}
local totalsigns = 0
@ -1297,13 +1298,13 @@ minetest.register_chatcommand("regen_signs", {
end
if signs_lib.totalblocks < 0 then signs_lib.totalblocks = 0 end
if totalsigns == 0 then
minetest.chat_send_player(player_name, "There are no signs in the currently-loaded terrain.")
minetest.chat_send_player(player_name, S("There are no signs in the currently-loaded terrain."))
signs_lib.block_list = {}
return
end
minetest.chat_send_player(player_name, "Found a total of "..totalsigns.." sign nodes across "..signs_lib.totalblocks.." blocks.")
minetest.chat_send_player(player_name, "Regenerating sign entities...")
minetest.chat_send_player(player_name, S("Found a total of @1 sign nodes across @2 blocks.", totalsigns, signs_lib.totalblocks))
minetest.chat_send_player(player_name, S("Regenerating sign entities ..."))
for _, b in pairs(allsigns) do
for _, pos in ipairs(b) do
@ -1315,7 +1316,7 @@ minetest.register_chatcommand("regen_signs", {
end
end
end
minetest.chat_send_player(player_name, "Finished.")
minetest.chat_send_player(player_name, S("Finished."))
end
})
@ -1343,14 +1344,14 @@ function get_sign_formspec(pos, nodename)
"image[0.1,2.4;7,1;signs_lib_sign_color_palette.png]",
"textarea[0.15,-0.2;6.3,2.8;text;;" .. minetest.formspec_escape(txt) .. "]",
"button_exit[3.7,3.4;2,1;ok;" .. S("Write") .. "]",
"label[0.3,3.4;Unicode font]",
"label[0.3,3.4;"..FS("Unicode font").."]",
"image_button[0.6,3.7;1,0.6;signs_lib_switch_" .. state .. ".png;uni_"
.. state .. ";;;false;signs_lib_switch_interm.png]",
}
if minetest.registered_nodes[nodename].allow_widefont then
state = meta:get_int("widefont") == 1 and "on" or "off"
formspec[#formspec+1] = "label[2.1,3.4;Wide font]"
formspec[#formspec+1] = "label[2.1,3.4;"..FS("Wide font").."]"
formspec[#formspec+1] = "image_button[2.3,3.7;1,0.6;signs_lib_switch_" .. state .. ".png;wide_"
.. state .. ";;;false;signs_lib_switch_interm.png]"
end

View File

@ -1,8 +1,10 @@
-- Definitions for standard minetest_game wooden and steel wall signs
local S = signs_lib.S
if minetest.get_modpath("default") then
signs_lib.register_sign("default:sign_wall_wood", {
description = "Wooden wall sign",
description = S("Wooden Wall Sign"),
inventory_image = "signs_lib_sign_wall_wooden_inv.png",
tiles = {
"signs_lib_sign_wall_wooden.png",
@ -20,7 +22,7 @@ if minetest.get_modpath("default") then
})
signs_lib.register_sign("default:sign_wall_steel", {
description = "Steel wall sign",
description = S("Steel Wall Sign"),
inventory_image = "signs_lib_sign_wall_steel_inv.png",
tiles = {
"signs_lib_sign_wall_steel.png",