Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 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 | f29b674cc221 |
comparison
equal
deleted
inserted
replaced
7012:78341ea65d16 | 7013:f56e788fa292 |
---|---|
5 # This software may be used and distributed according to the terms | 5 # This software may be used and distributed according to the terms |
6 # of the GNU General Public License, incorporated herein by reference. | 6 # of the GNU General Public License, incorporated herein by reference. |
7 | 7 |
8 from node import hex, nullid, nullrev, short | 8 from node import hex, nullid, nullrev, short |
9 from repo import RepoError, NoCapability | 9 from repo import RepoError, NoCapability |
10 from i18n import _ | 10 from i18n import _, gettext |
11 import os, re, sys, urllib | 11 import os, re, sys, urllib |
12 import hg, util, revlog, bundlerepo, extensions, copies | 12 import hg, util, revlog, bundlerepo, extensions, copies |
13 import difflib, patch, time, help, mdiff, tempfile | 13 import difflib, patch, time, help, mdiff, tempfile |
14 import version, socket | 14 import version, socket |
15 import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect | 15 import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect |
1287 # aliases | 1287 # aliases |
1288 if not ui.quiet and len(aliases) > 1: | 1288 if not ui.quiet and len(aliases) > 1: |
1289 ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:])) | 1289 ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:])) |
1290 | 1290 |
1291 # description | 1291 # description |
1292 doc = i[0].__doc__ | 1292 doc = gettext(i[0].__doc__) |
1293 if not doc: | 1293 if not doc: |
1294 doc = _("(No help text available)") | 1294 doc = _("(No help text available)") |
1295 if ui.quiet: | 1295 if ui.quiet: |
1296 doc = doc.splitlines(0)[0] | 1296 doc = doc.splitlines(0)[0] |
1297 ui.write("\n%s\n" % doc.rstrip()) | 1297 ui.write("\n%s\n" % doc.rstrip()) |
1313 if name == "shortlist" and not f.startswith("^"): | 1313 if name == "shortlist" and not f.startswith("^"): |
1314 continue | 1314 continue |
1315 f = f.lstrip("^") | 1315 f = f.lstrip("^") |
1316 if not ui.debugflag and f.startswith("debug"): | 1316 if not ui.debugflag and f.startswith("debug"): |
1317 continue | 1317 continue |
1318 doc = e[0].__doc__ | 1318 doc = gettext(e[0].__doc__) |
1319 if not doc: | 1319 if not doc: |
1320 doc = _("(No help text available)") | 1320 doc = _("(No help text available)") |
1321 h[f] = doc.splitlines(0)[0].rstrip() | 1321 h[f] = doc.splitlines(0)[0].rstrip() |
1322 cmds[f] = c.lstrip("^") | 1322 cmds[f] = c.lstrip("^") |
1323 | 1323 |
1358 try: | 1358 try: |
1359 mod = extensions.find(name) | 1359 mod = extensions.find(name) |
1360 except KeyError: | 1360 except KeyError: |
1361 raise cmdutil.UnknownCommand(name) | 1361 raise cmdutil.UnknownCommand(name) |
1362 | 1362 |
1363 doc = (mod.__doc__ or _('No help text available')).splitlines(0) | 1363 doc = gettext(mod.__doc__) or _('No help text available') |
1364 doc = doc.splitlines(0) | |
1364 ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0])) | 1365 ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0])) |
1365 for d in doc[1:]: | 1366 for d in doc[1:]: |
1366 ui.write(d, '\n') | 1367 ui.write(d, '\n') |
1367 | 1368 |
1368 ui.status('\n') | 1369 ui.status('\n') |