Mercurial > hg-stable
changeset 7013:f56e788fa292
i18n: mark help strings for translation
The gettext function is just another name for the normal _ function
and it is used for translating docstrings when using _ would make
pygettext.py output a warning.
author | Martin Geisler <mg@daimi.au.dk> |
---|---|
date | Tue, 09 Sep 2008 21:32:39 +0200 |
parents | 78341ea65d16 |
children | 46456a51e247 |
files | mercurial/commands.py mercurial/help.py |
diffstat | 2 files changed, 22 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Sep 09 21:32:39 2008 +0200 +++ b/mercurial/commands.py Tue Sep 09 21:32:39 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 @@ -1289,7 +1289,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: @@ -1315,7 +1315,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() @@ -1360,7 +1360,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')
--- a/mercurial/help.py Tue Sep 09 21:32:39 2008 +0200 +++ b/mercurial/help.py Tue Sep 09 21:32:39 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. - '''), + ''')), )