integrate translation system

This commit is contained in:
AFCMS 2021-06-24 12:07:13 +02:00
parent 0129fdafef
commit 0619d480dd
1 changed files with 18 additions and 5 deletions

View File

@ -1,10 +1,12 @@
local S = minetest.get_translator(minetest.get_current_modname())
--TODO: like mc error message --TODO: like mc error message
--TODO: complex command handling --TODO: complex command handling
mcl_commands.types = { mcl_commands.types = {
bool = { bool = {
lengh = 1, lengh = 1,
msg = "Invalid boolean", msg = S("Invalid boolean"),
func = function(word) func = function(word)
if word == "true" then if word == "true" then
return true, true return true, true
@ -17,7 +19,7 @@ mcl_commands.types = {
}, },
int = { int = {
lengh = 1, lengh = 1,
msg = "Invalid integer", msg = S("Invalid integer"),
func = function(int) func = function(int)
if tonumber(int) and tonumber(int) == math.round(int) then if tonumber(int) and tonumber(int) == math.round(int) then
return true, tonumber(int) return true, tonumber(int)
@ -31,8 +33,9 @@ mcl_commands.types = {
text = {}, text = {},
pos = { pos = {
lengh = 3, lengh = 3,
msg = "Invalid position", msg = S("Invalid position"),
func = function(x, y, z) func = function(x, y, z)
--FIXME
if true then if true then
return true, nil return true, nil
else else
@ -41,13 +44,23 @@ mcl_commands.types = {
end, end,
}, },
target = {}, target = {},
playername = {}, playername = {
lengh = 1,
msg = S("Invalid player name"),
func = function(name)
if minetest.player_exists(name) then
return true, name
else
return false, nil
end
end,
},
} }
function mcl_commands.register_complex_command() function mcl_commands.register_complex_command()
end end
function mcl_commands.register_basic_command(name, table) function mcl_commands.register_basic_command(name, def)
end end
function mcl_commands.alias_command(alias, original_name, bypass_setting) function mcl_commands.alias_command(alias, original_name, bypass_setting)