[PATCH] gendoc: fix localization of help topic

Cédric Duval cedricduval at free.fr
Sat Jul 4 05:13:07 CDT 2009

# HG changeset patch
# User Cédric Duval <cedricduval at free.fr>
# Date 1246702356 -7200
# Node ID e5f10c5ef60dc6d5c9c0e9cca665199b31bdeacc
# Parent  fc5737e491939f19530b6e138909df51a7f44d73
gendoc: fix localization of help topic

When a topic provides a callable method for its text, most likely
this text will be generated from different parts, so it does not
make sense to apply gettext on the whole result, rather the method
should provide translation by itself.

This is the case with the extensions topic, which triggers a double
gettext call, making the ascii codec fail when it encounters 8 bits
characters, and prevents the docs to be built.

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -103,7 +103,9 @@
         if callable(doc):
             doc = doc()
-        ui.write(gettext(doc))
+        else:
+            doc = gettext(doc)
+        ui.write(doc)
 if __name__ == "__main__":

More information about the Mercurial-devel mailing list