Mercurial > hg
comparison doc/gendoc.py @ 7014:46456a51e247
i18n: use gettext instead of _
Both gettext and _ trigger a translation at runtime, but _ can only be
used with a string argument since it also triggers string extraction.
author | Martin Geisler <mg@daimi.au.dk> |
---|---|
date | Tue, 09 Sep 2008 21:32:39 +0200 |
parents | 78341ea65d16 |
children | fc06bd17c985 |
comparison
equal
deleted
inserted
replaced
7013:f56e788fa292 | 7014:46456a51e247 |
---|---|
1 import sys, textwrap | 1 import sys, textwrap |
2 # import from the live mercurial repo | 2 # import from the live mercurial repo |
3 sys.path.insert(0, "..") | 3 sys.path.insert(0, "..") |
4 from mercurial import demandimport; demandimport.enable() | 4 from mercurial import demandimport; demandimport.enable() |
5 from mercurial.commands import table, globalopts | 5 from mercurial.commands import table, globalopts |
6 from mercurial.i18n import gettext as _ | 6 from mercurial.i18n import gettext, _ |
7 from mercurial.help import helptable | 7 from mercurial.help import helptable |
8 | 8 |
9 def get_desc(docstr): | 9 def get_desc(docstr): |
10 if not docstr: | 10 if not docstr: |
11 return "", "" | 11 return "", "" |
91 if d['aliases']: | 91 if d['aliases']: |
92 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) | 92 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) |
93 | 93 |
94 # print topics | 94 # print topics |
95 for names, section, doc in helptable: | 95 for names, section, doc in helptable: |
96 underlined(_(section).upper()) | 96 underlined(gettext(section).upper()) |
97 if callable(doc): | 97 if callable(doc): |
98 doc = doc() | 98 doc = doc() |
99 ui.write(_(doc)) | 99 ui.write(gettext(doc)) |
100 ui.write("\n") | 100 ui.write("\n") |
101 | 101 |
102 if __name__ == "__main__": | 102 if __name__ == "__main__": |
103 show_doc(sys.stdout) | 103 show_doc(sys.stdout) |