Multiple references in the same line return the same link with i18n

ThomasG77 avatarThomasG77 created an issue

When I generate a po file with gettext, I make a translation from a text like below

Look :ref:`reference1 <reference1>` for more details, :ref:`reference2 <reference2>`

reference1 and reference2 are present in two other files, I have in my generated html a result like below

<p>Voir cette <a href="reference2.html#reference2" class="reference internal"><em>reference1</em></a> et pour plus de details, <a href="reference2.html#reference2" class="reference internal"><em>reference2</em></a></p>

As you see, I have two link pointing to the same url athought my 2 references are different. This behaviour is unexpected in my opinion.

You can see the problem by cloning the depot https://github.com/ThomasG77/sphinxi18bug.git and doing a "make html" (configure for Unix like, not tested on Windows) I am using 1.2beta1

Comments (23)

  1. Claude Paroz

    Mmmh, now I'm getting this:

    # Sphinx version: 1.2b1
    # Python version: 2.6.6
    # Docutils version: 0.10 release
    # Jinja2 version: 2.7
    Traceback (most recent call last):
      File "/home/claude/virtualenvs/djangoproject/src/sphinx/sphinx/cmdline.py", line 247, in main
        app.build(force_all, filenames)
      File "/home/claude/virtualenvs/djangoproject/src/sphinx/sphinx/application.py", line 211, in build
        self.builder.build_update()
      File "/home/claude/virtualenvs/djangoproject/src/sphinx/sphinx/builders/__init__.py", line 211, in build_update
        'out of date' % len(to_build))
      File "/home/claude/virtualenvs/djangoproject/src/sphinx/sphinx/builders/__init__.py", line 231, in build
        purple, length):
      File "/home/claude/virtualenvs/djangoproject/src/sphinx/sphinx/builders/__init__.py", line 131, in status_iterator
        for item in iterable:
      File "/home/claude/virtualenvs/djangoproject/src/sphinx/sphinx/environment.py", line 469, in update_generator
        self.read_doc(docname, app=app)
      File "/home/claude/virtualenvs/djangoproject/src/sphinx/sphinx/environment.py", line 634, in read_doc
        domain.process_doc(self, docname, doctree)
      File "/home/claude/virtualenvs/djangoproject/src/sphinx/sphinx/domains/std.py", line 503, in process_doc
        labelid = document.nameids[name]
    KeyError: u'glossary'
    
  2. ThomasG77

    For me doing a hg clone and installing works the expected way with my sample repo (A bit dirty but I'm outside a virtualenv FYI)

    In a more complex repository, I get like claudep an identical type of error

    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.2b1dev_20130616-py2.7.egg/sphinx/cmdline.py", line 247, in main
        app.build(force_all, filenames)
      File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.2b1dev_20130616-py2.7.egg/sphinx/application.py", line 207, in build
        self.builder.build_all()
      File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.2b1dev_20130616-py2.7.egg/sphinx/builders/__init__.py", line 174, in build_all
        self.build(None, summary='all source files', method='all')
      File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.2b1dev_20130616-py2.7.egg/sphinx/builders/__init__.py", line 231, in build
        purple, length):
      File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.2b1dev_20130616-py2.7.egg/sphinx/builders/__init__.py", line 131, in status_iterator
        for item in iterable:
      File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.2b1dev_20130616-py2.7.egg/sphinx/environment.py", line 469, in update_generator
        self.read_doc(docname, app=app)
      File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.2b1dev_20130616-py2.7.egg/sphinx/environment.py", line 634, in read_doc
        domain.process_doc(self, docname, doctree)
      File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.2b1dev_20130616-py2.7.egg/sphinx/domains/std.py", line 503, in process_doc
        labelid = document.nameids[name]
    KeyError: u'about'
    
  3. Takayuki Shimizukawa

    fix: keep reference if link refname was translated. refs #1193

    case1::

    Keep link to ExternalSite_.

    It will translated with \`SomeOtherString\`_.

    .. _ExternalSite: http://example.com

    case2::

    Keep link to title string_ before appearing.

    title string =============

    case3::

    Keep link to glossary 'term string'.

    .. glossary::

      term string
         description...
    

    → <<cset 9bfb539f2f9c>>

  4. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.