Add translation support and German translation (#19)

This commit is contained in:
Montandalar 2024-02-06 01:30:57 +11:00 committed by GitHub
parent af76057c9b
commit b1fbe88bc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 124 additions and 17 deletions

View File

@ -1,12 +1,15 @@
local S = minetest.get_translator("telemosaic")
for _,protected in pairs({true, false}) do
local node_name_suffix = protected and "_protected" or ""
local texture_overlay = protected and "^telemosaic_beacon_protected_overlay.png" or ""
local description = protected and "Protected Telemosaic Beacon"
or "Telemosaic Beacon"
local description_prefix = protected and "Protected " or ""
minetest.register_node("telemosaic:beacon_off"..node_name_suffix, {
description = description_prefix.."Telemosaic Beacon",
description = S(description),
tiles = {
"telemosaic_beacon_off.png"..texture_overlay,
"telemosaic_beacon_side.png",
@ -18,7 +21,8 @@ for _,protected in pairs({true, false}) do
})
minetest.register_node("telemosaic:beacon"..node_name_suffix, {
description = description_prefix.."Telemosaic Beacon Active (you hacker you!)",
description = S(description_prefix ..
"Telemosaic Beacon Active (you hacker you!)"),
tiles = {
"telemosaic_beacon_top.png"..texture_overlay,
"telemosaic_beacon_side.png",
@ -31,7 +35,8 @@ for _,protected in pairs({true, false}) do
})
minetest.register_node("telemosaic:beacon_err"..node_name_suffix, {
description = description_prefix.."Telemosaic Beacon Error (you hacker you!)",
description = S(description_prefix ..
"Telemosaic Beacon Error (you hacker you!)"),
tiles = {
"telemosaic_beacon_err.png"..texture_overlay,
"telemosaic_beacon_side.png",
@ -44,7 +49,8 @@ for _,protected in pairs({true, false}) do
})
minetest.register_node("telemosaic:beacon_disabled"..node_name_suffix, {
description = description_prefix.."Telemosaic Beacon Disabled (you hacker you!)",
description = S(description_prefix ..
"Telemosaic Beacon Disabled (you hacker you!)"),
tiles = {
"telemosaic_beacon_disabled.png"..texture_overlay,
"telemosaic_beacon_side.png",

View File

@ -1,3 +1,4 @@
local S = minetest.get_translator("telemosaic")
local has_dye = minetest.get_modpath("dye")
@ -16,8 +17,17 @@ local tiers = {"one", "two", "three"}
for i, range in pairs(telemosaic.extender_ranges) do
local tier = tiers[i]
local common_desc, basic_desc
if has_dye then
common_desc = S("Telemosaic Extender, Tier @1 (@2)")
basic_desc = S(common_desc, i, S("Grey"))
else
common_desc = "Telemosaic Extender, Tier @1"
basic_desc = S(common_desc, i)
end
minetest.register_node("telemosaic:extender_"..tier, {
description = "Telemosaic Extender, Tier "..i..(has_dye and " (Grey)" or ""),
description = basic_desc,
tiles = {
"telemosaic_extender_"..tier..".png"
},
@ -36,7 +46,7 @@ for i, range in pairs(telemosaic.extender_ranges) do
for name, color in pairs(telemosaic.extender_colors) do
minetest.register_node("telemosaic:extender_"..tier.."_"..name, {
description = "Telemosaic Extender, Tier "..i.." ("..pretty_str(name)..")",
description = S(common_desc, i, S(pretty_str(name))),
tiles = {
"telemosaic_extender_"..tier..".png^[colorize:"..color
},

View File

@ -1,3 +1,4 @@
local S = minetest.get_translator("telemosaic")
-- Keeps a track of players to prevent teleport spamming
local recent_teleports = {}
@ -146,7 +147,7 @@ function telemosaic.check_beacon(pos, player_name, all_checks)
if player_name then
local needed = math.ceil(dist - range)
minetest.chat_send_player(player_name,
"You need to add extenders for "..needed.." nodes."
S("You need to add extenders for @1 node(s).", needed)
)
end
return false
@ -162,7 +163,7 @@ function telemosaic.check_beacon(pos, player_name, all_checks)
if player_name then
if telemosaic.is_protected_beacon(dest, player_name) then
minetest.chat_send_player(player_name,
"Destination is protected."
S("Destination is protected.")
)
return false
end
@ -172,14 +173,14 @@ function telemosaic.check_beacon(pos, player_name, all_checks)
if not valid then
if player_name then
minetest.chat_send_player(player_name,
"No telemosaic at destination."
S("No telemosaic at destination.")
)
end
return false
elseif not open then
if player_name then
minetest.chat_send_player(player_name,
"Destination is blocked."
S("Destination is blocked.")
)
end
return false
@ -278,10 +279,11 @@ function telemosaic.rightclick(pos, node, player, itemstack, pointed_thing)
-- Try to create a telemosaic key
if itemstack:get_count() ~= 1 then
minetest.chat_send_player(player_name,
"You can only use a singular mese crystal fragment to create a telemosaic key."
S("You can only use a singular mese crystal fragment to create a telemosaic key.")
)
else
minetest.log("action", "[telemosaic] " .. player_name .. " created a key for the telemosaic at "
minetest.log("action", "[telemosaic] " .. player_name ..
" created a key for the telemosaic at "
.. minetest.pos_to_string(pos))
return ItemStack({name = "telemosaic:key", metadata = hash_pos(pos)})
end
@ -295,12 +297,12 @@ function telemosaic.rightclick(pos, node, player, itemstack, pointed_thing)
if not dest then
-- This should never happen, but tell the player if it does
minetest.chat_send_player(player_name,
"Telemosaic key is invalid."
S("Telemosaic key is invalid.")
)
elseif not telemosaic.is_valid_destination(dest) then
-- No point setting a destination that doesn't exist
minetest.chat_send_player(player_name,
"No telemosaic at new destination."
S("No telemosaic at new destination.")
)
else
-- Everything is good, set the destination and update the telemosaic
@ -342,7 +344,7 @@ function telemosaic.rightclick(pos, node, player, itemstack, pointed_thing)
telemosaic.teleport(player, pos, dest)
else
minetest.chat_send_player(player_name,
"Travel to destination is not allowed."
S("Travel to destination is not allowed.")
)
end
end
@ -350,7 +352,7 @@ function telemosaic.rightclick(pos, node, player, itemstack, pointed_thing)
elseif state == "disabled" then
-- Tell the player why they can't use this telemosaic
minetest.chat_send_player(player_name,
"Telemosaic is disabled."
S("Telemosaic is disabled.")
)
elseif state == "error" then

View File

@ -1,6 +1,7 @@
local S = minetest.get_translator("telemosaic")
minetest.register_tool("telemosaic:key", {
description = "Telemosaic Key",
description = S("Telemosaic Key"),
inventory_image = "telemosaic_key.png",
stack_max = 1,
groups = {not_in_creative_inventory = 1},

44
locale/telemosaic.de.tr Normal file
View File

@ -0,0 +1,44 @@
# textdomain: telemosaic
##[ beacon.lua ]##
Protected Telemosaic Beacon=Geschütztes Telemosaik-Leuchtfeuer
Telemosaic Beacon=Telemosaik-Leuchtfeuer
Telemosaic Beacon Active (you hacker you!)=Telemosaik-Leuchtfeuer aktiv (du Hacker du!)
Protected Telemosaic Beacon Active (you hacker you!)=Geschütztes Telemosaik-Leuchtfeuer aktiv (du Hacker du!)
Telemosaic Beacon Error (you hacker you!)=Telemosaik-Leuchtfeuer fehlerhaft (du Hacker du!)
Protected Telemosaic Beacon Error (you hacker you!)=Geschütztes Telemosaik-Leuchtfeuer fehlerhaft (du Hacker du!)
Telemosaic Beacon Disabled (you hacker you!)=Telemosaik-Leuchtfeuer deaktiviert (du Hacker du!)
Protected Telemosaic Beacon Disabled (you hacker you!)=Geschütztes Telemosaik-Leuchtfeuer deaktiviert (du Hacker du!)
##[ extender.lua ]##
Telemosaic Extender, Tier @1 (@2)=Telemosaik-Verstärker Stufe @1 (@2)
Telemosaic Extender, Tier @1=Telemosaik-Verstärker Stufe @1
# Aus MTG Wolle
Grey=Grau
White=Weiß
Dark Grey=Dunkelgrau
Black=Schwarz
Violet=Violett
Blue=Blau
Cyan=Türkis
Dark Green=Dunkelgrün
Green=Grün
Yellow=Gelb
Brown=Braun
Orange=Orange
Red=Rot
Magenta=Magenta
Pink=Rosa
##[ functions.lua ]##
You need to add extenders for @1 node(s).=Sie müssen Verstärker für @1 Node(n) hinzufügen.
Destination is protected.=Zielort ist geschützt.
No telemosaic at destination.=Kein Telemosaik am Zielort.
Destination is blocked.=Zielort ist blockiert.
You can only use a singular mese crystal fragment to create a telemosaic key.=Sie können nur ein einzelnes Mesekristallfragment verwenden, um einen Telemosaik-Schlüssel zu erstellen.
Telemosaic key is invalid.=Telemosaik-Schlüssel ist ungültig.
No telemosaic at new destination.=Kein Telemosaik am neuen Zielort.
Travel to destination is not allowed.=Reisen zum Zielort ist nicht erlaubt.
Telemosaic is disabled.=Telemosaik ist deaktiviert.
##[ key.lua ]##
Telemosaic Key=Telemosaik-Schlüssel

44
locale/template.txt Normal file
View File

@ -0,0 +1,44 @@
# textdomain: telemosaic
##[ beacon.lua ]##
Protected Telemosaic Beacon=
Telemosaic Beacon=
Telemosaic Beacon Active (you hacker you!)=
Protected Telemosaic Beacon Active (you hacker you!)=
Telemosaic Beacon Error (you hacker you!)=
Protected Telemosaic Beacon Error (you hacker you!)=
Telemosaic Beacon Disabled (you hacker you!)=
Protected Telemosaic Beacon Disabled (you hacker you!)=
##[ extender.lua ]##
Telemosaic Extender, Tier @1 (@2)=
Telemosaic Extender, Tier @1=
Grey=
# from MTG wool
White=
Dark Grey=
Black=
Violet=
Blue=
Cyan=
Dark Green=
Green=
Yellow=
Brown=
Orange=
Red=
Magenta=
Pink=
##[ functions.lua ]##
You need to add extenders for @1 node(s).=
Destination is protected.=
No telemosaic at destination.=
Destination is blocked.=
You can only use a singular mese crystal fragment to create a telemosaic key.=
Telemosaic key is invalid.=
No telemosaic at new destination.=
Travel to destination is not allowed.=
Telemosaic is disabled.=
##[ key.lua ]##
Telemosaic Key=