diff --git a/init.lua b/init.lua index 277f97a..23f9eb3 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("central_message") + cmsg = {} cmsg.hudids = {} cmsg.messages = {} @@ -142,29 +144,29 @@ minetest.register_on_leaveplayer(function(player) end) minetest.register_privilege("announce", { - description = "Can use /cmsg", + description = S("Can use /cmsg"), give_to_singleplayer = false, }) minetest.register_chatcommand("cmsg", { - description = "Show message in the center of the screen to player (“*” sends to all players)", + description = S("Show message in the center of the screen to player (“*” sends to all players)"), privs = {announce = true}, - params = " ", + params = S(" "), func = function(name, params) local player = minetest.get_player_by_name(name) local targetname, text = string.match(params, "^(%S+)%s(.+)$") if not targetname then - return false, "Invalid usage, see /help title" + return false, S("Invalid usage, see “/help cmsg”.") end if targetname == "*" then cmsg.push_message_all(text) - return true, "Message sent." + return true, S("Message sent.") else local target = minetest.get_player_by_name(targetname) if not target then - return false, "The player "..targetname.." is not online." + return false, S("The player @1 is not online.", targetname) end cmsg.push_message_player(target, text) - return true, "Message sent." + return true, S("Message sent.") end end, })