mirror of
https://github.com/minetest-mods/intllib.git
synced 2025-07-04 17:10:22 +02:00
Return nil if msgstr
is empty.
Also remove debugging statements left from previous commit.
This commit is contained in:
10
init.lua
10
init.lua
@ -77,8 +77,9 @@ local gettext = dofile(minetest.get_modpath("intllib").."/gettext.lua")
|
||||
local function catgettext(catalogs, msgid)
|
||||
for _, cat in ipairs(catalogs) do
|
||||
local msgstr = cat and cat[msgid]
|
||||
if msgstr then
|
||||
return msgstr[0]
|
||||
if msgstr and msgstr~="" then
|
||||
local msg = msgstr[0]
|
||||
return msg~="" and msg or nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -86,12 +87,11 @@ end
|
||||
local function catngettext(catalogs, msgid, msgid_plural, n)
|
||||
n = math.floor(n)
|
||||
for i, cat in ipairs(catalogs) do
|
||||
print(i, dump(cat))
|
||||
local msgstr = cat and cat[msgid]
|
||||
if msgstr then
|
||||
local index = cat.plural_index(n)
|
||||
print("catngettext:", index, msgstr[index])
|
||||
return msgstr[index]
|
||||
local msg = msgstr[index]
|
||||
return msg~="" and msg or nil
|
||||
end
|
||||
end
|
||||
return n==1 and msgid or msgid_plural
|
||||
|
Reference in New Issue
Block a user