Allow user to link to a page in a different language

Created on 8 October 2021, about 3 years ago
Updated 30 October 2024, 16 days ago

Problem/Motivation

We have a website with 2 languages: English and Dutch. When creating links with the Linkit module, we are able to link to English pages when creating or editing English pages, and we are able to link to Dutch pages when creating or editing Dutch pages.
If a page doesn't have a translation, it's possible to link to that page, regardless of the language of the page you are creating / editing.
If a page does have a translation, Linkit will currently always match the language of the linked node with the language of the current node.

Now our client would like to be able to link to pages in a different language, also if there is a translation available.

Steps to reproduce

  • Have a multilingual website (ie. with Dutch and English as languages), with the Linkit module setup
  • Create a node with a translation
  • Create a node without a translation
  • Create a new node, and add a link to the first node (which has a translation), and add a link to the second node (which doesn't have a translation
  • If you now add a translation for the third node, and keep the links in there the same, you should see that on the Dutch version of the page, the first link links to the Dutch version of the first node. The second link will link to the second node, in the language it was created in. On the English version you should see the first link linking to the English version of the first node. The second link will link to the second node in the language it was created in.

Like this, it doesn't seem possible to link to a node in a different language, if that node has a translation in the current language.

Proposed resolution

I have created a patch which will allow for this.
Currently it does the following:

  • Adds a configuration setting to enable this functionality
  • When enabled, the suggestions in the EntityMatcher are expanded, so they contain suggestions for nodes in each available language
  • The url is rewritten, so the language stays preserved in the output

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

6.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands daluxz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024