Make strings translatable

This commit is contained in:
2025-12-09 18:10:17 +01:00
parent ebd6c93b54
commit 9fc1fbce0f
4 changed files with 16 additions and 5 deletions

View File

@@ -1,9 +1,11 @@
local S = core.get_translator(core.get_current_modname())
local max_stack = tonumber(core.settings:get("default_stack_max")) or 99 local max_stack = tonumber(core.settings:get("default_stack_max")) or 99
-- LuaFormatter off -- LuaFormatter off
local machine_formspec = "" .. local machine_formspec = "" ..
"size[8,9]" .. "size[8,9]" ..
"label[0,0;Chiseling Machine]" .. "label[0,0;" .. core.formspec_escape(S("Chiseling Machine")) .. "]" ..
"image[2,2;1,1;chisel.png]" .. "image[2,2;1,1;chisel.png]" ..
"list[current_name;src;2,1;1,1;]" .. "list[current_name;src;2,1;1,1;]" ..
"list[current_name;dst;5,1;2,2;]" .. "list[current_name;dst;5,1;2,2;]" ..
@@ -16,7 +18,7 @@ local machine_formspec = "" ..
core.register_node( core.register_node(
"stripped_tree:chiseling_machine", { "stripped_tree:chiseling_machine", {
description = "Chiseling machine", description = S("Chiseling Machine"),
tiles = { tiles = {
"chiseling_machine.png", "chiseling_machine.png",
"chiseling_machine.png", "chiseling_machine.png",

View File

@@ -1,3 +1,5 @@
local S = core.get_translator(core.get_current_modname())
stripped_tree = {} stripped_tree = {}
-- Select between chisel tool or axes. -- Select between chisel tool or axes.
@@ -49,7 +51,7 @@ function stripped_tree.register_strippable_trunk(trunk_name, plank_name, strippe
local trunk_def = core.registered_nodes[trunk_name] local trunk_def = core.registered_nodes[trunk_name]
local stripped_def = table.copy(trunk_def) local stripped_def = table.copy(trunk_def)
stripped_def.description = "Stripped " .. trunk_def.description stripped_def.description = S("Stripped @1", trunk_def.description)
stripped_def.groups = table.copy(trunk_def.groups) stripped_def.groups = table.copy(trunk_def.groups)
stripped_def.groups.not_in_creative_inventory = 1 stripped_def.groups.not_in_creative_inventory = 1
stripped_def.tiles = stripped_tiles or { stripped_def.tiles = stripped_tiles or {

5
locale/template.txt Normal file
View File

@@ -0,0 +1,5 @@
# textdomain: stripped_tree
Chiseling Machine=
Stripped @1=
Tree bark=
Chisel for tree trunks=

View File

@@ -1,5 +1,7 @@
local S = core.get_translator(core.get_current_modname())
-- Register tree bark -- Register tree bark
core.register_craftitem(":default:tree_bark", {description = "Tree bark", inventory_image = "tree_bark.png"}) core.register_craftitem(":default:tree_bark", {description = S("Tree bark"), inventory_image = "tree_bark.png"})
-- Register bark as fuel -- Register bark as fuel
core.register_craft({type = "fuel", recipe = "default:tree_bark", burntime = 15}) core.register_craft({type = "fuel", recipe = "default:tree_bark", burntime = 15})
@@ -20,7 +22,7 @@ core.register_craft(
if stripped_tree.enable_chisel then if stripped_tree.enable_chisel then
core.register_tool( core.register_tool(
"stripped_tree:chisel", { "stripped_tree:chisel", {
description = "Chisel for tree trunks", description = S("Chisel for tree trunks"),
inventory_image = "chisel.png", inventory_image = "chisel.png",
wield_image = "chisel.png", wield_image = "chisel.png",
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},