elua: xgettext's semantics are WTF, but okay, emulate it
authorDaniel Kolesa <d.kolesa@samsung.com>
Tue, 3 Jun 2014 15:05:50 +0000 (16:05 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Tue, 10 Jun 2014 14:48:53 +0000 (15:48 +0100)
src/bin/elua/modules/xgettext/generator.lua

index 44a5321..632bd67 100644 (file)
@@ -34,8 +34,7 @@ local gen_msgstr = function(str, prefix, suffix)
 end
 
 local cmp_msgs = function(msg1, msg2)
-    return msg1[1]      == msg2[1] and msg1[2] == msg2[2]
-       and msg1.context == msg2.context
+    return msg1[1] == msg2[1] and msg1.context == msg2.context
 end
 
 local new_msg = function(msg)
@@ -55,6 +54,9 @@ local gen_grouped_messages = function(ps)
         local found = false
         for i, amsg in ipairs(ret) do
             if cmp_msgs(msg, amsg) then
+                if not amsg[2] then
+                    amsg[2] = msg[2]
+                end
                 amsg.lines   [#amsg.lines    + 1] = msg.line
                 amsg.comments[#amsg.comments + 1] = msg.comment
                 for i, v in ipairs(msg.flags) do