Skip to content

Commit 4a4f668

Browse files
author
Alexander Smishlajev
committed
fix plural forms:
if the first translation string is empty, remaining translations were applied to wrong cases. GNU msgfmt in such case deletes the translation altogether; so do we now.
1 parent 7ab4cd1 commit 4a4f668

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

roundup/msgfmt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def usage(code, msg=''):
4949
def add(id, str, fuzzy):
5050
"Add a non-fuzzy translation to the dictionary."
5151
global MESSAGES
52-
if not fuzzy and str:
52+
if not fuzzy and str and not str.startswith('\0'):
5353
MESSAGES[id] = str
5454

5555

@@ -150,11 +150,11 @@ def make(filename, outfile):
150150
l = l[6:]
151151
# Check for plural forms
152152
if l.startswith('['):
153-
# Ignore the index - must come in sequence
154-
l = l[l.index(']') + 1:]
155153
# Separate plural forms with \0
156-
if len(msgstr) > 0:
154+
if not l.startswith('[0]'):
157155
msgstr += '\0'
156+
# Ignore the index - must come in sequence
157+
l = l[l.index(']') + 1:]
158158
# Skip empty lines
159159
l = l.strip()
160160
if not l:

0 commit comments

Comments
 (0)