From 8abee494e3ad97fe179279e21510804c0c47f7f9 Mon Sep 17 00:00:00 2001 From: Crabman77 Date: Mon, 4 Jul 2022 21:47:34 +0200 Subject: [PATCH] fix typo and translate messages server-side before sending to irc(wrong formated due to translation expression included in message) --- init.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index b8900b2..9944dad 100755 --- a/init.lua +++ b/init.lua @@ -42,6 +42,9 @@ local sounds = { -- Translation wrapper local S = minetest.get_translator(mname) +-- To translate server-side in server language for irc +local lang = minetest.settings:get("language") or "fr" + -- Lava death messages messages.lava = { "@1 thought lava was cool.", @@ -110,7 +113,7 @@ messages.other = { "@1 died.", "@1 left this world.", "@1 reached miner's heaven.", - "@1 lost him/her life.", + "@1 lost his/her life.", "@1 saw the light.", "@1 fell from a bit too high.", "@1 slipped on a banana skin.", @@ -141,7 +144,7 @@ messages.whacking = { messages.monsters_whacking = { "@1 got whacked by a @2.", - "Darwin said : @1 was less adapted than a @2.", + "Darwin said: @1 was less adapted than a @2.", "@1 was transformed into a doormat by a @2.", "@1 thought (s)he was stronger than a @2.", "@1 got kicked up by a @2. Next up...", @@ -208,7 +211,8 @@ local function broadcast_death(msg) logfilep:write(os.date("[%Y-%m-%d %H:%M:%S] ") .. msg .. "\n") logfilep:close() if irc then - irc.say(msg) + local tr_msg = minetest.get_translated_string(lang, msg) + irc.say(tr_msg) end end