This commit is contained in:
Lunovox 2024-11-18 16:28:19 -03:00
parent 98702d6780
commit 1ccfe86adf
6 changed files with 70 additions and 13 deletions

23
translate.lua Normal file
View file

@ -0,0 +1,23 @@
local ngettext
--[[
local S = core.get_translator('testmod')
core.register_craftitem('testmod:test', {
description = S('I am a test object'),
inventory_image = 'default_stick.png^[brighten'
})
--]]
if core.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
modComputing.translate, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
modComputing.translate = intllib.Getter()
end
elseif core.get_translator ~= nil and core.get_current_modname ~= nil and core.get_modpath(core.get_current_modname()) then
modComputing.translate = core.get_translator(core.get_current_modname())
else
modComputing.translate = function(s) return s end
end