Mercurial > p > roundup > code
changeset 2801:ee9c3b850f9e
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.
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Wed, 20 Oct 2004 08:46:45 +0000 |
| parents | 3adcdd5b9247 |
| children | e816a232f988 |
| files | roundup/msgfmt.py |
| diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/msgfmt.py Wed Oct 20 06:36:06 2004 +0000 +++ b/roundup/msgfmt.py Wed Oct 20 08:46:45 2004 +0000 @@ -49,7 +49,7 @@ def add(id, str, fuzzy): "Add a non-fuzzy translation to the dictionary." global MESSAGES - if not fuzzy and str: + if not fuzzy and str and not str.startswith('\0'): MESSAGES[id] = str @@ -150,11 +150,11 @@ l = l[6:] # Check for plural forms if l.startswith('['): + # Separate plural forms with \0 + if not l.startswith('[0]'): + msgstr += '\0' # Ignore the index - must come in sequence l = l[l.index(']') + 1:] - # Separate plural forms with \0 - if len(msgstr) > 0: - msgstr += '\0' # Skip empty lines l = l.strip() if not l:
