computing/translate.lua

24 lines
722 B
Lua
Raw Permalink Normal View History

2024-11-18 16:28:19 -03:00
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