Starting point:

Node A (EN) -> node/10
Node B (EN) -> node/11

In the body of Node A the a internal link: <a href="node/11">Node B</a>

If the nodes have been translated (e.g. to german) we have the result:

Node A (EN) -> node/10
Node B (EN) -> node/11
Node B (DE) -> node/13
Node A (DE) -> node/14

In the body of Node A is the internal link: <a href="node/11">Node B</a>
(because the complete field value is copied to the translated node).

But now links the german version of Node A to the english version of Node B (node/11), which results in an 404 error.

Is it not better if the link target would be automatically adjusted (in the text format process) to the translated version of Node B (in the example case to "node/14)?

Because in the WYSIWYG editor the link targets are not visible, the editor users always forget to adjust the internet links to the correct translated node version. With the automatically adjustment of the link target to the correct node id, we minimize broken links and help the editors.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cbeier’s picture

Status: Active » Needs review
FileSize
1000 bytes

Here is a patch that integrates the above mentioned functionality.

phma’s picture

This extends the patch of @cbeier to work with language fallback (language_hierarchy).

EDIT: This only works, if a translation set has been created already. So "Update Translations" needs to be pressed at least once on the target node. The set itself can remain empty and doesn't need any translations in it. I've only tested this with content translation, not entity translation.