mirror of
https://github.com/minetest-mods/intllib.git
synced 2024-11-16 23:40:30 +01:00
Add variant methods for gettext and ngettext for selected language
This commit is contained in:
parent
da26ea7cf8
commit
a5cc2639f2
17
init.lua
17
init.lua
|
@ -178,8 +178,21 @@ function intllib.make_gettext_pair(modname)
|
|||
or getter(msgid))
|
||||
return do_replacements(msgstr, ...)
|
||||
end
|
||||
gettext_getters[modname] = { gettext_func, ngettext_func }
|
||||
return gettext_func, ngettext_func
|
||||
-- Get string of Selected language
|
||||
local function sgettext_func(lang, msgid, ...)
|
||||
local scatalogs = gettext.load_catalogs(localedir, lang)
|
||||
local msgstr = (catgettext(scatalogs, msgid)
|
||||
or getter(msgid))
|
||||
return do_replacements(msgstr, ...)
|
||||
end
|
||||
local function sngettext_func(lang, msgid, msgid_plural, n, ...)
|
||||
local scatalogs = gettext.load_catalogs(localedir, lang)
|
||||
local msgstr = (catngettext(scatalogs, msgid, msgid_plural, n)
|
||||
or getter(msgid))
|
||||
return do_replacements(msgstr, ...)
|
||||
end
|
||||
gettext_getters[modname] = { gettext_func, ngettext_func, sgettext_func, sngettext_func }
|
||||
return gettext_func, ngettext_func, sgettext_func, sngettext_func
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user