comparison doc/gendoc.py @ 19231:814291b5e79c

gendoc: make commnd __doc__ and extension __doc__ as translatable Before this patch, commnd __doc__ and extension __doc__ are not translatable. But other messages, like doc of helptalbe, section headers, are translatable. This patch makes commnd __doc__ and extension __doc__ translatable.
author Takumi IINO <trot.thunder@gmail.com>
date Wed, 15 May 2013 15:44:55 +0900
parents 6e676fb6ea44
children 81d9a7f6f2e7
comparison
equal deleted inserted replaced
19228:889807c79384 19231:814291b5e79c
5 sys.path.append(os.path.join('..', 'mercurial', 'pure')) 5 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
6 from mercurial import demandimport; demandimport.enable() 6 from mercurial import demandimport; demandimport.enable()
7 from mercurial import encoding 7 from mercurial import encoding
8 from mercurial import minirst 8 from mercurial import minirst
9 from mercurial.commands import table, globalopts 9 from mercurial.commands import table, globalopts
10 from mercurial.i18n import _ 10 from mercurial.i18n import gettext, _
11 from mercurial.help import helptable 11 from mercurial.help import helptable
12 from mercurial import extensions 12 from mercurial import extensions
13 from mercurial import util 13 from mercurial import util
14 14
15 def get_desc(docstr): 15 def get_desc(docstr):
49 attr = cmdtable[cmd] 49 attr = cmdtable[cmd]
50 cmds = cmd.lstrip("^").split("|") 50 cmds = cmd.lstrip("^").split("|")
51 51
52 d['cmd'] = cmds[0] 52 d['cmd'] = cmds[0]
53 d['aliases'] = cmd.split("|")[1:] 53 d['aliases'] = cmd.split("|")[1:]
54 d['desc'] = get_desc(attr[0].__doc__) 54 d['desc'] = get_desc(gettext(attr[0].__doc__))
55 d['opts'] = list(get_opts(attr[1])) 55 d['opts'] = list(get_opts(attr[1]))
56 56
57 s = 'hg ' + cmds[0] 57 s = 'hg ' + cmds[0]
58 if len(attr) > 2: 58 if len(attr) > 2:
59 if not attr[2].startswith('hg'): 59 if not attr[2].startswith('hg'):
100 " :depth: 1\n\n") 100 " :depth: 1\n\n")
101 101
102 for extensionname in sorted(allextensionnames()): 102 for extensionname in sorted(allextensionnames()):
103 mod = extensions.load(None, extensionname, None) 103 mod = extensions.load(None, extensionname, None)
104 ui.write(minirst.subsection(extensionname)) 104 ui.write(minirst.subsection(extensionname))
105 ui.write("%s\n\n" % mod.__doc__) 105 ui.write("%s\n\n" % gettext(mod.__doc__))
106 cmdtable = getattr(mod, 'cmdtable', None) 106 cmdtable = getattr(mod, 'cmdtable', None)
107 if cmdtable: 107 if cmdtable:
108 ui.write(minirst.subsubsection(_('Commands'))) 108 ui.write(minirst.subsubsection(_('Commands')))
109 commandprinter(ui, cmdtable, minirst.subsubsubsection) 109 commandprinter(ui, cmdtable, minirst.subsubsubsection)
110 110