Comment 20 for bug 1068493

Revision history for this message
Jose Luis Tirado (txelu70) wrote : Re: Spanish translation FTBFS

I could generate the html-es after modifying several translation, so with current Spanish translations on Launchpad no longer FTBFS.

However there is a real problem on how Sphinx handles the translation. The problem arise whenever a segment to be translated starts or with a link and the translated version adds some text before or after the starting/ending link, respectively. For example:
  - if "`Link`_ English text" is translated into "Spanish text `Link`_ more text" it breaks Sphinx.
  - if "English text `Link`_ " is translated into "Spanish text `Link`_ more text" it breaks Sphinx.
This should be accepted by the tool, as those are perfectly normal situations (in fact, my modified translation to avoid the problem sounds less natural to me than original ones)

The reason for that problem is that the original text and the translated patch are expected to have the same number of parts, as the following debug session shows:

227
228 # copy text children
229 for i, child in enumerate(patch.children):
230 if isinstance(child, nodes.Text):
231 child.parent = node
232 -> node.children[i] = child
233
234
235 class SphinxStandaloneReader(standalone.Reader):
236 """
237 Add our own transforms.

p i
3

p patch.children
[<#text: 'La p\xe1gina '>, <reference: <#text: 'The new accoun ...'>>, <target "the new account help page": >, <#text: ' en Launchpad contiene m\xe1s informaci\xf3n sobre el proceso y par\xe1me ...'>]

p node.children
[<#text: 'La p\xe1gina '>, <target "the new account help page": >, <#text: '\non Launchpad has more information about the process and additio ...'>]

So there are 4 parts in the patch but only 3 in the original text, which lead to the above problem. For that example I had to modify the translation in the following way:

Original text:
`The new account help page <https://help.launchpad.net/YourAccount/NewAccount>`_ on Launchpad has more information about the process and additional settings you can change.

Intended translation:
La página `The new account help page <https://help.launchpad.net/YourAccount/NewAccount>`_ en Launchpad contiene más información sobre el proceso y parámetros adicionales que puede cambiar.

Modified translation:
`The new account help page <https://help.launchpad.net/YourAccount/NewAccount>`_ en Launchpad contiene más información sobre el proceso y parámetros adicionales que puede cambiar.