diff options
author | Nozomu Kaneko <nozom.kaneko@gmail.com> | 2012-12-18 06:08:25 +0900 |
---|---|---|
committer | Nozomu Kaneko <nozom.kaneko@gmail.com> | 2012-12-18 06:08:25 +0900 |
commit | 0cdf9c478c2a76ecd93fc69a6602881f081cd4db (patch) | |
tree | 07da97139132a02788cae1bf362ec9a686d7d16d /sphinx/util | |
parent | 5318d02a870292e9a9e6726ba9fddf457556db0d (diff) | |
download | sphinx-0cdf9c478c2a76ecd93fc69a6602881f081cd4db.tar.gz |
make docfield translatable
Diffstat (limited to 'sphinx/util')
-rw-r--r-- | sphinx/util/docfields.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sphinx/util/docfields.py b/sphinx/util/docfields.py index 896319f5..79326477 100644 --- a/sphinx/util/docfields.py +++ b/sphinx/util/docfields.py @@ -67,7 +67,9 @@ class Field(object): fieldname += nodes.Text(' ') fieldname += self.make_xref(self.rolename, domain, fieldarg, nodes.Text) - fieldbody = nodes.field_body('', nodes.paragraph('', '', *content)) + par = nodes.paragraph() + par += content + fieldbody = nodes.field_body('', par) return nodes.field('', fieldname, fieldbody) @@ -255,6 +257,11 @@ class DocFieldTransformer(object): [nodes.Text(argtype)] fieldarg = argname + translatable_content = addnodes.translatable(fieldbody.rawsource) + translatable_content.source = fieldbody.parent.source + translatable_content.line = fieldbody.parent.line + translatable_content += content + # grouped entries need to be collected in one entry, while others # get one entry per field if typedesc.is_grouped: @@ -264,10 +271,11 @@ class DocFieldTransformer(object): groupindices[typename] = len(entries) group = [typedesc, []] entries.append(group) - group[1].append(typedesc.make_entry(fieldarg, content)) + entry = typedesc.make_entry(fieldarg, translatable_content) + group[1].append(entry) else: - entries.append([typedesc, - typedesc.make_entry(fieldarg, content)]) + entry = typedesc.make_entry(fieldarg, translatable_content) + entries.append([typedesc, entry]) # step 2: all entries are collected, construct the new field list new_list = nodes.field_list() |