Let's assume you have a node in English (nid = 10) and a translation of that node in French (nid = 11) using the i18n module.

I tried the Internal Links filter expecting a link to node/10 on a French language page to be translated to node/11. This wasn't the actual behavior, so I'm writing a patch that will look for a translation of the node link for the current language if it's available. I'll post the patch later today.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chromix’s picture

Status: Active » Needs review
FileSize
983 bytes

Here's the patch. It uses i18n_get_path_translations() to get the node/# link and title in the current language if it's available. Otherwise, the module works exactly as it did before. It might be that this behavior isn't actually what people want, necessarily, in which case maybe this can be configurable? I'm open to suggestions.

chromix’s picture

Found a bug when langcode is set to und. This uses the global language as the langcode which seems to fix the problem overall.

chromix’s picture

Update for this patch to use the passed-in langcode, rather than the global one.

chromix’s picture

Found another bug where langcode is set to und.

chromix’s picture

Issue summary: View changes

reworded a sentence in the description

FiNeX’s picture

Ok, the patch works fine, but only if the "bad links" filter is not active.