Add intllib support and German translation
This commit is contained in:
parent
58cb4217ea
commit
d4bc5dc190
@ -0,0 +1 @@
|
||||
intllib?
|
78
init.lua
78
init.lua
@ -1,54 +1,62 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if minetest.get_modpath("intllib") then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
|
||||
end
|
||||
|
||||
--[[ privileges ]]
|
||||
if(minetest.setting_getbool("enable_damage") == true) then
|
||||
minetest.register_privilege("heal", {
|
||||
description = "Allows player to set own health and breath with /sethp, /sethealth and /setbreath.",
|
||||
description = S("Allows player to set own health and breath with /sethp, /sethealth and /setbreath"),
|
||||
give_to_singleplayer = false
|
||||
})
|
||||
end
|
||||
minetest.register_privilege("physics", {
|
||||
description = "Allows player to set own gravity, jump height and movement speed with /setgravity, /setjump and /setspeed, respectively.",
|
||||
description = S("Allows player to set own gravity, jump height and movement speed with /setgravity, /setjump and /setspeed, respectively"),
|
||||
give_to_singleplayer = false
|
||||
})
|
||||
minetest.register_privilege("hotbar", {
|
||||
description = "Allows player to set the number of slots of the hotbar with /sethotbarsize.",
|
||||
description = S("Allows player to set the number of slots of the hotbar with /sethotbarsize"),
|
||||
give_to_singleplayer = false
|
||||
})
|
||||
|
||||
--[[ informational commands ]]
|
||||
minetest.register_chatcommand("whoami", {
|
||||
params = "",
|
||||
description = "Shows your name.",
|
||||
description = S("Shows your player name"),
|
||||
privs = {},
|
||||
func = function(name)
|
||||
minetest.chat_send_player(name, "Your name is \""..name.."\".")
|
||||
minetest.chat_send_player(name, S("Your player name is @1.", name))
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("ip", {
|
||||
params = "",
|
||||
description = "Shows your IP address.",
|
||||
description = S("Shows your IP address"),
|
||||
privs = {},
|
||||
func = function(name)
|
||||
minetest.chat_send_player(name, "Your IP address is \""..minetest.get_player_ip(name).."\".")
|
||||
minetest.chat_send_player(name, S("Your IP address is @1.", minetest.get_player_ip(name)))
|
||||
end
|
||||
})
|
||||
|
||||
--[[ HUD commands ]]
|
||||
minetest.register_chatcommand("sethotbarsize", {
|
||||
params = "<1...23>",
|
||||
description = "Sets the size of your hotbar to the provided number of slots. The number must be between 1 and 23.",
|
||||
params = S("<1...23>"),
|
||||
description = S("Sets the size of your hotbar to the provided number of slots; the number must be between 1 and 23"),
|
||||
privs = {hotbar=true},
|
||||
func = function(name, slots)
|
||||
if slots == "" then
|
||||
minetest.chat_send_player(name, "You did not specify the parameter.")
|
||||
minetest.chat_send_player(name, S("You did not specify the parameter."))
|
||||
return
|
||||
end
|
||||
if type(tonumber(slots)) ~= "number" then
|
||||
minetest.chat_send_player(name, "This is not a number.")
|
||||
minetest.chat_send_player(name, S("This is not a number."))
|
||||
return
|
||||
end
|
||||
if tonumber(slots) < 1 or tonumber(slots) > 23 then
|
||||
minetest.chat_send_player(name, "Number of slots out of bounds. The number of slots must be between 1 and 23.")
|
||||
minetest.chat_send_player(name, S("Number of slots is out of bounds. The number of slots must be between 1 and 23."))
|
||||
return
|
||||
end
|
||||
local player = minetest.get_player_by_name(name)
|
||||
@ -60,8 +68,8 @@ minetest.register_chatcommand("sethotbarsize", {
|
||||
|
||||
if(minetest.setting_getbool("enable_damage") == true) then
|
||||
minetest.register_chatcommand("sethp", {
|
||||
params = "<hp>",
|
||||
description = "Sets your health to <hp> HP (=hearts/2).",
|
||||
params = S("<hp>"),
|
||||
description = S("Sets your health to <hp> HP (=half the number of “hearts”)"),
|
||||
privs = {heal=true},
|
||||
func = function(name, hp)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
@ -69,11 +77,11 @@ if(minetest.setting_getbool("enable_damage") == true) then
|
||||
return
|
||||
end
|
||||
if hp == "" then
|
||||
minetest.chat_send_player(name, "You did not specify the parameter.")
|
||||
minetest.chat_send_player(name, S("You did not specify the parameter."))
|
||||
return
|
||||
end
|
||||
if type(tonumber(hp)) ~= "number" then
|
||||
minetest.chat_send_player(name, "This is not a number.")
|
||||
minetest.chat_send_player(name, S("This is not a number."))
|
||||
return
|
||||
end
|
||||
hp = math.floor(hp+0.5) -- round the number
|
||||
@ -82,8 +90,8 @@ if(minetest.setting_getbool("enable_damage") == true) then
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("sethealth", {
|
||||
params = "<hearts>",
|
||||
description = "Sets your health to <hearts> hearts.",
|
||||
params = S("<hearts>"),
|
||||
description = S("Sets your health to <hearts> hearts"),
|
||||
privs = {heal=true},
|
||||
func = function(name, hearts)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
@ -91,11 +99,11 @@ if(minetest.setting_getbool("enable_damage") == true) then
|
||||
return
|
||||
end
|
||||
if hearts == "" then
|
||||
minetest.chat_send_player(name, "You did not specify the parameter.")
|
||||
minetest.chat_send_player(name, S("You did not specify the parameter."))
|
||||
return
|
||||
end
|
||||
if type(tonumber(hearts)) ~= "number" then
|
||||
minetest.chat_send_player(name, "This is not a number.")
|
||||
minetest.chat_send_player(name, S("This is not a number."))
|
||||
return
|
||||
end
|
||||
local hp = tonumber(hearts) * 2
|
||||
@ -105,8 +113,8 @@ if(minetest.setting_getbool("enable_damage") == true) then
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("setbreath", {
|
||||
params = "<breath>",
|
||||
description = "Sets your breath to <breath> breath points.",
|
||||
params = S("<breath>"),
|
||||
description = S("Sets your breath to <breath> breath points"),
|
||||
privs = {heal=true},
|
||||
func = function(name, breath)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
@ -114,11 +122,11 @@ if(minetest.setting_getbool("enable_damage") == true) then
|
||||
return
|
||||
end
|
||||
if breath == "" then
|
||||
minetest.chat_send_player(name, "You did not specify the parameter.")
|
||||
minetest.chat_send_player(name, S("You did not specify the parameter."))
|
||||
return
|
||||
end
|
||||
if type(tonumber(breath)) ~= "number" then
|
||||
minetest.chat_send_player(name, "This is not a number.")
|
||||
minetest.chat_send_player(name, S("This is not a number."))
|
||||
return
|
||||
end
|
||||
local bp = tonumber(breath)
|
||||
@ -128,7 +136,7 @@ if(minetest.setting_getbool("enable_damage") == true) then
|
||||
|
||||
minetest.register_chatcommand("killme", {
|
||||
params = "",
|
||||
description = "Kills yourself.",
|
||||
description = S("Kills yourself"),
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
@ -143,8 +151,8 @@ end
|
||||
|
||||
-- speed
|
||||
minetest.register_chatcommand("setspeed", {
|
||||
params = "[<speed>]",
|
||||
description = "Sets your movement speed to <speed> (default: 1).",
|
||||
params = S("[<speed>]"),
|
||||
description = S("Sets your movement speed to <speed> (default: 1)"),
|
||||
privs={physics=true},
|
||||
func = function(name, speed)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
@ -155,7 +163,7 @@ minetest.register_chatcommand("setspeed", {
|
||||
speed=1
|
||||
end
|
||||
if type(tonumber(speed)) ~= "number" then
|
||||
minetest.chat_send_player(name, "This is not a number.")
|
||||
minetest.chat_send_player(name, S("This is not a number."))
|
||||
return
|
||||
end
|
||||
|
||||
@ -165,8 +173,8 @@ minetest.register_chatcommand("setspeed", {
|
||||
|
||||
-- gravity
|
||||
minetest.register_chatcommand("setgravity", {
|
||||
params = "[<gravity>]",
|
||||
description = "Sets your gravity to [<gravity>] (default: 1).",
|
||||
params = S("[<gravity>]"),
|
||||
description = S("Sets your gravity to <gravity> (default: 1)"),
|
||||
privs={physics=true},
|
||||
func = function(name, gravity)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
@ -177,7 +185,7 @@ minetest.register_chatcommand("setgravity", {
|
||||
gravity=1
|
||||
end
|
||||
if type(tonumber(gravity)) ~= "number" then
|
||||
minetest.chat_send_player(name, "This is not a number.")
|
||||
minetest.chat_send_player(name, S("This is not a number."))
|
||||
return
|
||||
end
|
||||
player:set_physics_override(nil, tonumber(gravity), nil)
|
||||
@ -186,8 +194,8 @@ minetest.register_chatcommand("setgravity", {
|
||||
|
||||
-- jump height
|
||||
minetest.register_chatcommand("setjump", {
|
||||
params = "[<jump height>]",
|
||||
description = "Sets your jump height to [<jump height>] (default: 1).",
|
||||
params = S("[<jump height>]"),
|
||||
description = S("Sets your jump height to <jump height> (default: 1)"),
|
||||
privs = {physics=true},
|
||||
func = function(name, jump_height)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
@ -198,7 +206,7 @@ minetest.register_chatcommand("setjump", {
|
||||
jump_height=1
|
||||
end
|
||||
if type(tonumber(jump_height)) ~= "number" then
|
||||
minetest.chat_send_player(name, "This is not a number.")
|
||||
minetest.chat_send_player(name, S("This is not a number."))
|
||||
return
|
||||
end
|
||||
player:set_physics_override(nil, nil, jump_height)
|
||||
@ -207,7 +215,7 @@ minetest.register_chatcommand("setjump", {
|
||||
|
||||
minetest.register_chatcommand("pulverizeall", {
|
||||
params = "",
|
||||
description = "Destroys all items in your player inventory and crafting grid.",
|
||||
description = S("Destroys all items in your player inventory and crafting grid"),
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
|
26
locale/de.txt
Normal file
26
locale/de.txt
Normal file
@ -0,0 +1,26 @@
|
||||
<1...23> = <1...23>
|
||||
<breath> = <Atem>
|
||||
<hearts> = <Herzen>
|
||||
<hp> = <TP>
|
||||
Allows player to set own gravity, jump height and movement speed with /setgravity, /setjump and /setspeed, respectively = Ermöglicht dem Spieler, seine eigene Schwerkraft, Sprunghöhe und Bewegungsgeschwindigkeit mit /setgravity, /setjump und /setspeed zu setzen
|
||||
Allows player to set own health and breath with /sethp, /sethealth and /setbreath = Ermöglicht dem Spieler, seine eigene Gesundheit und seinen Atem mit /sethp, /sethealth und /setbreath zu setzen
|
||||
Allows player to set the number of slots of the hotbar with /sethotbarsize = Ermöglicht dem Spieler, die Größe seiner Schnellzugriffsleiste mit /sethotbarsize zu setzen
|
||||
Destroys all items in your player inventory and crafting grid = Zerstört alle Gegenstände in Ihrem Spielerinventar und dem Fertigungsgitter
|
||||
Kills yourself = Tötet Sie
|
||||
Number of slots is out of bounds. The number of slots must be between 1 and 23. = Die Zahl liegt außerhalb des gültigen Wertebereichs. Sie muss zwischen 1 und 23 liegen.
|
||||
Sets the size of your hotbar to the provided number of slots; the number must be between 1 and 23 = Setzt die Größe Ihrer Schnellzugriffsleiste auf die angegebene Anzahl; die Zahl muss zwischen 1 und 23 liegen.
|
||||
Sets your breath to <breath> breath points = Setzt Ihren Atem auf <Atem> Atempunkte
|
||||
Sets your gravity to <gravity> (default: 1) = Setzt Ihre Schwerkraft auf <Schwerkraft> (Standard: 1)
|
||||
Sets your health to <hearts> hearts = Setzt Ihre Gesundheit auf <Herzen> Herzen
|
||||
Sets your health to <hp> HP (\=half the number of “hearts”) = Setzt Ihre Gesundheit auf <TP> Trefferpunkte (\=die Hälfte der Anzahl der »Herzen«)
|
||||
Sets your jump height to <jump height> (default: 1) = Setzt Ihre Sprunghöhe auf <Sprunghöhe> (Standard: 1)
|
||||
Sets your movement speed to <speed> (default: 1) = Setzt Ihre Bewegungsgeschwindigkeit auf <Geschwindigkeit> (Standard: 1)
|
||||
Shows your IP address = Zeigt Ihre IP-Adresse
|
||||
Shows your player name = Zeigt ihren Spieernamen.
|
||||
This is not a number. = Dies ist keine Zahl.
|
||||
You did not specify the parameter. = Sie haben keinen Parameter angegeben.
|
||||
Your IP address is @1. = Ihre IP-Adresse ist @1.
|
||||
Your player name is @1. = Ihr Spielername ist @1.
|
||||
[<gravity>] = [<Schwerkraft>]
|
||||
[<jump height>] = [<Sprunghöhe>]
|
||||
[<speed>] = [<Geschwindigkeit>]
|
26
locale/template.txt
Normal file
26
locale/template.txt
Normal file
@ -0,0 +1,26 @@
|
||||
<1...23> =
|
||||
<breath> =
|
||||
<hearts> =
|
||||
<hp> =
|
||||
Allows player to set own gravity, jump height and movement speed with /setgravity, /setjump and /setspeed, respectively =
|
||||
Allows player to set own health and breath with /sethp, /sethealth and /setbreath =
|
||||
Allows player to set the number of slots of the hotbar with /sethotbarsize =
|
||||
Destroys all items in your player inventory and crafting grid =
|
||||
Kills yourself =
|
||||
Number of slots is out of bounds. The number of slots must be between 1 and 23. =
|
||||
Sets the size of your hotbar to the provided number of slots; the number must be between 1 and 23 =
|
||||
Sets your breath to <breath> breath points =
|
||||
Sets your gravity to <gravity> (default: 1) =
|
||||
Sets your health to <hearts> hearts =
|
||||
Sets your health to <hp> HP (\=half the number of “hearts”) =
|
||||
Sets your jump height to <jump height> (default: 1) =
|
||||
Sets your movement speed to <speed> (default: 1) =
|
||||
Shows your IP address =
|
||||
Shows your player name =
|
||||
This is not a number. =
|
||||
You did not specify the parameter. =
|
||||
Your IP address is @1. =
|
||||
Your player name is @1. =
|
||||
[<gravity>] =
|
||||
[<jump height>] =
|
||||
[<speed>] =
|
Loading…
x
Reference in New Issue
Block a user