Multilingual Support

Created on 5 July 2021, almost 4 years ago
Updated 22 March 2024, about 1 year ago

Problem/Motivation

As of now, module does not support multilingual very well. Like a node can have different url alias per language, while this is not supported by the module.

Steps to reproduce

1. Enable Content Translation, create node and add translations.
2. Create Views, add url alias field

You will observe duplication of records. Because table has as many records of node based on translations being added.
Impt: Calling views_url_alias_node_rebuild will resolve the issue of duplication, but that's not the solution, as this actually is just a temporary solution, the moment we add translation to the node, records are again duplicated.

Proposed resolution

Let's store langcode as well in the table.
Support entity translation operations for adding / updating records. As well update existing functions to save corresponding langcode.
Also, we will have to write hook_update to add this field.
I'ld start with creating a patch for this, including following issues as well:
https://www.drupal.org/project/views_url_alias/issues/3104606 ๐Ÿ“Œ Implement path alias changes in 8.x-1.x Needs work
https://www.drupal.org/project/views_url_alias/issues/3036345 ๐Ÿ› No indexes created on 'views_url_alias_node' table Fixed

Remaining tasks

User interface changes

API changes

Data model changes

โœจ Feature request
Status

Needs work

Version

3.0

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡ธSpain purushotam.rai

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.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada dstorozhuk Chicago ๐Ÿ‡บ๐Ÿ‡ธ, Toronto ๐Ÿ‡จ๐Ÿ‡ฆ, Kyiv ๐Ÿ‡บ๐Ÿ‡ฆ

    This issue still valid in term of adding the language filter.
    I fixed in 3.x-dev the issue with saving the language dependent data to views_url_alias, but the filter or view query still need to added to make sure we can filter by specific/current language.

  • murat_kekic โ†’ made their first commit to this issueโ€™s fork.

  • The latest code wasn't selecting the correct entity translation.
    It always picked the entity translation in the current user's language because the entity was resolved with the router service.
    This issue can be reproduced by running a Pathauto bulk regenerate for all aliases on a multilingual entity.

    I refactored the views_url_alias_get_path_entity_type function to ensure it handles entity translations properly when applicable.

    However, I had to remove the views_url_alias_pathauto_alias_alter hook function. The comment in the hook says itโ€™s for saving aliases during bulk updates

    function views_url_alias_pathauto_alias_alter(&$alias, array &$context) {
      // Save alias during bulk update.
    

    , but I donโ€™t see how thatโ€™s the relevant place to save the data. Is it a workaround for something?

  • ๐Ÿ‡ต๐Ÿ‡ฐPakistan dewancodes

    After I had installed this module on Drupal 10.2.3, I added a relationship in the views for 'URL alias', the related views page is broken. It is not working correctly on a multilingual website.

Production build 0.71.5 2024