[PATCH 3 of 3] i18n: translate each paragraph separately

Wagner Bruna wagner.bruna+mercurial at gmail.com
Thu Jun 17 19:09:21 CDT 2010


# HG changeset patch
# User Wagner Bruna <wbruna at yahoo.com>
# Date 1270603850 10800
# Branch stable
# Node ID 6d62afbdfabff15cf82603804ebf0ebc46314fd4
# Parent  f98fbce803dda36171d09a43e80c78f091f9594e
i18n: translate each paragraph separately

Makes translation work easier by reducing message sizes and avoiding
invalidating whole messages on small changes or additions to the
original text.

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -100,8 +100,13 @@
 	  --copyright-holder "Matt Mackall <mpm at selenic.com> and others" \
 	  --from-code ISO-8859-1 --join --sort-by-file \
 	  -d hg -p i18n -o hg.pot
+	$(PYTHON) i18n/posplit i18n/hg.pot
 
 %.po: i18n/hg.pot
+        # This call to posplit ensures existing strings won't be marked
+        # as fuzzy during the transition to paragraph translations,
+        # but may be dropped once all the .po files are up to date
+	$(PYTHON) i18n/posplit $@
 	msgmerge --no-location --update $@ $^
 
 .PHONY: help all local build doc clean install install-bin install-doc \
diff --git a/mercurial/i18n.py b/mercurial/i18n.py
--- a/mercurial/i18n.py
+++ b/mercurial/i18n.py
@@ -36,7 +36,7 @@
     if message is None:
         return message
 
-    u = t.ugettext(message)
+    u = u'\n\n'.join([t.ugettext(m) for m in message.split('\n\n')])
     try:
         # encoding.tolocal cannot be used since it will first try to
         # decode the Unicode string. Calling u.decode(enc) really


More information about the Mercurial-devel mailing list