diff --git a/lib/intllib.lua b/lib/intllib.lua index 6669d72..a047365 100644 --- a/lib/intllib.lua +++ b/lib/intllib.lua @@ -21,11 +21,11 @@ local function format(str, ...) return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) end -local gettext, ngettext +local gettext, ngettext, sgettext, sngettext if minetest.get_modpath("intllib") then if intllib.make_gettext_pair then -- New method using gettext. - gettext, ngettext = intllib.make_gettext_pair() + gettext, ngettext, sgettext, sngettext = intllib.make_gettext_pair() else -- Old method using text files. gettext = intllib.Getter() @@ -42,4 +42,12 @@ ngettext = ngettext or function(msgid, msgid_plural, n, ...) return format(n==1 and msgid or msgid_plural, ...) end -return gettext, ngettext +sgettext = sgettext or function(lang, msgid, ...) + return format(msgid, ...) +end + +sngettext = sngettext or function(lang, msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext, sgettext, sngettext