Add translation support

This commit is contained in:
Jaidyn Ann 2023-12-13 01:58:16 -06:00
parent ebc6e75da9
commit e08b8f37ae
2 changed files with 40 additions and 19 deletions

View File

@ -1,3 +1,5 @@
local S = minetest.get_translator("kotatsu_table")
kotatsu_table = {} kotatsu_table = {}
kotatsu_table.toggle_sitting = function(npos, _, player) kotatsu_table.toggle_sitting = function(npos, _, player)
local meta = minetest.get_meta(npos) local meta = minetest.get_meta(npos)
@ -89,10 +91,10 @@ kotatsu_table.register_table = function(name, desc, base, tiles, top, top_tiles,
top_tiles = top_tiles or (minetest.registered_nodes[top] or {tiles={"default_wood.png"}}).tiles top_tiles = top_tiles or (minetest.registered_nodes[top] or {tiles={"default_wood.png"}}).tiles
inv_image = inv_image or "(kotatsu_base.png^[mask:"..tiles[1]..")^(kotatsu_top.png^[mask:"..top_tiles[1]..")" inv_image = inv_image or "(kotatsu_base.png^[mask:"..tiles[1]..")^(kotatsu_top.png^[mask:"..top_tiles[1]..")"
local kotatsu = name or ("kotatsu_table:table_"..string.gsub(base, ":", "_")) local kotatsu = name or ("kotatsu_table:table_"..string.gsub(base, ":", "_"))
desc = (desc or (minetest.registered_nodes[base] or {description="Terribly Programmed"}).description or "Very Terribly Programmed").." Kotatsu Table" desc = desc or S("@1 Kotatsu Table", (minetest.registered_nodes[base] or {description="Terribly Programmed"}).description or "Very Terribly Programmed")
minetest.register_node(kotatsu.."_side", { minetest.register_node(kotatsu.."_side", {
description = desc.." Blanket Side (you hacker, you)", description = S("@1 (Blanket Side; you hacker, you)", desc),
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "nodebox",
@ -108,7 +110,7 @@ kotatsu_table.register_table = function(name, desc, base, tiles, top, top_tiles,
}) })
minetest.register_node(kotatsu.."_corner", { minetest.register_node(kotatsu.."_corner", {
description = desc.." Blanket Corner (you hacker, you)", description = S("@1 (Blanket Corner; you hacker, you)", desc),
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "nodebox",
@ -170,21 +172,21 @@ kotatsu_table.register_table = function(name, desc, base, tiles, top, top_tiles,
}) })
end end
kotatsu_table.wool_dyes = { kotatsu_table.wool_dyes = {
{"white", "White"}, {"white", S("White Kotatsu Table")},
{"grey", "Grey"}, {"grey", S("Grey Kotatsu Table")},
{"black", "Black"}, {"black", S("Black Kotatsu Table")},
{"red", "Red"}, {"red", S("Red Kotatsu Table")},
{"yellow", "Yellow"}, {"yellow", S("Yellow Kotatsu Table")},
{"green", "Green"}, {"green", S("Green Kotatsu Table")},
{"cyan", "Cyan"}, {"cyan", S("Cyan Kotatsu Table")},
{"blue", "Blue"}, {"blue", S("Blue Kotatsu Table")},
{"magenta", "Magenta"}, {"magenta", S("Magenta Kotatsu Table")},
{"orange", "Orange"}, {"orange", S("Orange Kotatsu Table")},
{"violet", "Violet"}, {"violet", S("Violet Kotatsu Table")},
{"brown", "Brown"}, {"brown", S("Brown Kotatsu Table")},
{"pink", "Pink"}, {"pink", S("Pink Kotatsu Table")},
{"dark_grey", "Dark Grey"}, {"dark_grey", S("Dark Grey Kotatsu Table")},
{"dark_green", "Dark Green"}, {"dark_green", S("Dark Green Kotatsu Table")},
} }

19
locale/template.txt Normal file
View File

@ -0,0 +1,19 @@
# textdomain: kotatsu_table
@1 Kotatsu Table=
@1 (Blanket Side; you hacker, you)=
@1 (Blanket Corner; you hacker, you)=
White Kotatsu Table=
Grey Kotatsu Table=
Black Kotatsu Table=
Red Kotatsu Table=
Yellow Kotatsu Table=
Green Kotatsu Table=
Cyan Kotatsu Table=
Blue Kotatsu Table=
Magenta Kotatsu Table=
Orange Kotatsu Table=
Violet Kotatsu Table=
Brown Kotatsu Table=
Pink Kotatsu Table=
Dark Grey Kotatsu Table=
Dark Green Kotatsu Table=