mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fixes #1983: i18n translation feature breaks references which uses section name.
This commit is contained in:
parent
49b812b856
commit
a3109f6976
1
CHANGES
1
CHANGES
@ -50,6 +50,7 @@ Bugs fixed
|
||||
* #1725: On py2 environment, doctest with using non-ASCII characters causes
|
||||
``'ascii' codec can't decode byte`` exception.
|
||||
* #1540: Fix RuntimeError with circular referenced toctree
|
||||
* #1983: i18n translation feature breaks references which uses section name.
|
||||
|
||||
|
||||
Release 1.3.1 (released Mar 17, 2015)
|
||||
|
@ -277,8 +277,10 @@ class Locale(Transform):
|
||||
# document nameids mapping with new name.
|
||||
names = section_node.setdefault('names', [])
|
||||
names.append(new_name)
|
||||
if old_name in names:
|
||||
names.remove(old_name)
|
||||
# Original section name (reference target name) should be kept to refer
|
||||
# from other nodes which is still not translated or uses explicit target
|
||||
# name like "`text to display <explicit target name_>`_"..
|
||||
# So, `old_name` is still exist in `names`.
|
||||
|
||||
_id = self.document.nameids.get(old_name, None)
|
||||
explicit = self.document.nametypes.get(old_name, None)
|
||||
|
@ -22,3 +22,4 @@ CONTENTS
|
||||
versionchange
|
||||
docfields
|
||||
raw
|
||||
refs
|
||||
|
85
tests/roots/test-intl/refs.po
Normal file
85
tests/roots/test-intl/refs.po
Normal file
@ -0,0 +1,85 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 1191 1.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-08-08 15:31+0900\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
msgid "Translation Tips"
|
||||
msgstr "X TIPS"
|
||||
|
||||
msgid "A-1. Here's how you can `download Sphinx`_."
|
||||
msgstr "A-1. HERE'S HOW YOU CAN `download Sphinx`_."
|
||||
|
||||
msgid "A-2. Here's how you can `download Sphinx`_."
|
||||
msgstr "A-2. HERE'S HOW YOU CAN `A1 DOWNLOAD SPHINX`_."
|
||||
|
||||
msgid "A-3. Here's how you can `download Sphinx`_."
|
||||
msgstr ""
|
||||
"A-3. HERE'S HOW YOU CAN `A3 DOWNLOAD SPHINX <download Sphinx_>`_ AND `A3 DOWNLOAD "
|
||||
"SPHINX <download Sphinx_>`_."
|
||||
|
||||
msgid "B-1. `Docutils site`_ and `Sphinx site`_."
|
||||
msgstr "B-1. `Docutils site`_ and `Sphinx site`_."
|
||||
|
||||
msgid "B-2. `Docutils site`_ and `Sphinx site`_."
|
||||
msgstr "B-2. `B1 DOCUTILS SITE`_ AND `B1 SPHINX SITE`_."
|
||||
|
||||
msgid "B-3. `Docutils site`_ and `Sphinx site`_."
|
||||
msgstr "B-3. `B2 SPHINX SITE`_ AND `B2 DOCUTILS SITE`_."
|
||||
|
||||
msgid "B-4. `Docutils site`_ and `Sphinx site`_."
|
||||
msgstr ""
|
||||
"B-4. `B4 SPHINX SITE <Sphinx site_>`_ AND `B4 DOCUTILS SITE <Docutils "
|
||||
"site_>`_."
|
||||
|
||||
msgid "B-5. `Docutils site`_ and `Sphinx site`_."
|
||||
msgstr ""
|
||||
"B-5. `B5 SPHINX SITE <Sphinx site_>`_ AND `B5 DOCUTILS SITE <Docutils "
|
||||
"site_>`_\" AND `B5 SPHINX SITE <Sphinx site_>`_."
|
||||
|
||||
msgid "C-1. Link to `Translation Tips`_ section."
|
||||
msgstr "C-1. LINK TO `Translation Tips`_ SECTION."
|
||||
|
||||
msgid "C-2. Link to `Translation Tips`_ section."
|
||||
msgstr "C-2. LINK TO `X TIPS`_ SECTION."
|
||||
|
||||
msgid "C-3. Link to `Translation Tips`_ section."
|
||||
msgstr "C-3. LINK TO `X TIPS <Translation Tips_>`_ SECTION."
|
||||
|
||||
msgid "C-4. Link to `Translation Tips`_ section."
|
||||
msgstr ""
|
||||
"C-4. LINK TO `X TIPS <Translation Tips_>`_ x `X TIPS <Translation Tips_>`_ "
|
||||
"SECTION."
|
||||
|
||||
msgid "C-5. Link to `Translation Tips`_ section."
|
||||
msgstr ""
|
||||
"C-5. LINK TO `TRANS <X TIPS_>`_ x `LATION <X TIPS_>`_ "
|
||||
|
||||
msgid "D-1. Link to `Translation Tips`_ and `Next Section`_ section."
|
||||
msgstr "D-1. LINK TO `Translation Tips`_ and `Next Section`_ SECTION."
|
||||
|
||||
msgid "D-2. Link to `Translation Tips`_ and `Next Section`_ section."
|
||||
msgstr "D-2. LINK TO `X TIPS`_ AND `N SECTION`_ SECTION."
|
||||
|
||||
msgid "D-3. Link to `Translation Tips`_ and `Next Section`_ section."
|
||||
msgstr "D-3. LINK TO `N SECTION`_ AND `X TIPS`_ SECTION."
|
||||
|
||||
msgid "D-4. Link to `Translation Tips`_ and `Next Section`_ section."
|
||||
msgstr ""
|
||||
"D-4. LINK TO `N SECTION <Next Section_>`_ AND `X TIPS <Translation Tips_>`_ "
|
||||
"SECTION."
|
||||
|
||||
msgid "D-5. Link to `Translation Tips`_ and `Next Section`_ section."
|
||||
msgstr ""
|
||||
"D-5. LINK TO `Next <N SECTION_>`_ AND `Tips <X TIPS_>`_ "
|
||||
|
||||
msgid "Next Section"
|
||||
msgstr "N SECTION"
|
||||
|
47
tests/roots/test-intl/refs.txt
Normal file
47
tests/roots/test-intl/refs.txt
Normal file
@ -0,0 +1,47 @@
|
||||
References
|
||||
===========
|
||||
|
||||
Translation Tips
|
||||
-----------------
|
||||
|
||||
.. _download Sphinx: https://pypi.python.org/pypi/sphinx
|
||||
.. _Docutils site: http://docutils.sourceforge.net/
|
||||
.. _Sphinx site: http://sphinx-doc.org/
|
||||
|
||||
|
||||
A-1. Here's how you can `download Sphinx`_.
|
||||
|
||||
A-2. Here's how you can `download Sphinx`_.
|
||||
|
||||
A-3. Here's how you can `download Sphinx`_.
|
||||
|
||||
B-1. `Docutils site`_ and `Sphinx site`_.
|
||||
|
||||
B-2. `Docutils site`_ and `Sphinx site`_.
|
||||
|
||||
B-3. `Docutils site`_ and `Sphinx site`_.
|
||||
|
||||
B-4. `Docutils site`_ and `Sphinx site`_.
|
||||
|
||||
C-1. Link to `Translation Tips`_ section.
|
||||
|
||||
C-2. Link to `Translation Tips`_ section.
|
||||
|
||||
C-3. Link to `Translation Tips`_ section.
|
||||
|
||||
C-4. Link to `Translation Tips`_ section.
|
||||
|
||||
C-5. Link to `Translation Tips`_ section.
|
||||
|
||||
D-1. Link to `Translation Tips`_ and `Next Section`_ section.
|
||||
|
||||
D-2. Link to `Translation Tips`_ and `Next Section`_ section.
|
||||
|
||||
D-3. Link to `Translation Tips`_ and `Next Section`_ section.
|
||||
|
||||
D-4. Link to `Translation Tips`_ and `Next Section`_ section.
|
||||
|
||||
D-5. Link to `Translation Tips`_ and `Next Section`_ section.
|
||||
|
||||
Next Section
|
||||
-------------
|
@ -751,3 +751,11 @@ def test_additional_targets_should_be_translated(app, status, warning):
|
||||
expected_expr = """<img alt="IMG -> I18N" src="_images/i18n.png" />"""
|
||||
yield assert_count(expected_expr, result, 1)
|
||||
|
||||
|
||||
@gen_with_intl_app('text', freshenv=True)
|
||||
def test_references(app, status, warning):
|
||||
app.builder.build_specific([app.srcdir / 'refs.txt'])
|
||||
|
||||
warnings = warning.getvalue().replace(os.sep, '/')
|
||||
warning_expr = u'refs.txt:\\d+: ERROR: Unknown target name:'
|
||||
yield assert_count(warning_expr, warnings, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user