[PATCH 6 of 6] mark help strings for translation

Martin Geisler mg at daimi.au.dk
Sat Aug 23 08:37:25 CDT 2008


# HG changeset patch
# User Martin Geisler <mg at daimi.au.dk>
# Date 1219498339 -7200
# Node ID c7c98eb0f1c2c965af2e89a2b71a2b7ab7e2de1b
# Parent  1aac4077443bce3f006d3dba3b6b570d5c633921
mark help strings for translation

diff -r 1aac4077443b -r c7c98eb0f1c2 mercurial/commands.py
--- a/mercurial/commands.py	Sat Aug 23 15:32:19 2008 +0200
+++ b/mercurial/commands.py	Sat Aug 23 15:32:19 2008 +0200
@@ -7,7 +7,7 @@
 
 from node import hex, nullid, nullrev, short
 from repo import RepoError, NoCapability
-from i18n import _
+from i18n import _, gettext
 import os, re, sys, urllib
 import hg, util, revlog, bundlerepo, extensions, copies
 import difflib, patch, time, help, mdiff, tempfile
@@ -1275,7 +1275,7 @@
             ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:]))
 
         # description
-        doc = i[0].__doc__
+        doc = gettext(i[0].__doc__)
         if not doc:
             doc = _("(No help text available)")
         if ui.quiet:
@@ -1301,7 +1301,7 @@
             f = f.lstrip("^")
             if not ui.debugflag and f.startswith("debug"):
                 continue
-            doc = e[0].__doc__
+            doc = gettext(e[0].__doc__)
             if not doc:
                 doc = _("(No help text available)")
             h[f] = doc.splitlines(0)[0].rstrip()
@@ -1348,7 +1348,8 @@
         except KeyError:
             raise cmdutil.UnknownCommand(name)
 
-        doc = (mod.__doc__ or _('No help text available')).splitlines(0)
+        doc = gettext(mod.__doc__) or _('No help text available')
+        doc = doc.splitlines(0)
         ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0]))
         for d in doc[1:]:
             ui.write(d, '\n')
diff -r 1aac4077443b -r c7c98eb0f1c2 mercurial/help.py
--- a/mercurial/help.py	Sat Aug 23 15:32:19 2008 +0200
+++ b/mercurial/help.py	Sat Aug 23 15:32:19 2008 +0200
@@ -5,9 +5,11 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
+from i18n import _
+
 helptable = (
-    (["dates"], "Date Formats",
-    r'''
+    (["dates"], _("Date Formats"),
+     _(r'''
     Some commands allow the user to specify a date:
     backout, commit, import, tag: Specify the commit date.
     log, revert, update: Select revision(s) by date.
@@ -43,10 +45,10 @@
     ">{date}" - on or after a given date
     "{date} to {date}" - a date range, inclusive
     "-{days}" - within a given number of days of today
-    '''),
+    ''')),
 
-    (["patterns"], "File Name Patterns",
-    r'''
+    (["patterns"], _("File Name Patterns"),
+     _(r'''
     Mercurial accepts several notations for identifying one or more
     files at a time.
 
@@ -89,10 +91,10 @@
 
     re:.*\.c$      any name ending in ".c", anywhere in the repository
 
-    '''),
+    ''')),
 
-    (['environment', 'env'], 'Environment Variables',
-    r'''
+    (['environment', 'env'], _('Environment Variables'),
+     _(r'''
 HG::
     Path to the 'hg' executable, automatically passed when running hooks,
     extensions or external tools. If unset or empty, an executable named
@@ -160,10 +162,10 @@
 PYTHONPATH::
     This is used by Python to find imported modules and may need to be set
     appropriately if Mercurial is not installed system-wide.
-    '''),
+    ''')),
 
-    (['revs', 'revisions'], 'Specifying Single Revisions',
-    r'''
+    (['revs', 'revisions'], _('Specifying Single Revisions'),
+     _(r'''
     Mercurial accepts several notations for identifying individual
     revisions.
 
@@ -193,10 +195,10 @@
     no working directory is checked out, it is equivalent to null.
     If an uncommitted merge is in progress, "." is the revision of
     the first parent.
-    '''),
+    ''')),
 
-    (['mrevs', 'multirevs'], 'Specifying Multiple Revisions',
-    r'''
+    (['mrevs', 'multirevs'], _('Specifying Multiple Revisions'),
+     _(r'''
     When Mercurial accepts more than one revision, they may be
     specified individually, or provided as a continuous range,
     separated by the ":" character.
@@ -212,5 +214,5 @@
 
     A range acts as a closed interval. This means that a range of 3:5
     gives 3, 4 and 5. Similarly, a range of 4:2 gives 4, 3, and 2.
-    '''),
+    ''')),
 )


More information about the Mercurial-devel mailing list