From 5c3cb4fa5eae3cb0661e4a3b73db451c4f5d465a Mon Sep 17 00:00:00 2001 From: rudzik8 Date: Thu, 28 Apr 2022 20:46:06 +0700 Subject: [PATCH] Make descriptions translatable (add locales) --- init.lua | 6 ++++-- locale/mcl_cozy.ru.tr | 3 +++ locale/template.txt | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 locale/mcl_cozy.ru.tr create mode 100644 locale/template.txt diff --git a/init.lua b/init.lua index 8fcb9a3..720f877 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator(minetest.get_current_modname()) + minetest.register_globalstep(function(dtime) local players = minetest.get_connected_players() for i=1, #players do @@ -17,7 +19,7 @@ minetest.register_globalstep(function(dtime) end) minetest.register_chatcommand("sit", { - description = "Sit down", + description = S("Sit down"), func = function(name) local player = minetest.get_player_by_name(name) if mcl_player.player_attached[name] then @@ -35,7 +37,7 @@ minetest.register_chatcommand("sit", { }) minetest.register_chatcommand("lay", { - description = "Lay down", + description = S("Lay down"), func = function(name) local player = minetest.get_player_by_name(name) if mcl_player.player_attached[name] then diff --git a/locale/mcl_cozy.ru.tr b/locale/mcl_cozy.ru.tr new file mode 100644 index 0000000..c01f20b --- /dev/null +++ b/locale/mcl_cozy.ru.tr @@ -0,0 +1,3 @@ +# textdomain: mcl_cozy +Sit down=Сесть +Lay down=Лечь diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..268ae8a --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,3 @@ +# textdomain: mcl_cozy +Sit down= +Lay down=