mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add feature to suppress uuid/location information for message catalogs
Before: default #: ../../../source/news.txt:6 # 9f62de6b9c3b477095dba5e468972e6d msgid "News" msgstr After: suppress uuid & location information msgid "News" msgstr
This commit is contained in:
parent
eb79fcafea
commit
e8503888bc
@ -399,6 +399,19 @@ documentation on :ref:`intl` for details.
|
|||||||
By default, the document ``markup/code.rst`` ends up in the ``markup`` text
|
By default, the document ``markup/code.rst`` ends up in the ``markup`` text
|
||||||
domain. With this option set to ``False``, it is ``markup/code``.
|
domain. With this option set to ``False``, it is ``markup/code``.
|
||||||
|
|
||||||
|
.. confval:: gettext_uuid
|
||||||
|
|
||||||
|
If true, ``sphinx`` generates message catalogs with uuid information
|
||||||
|
for ``pot`` files. If false, ``sphinx`` doesn't do it.
|
||||||
|
|
||||||
|
The default is ``true``.
|
||||||
|
|
||||||
|
.. confval:: gettext_location
|
||||||
|
|
||||||
|
If true, ``sphinx`` generates message catalogs with location information
|
||||||
|
for ``pot`` files. If false, ``sphinx`` doesn't do it.
|
||||||
|
|
||||||
|
The default is ``true``.
|
||||||
|
|
||||||
.. _html-options:
|
.. _html-options:
|
||||||
|
|
||||||
|
@ -196,13 +196,14 @@ class MessageCatalogBuilder(I18nBuilder):
|
|||||||
for message in catalog.messages:
|
for message in catalog.messages:
|
||||||
positions = catalog.metadata[message]
|
positions = catalog.metadata[message]
|
||||||
|
|
||||||
# generate "#: file1:line1\n#: file2:line2 ..."
|
if self.config.gettext_location:
|
||||||
pofile.write(u"#: %s\n" % "\n#: ".join("%s:%s" %
|
# generate "#: file1:line1\n#: file2:line2 ..."
|
||||||
(safe_relpath(source, self.outdir), line)
|
pofile.write(u"#: %s\n" % "\n#: ".join("%s:%s" %
|
||||||
for source, line, _ in positions))
|
(safe_relpath(source, self.outdir), line)
|
||||||
# generate "# uuid1\n# uuid2\n ..."
|
for source, line, _ in positions))
|
||||||
pofile.write(u"# %s\n" % "\n# ".join(uid for _, _, uid
|
if self.config.gettext_uuid:
|
||||||
in positions))
|
# generate "# uuid1\n# uuid2\n ..."
|
||||||
|
pofile.write(u"# %s\n" % "\n# ".join(uid for _, _, uid in positions))
|
||||||
|
|
||||||
# message contains *one* line of text ready for translation
|
# message contains *one* line of text ready for translation
|
||||||
message = message.replace(u'\\', ur'\\'). \
|
message = message.replace(u'\\', ur'\\'). \
|
||||||
|
@ -201,6 +201,8 @@ class Config(object):
|
|||||||
|
|
||||||
# gettext options
|
# gettext options
|
||||||
gettext_compact = (True, 'gettext'),
|
gettext_compact = (True, 'gettext'),
|
||||||
|
gettext_location = (True, None),
|
||||||
|
gettext_uuid = (True, None),
|
||||||
|
|
||||||
# XML options
|
# XML options
|
||||||
xml_pretty = (True, 'env'),
|
xml_pretty = (True, 'env'),
|
||||||
|
Loading…
Reference in New Issue
Block a user