changeset 11403:f7d7de6eccc8

i18n: fix translation of empty paragraphs
author Martin Geisler <mg@lazybytes.net>
date Sat, 19 Jun 2010 19:16:11 +0200
parents 367ce8514da0
children 37cbedbeae96
files mercurial/i18n.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/i18n.py	Tue Jun 15 13:04:22 2010 -0400
+++ b/mercurial/i18n.py	Sat Jun 19 19:16:11 2010 +0200
@@ -36,7 +36,10 @@
     if message is None:
         return message
 
-    u = u'\n\n'.join([t.ugettext(m) for m in message.split('\n\n')])
+    paragraphs = message.split('\n\n')
+    # Be careful not to translate the empty string -- it holds the
+    # meta data of the .po file.
+    u = u'\n\n'.join([p and t.ugettext(p) or '' for p in paragraphs])
     try:
         # encoding.tolocal cannot be used since it will first try to
         # decode the Unicode string. Calling u.decode(enc) really