language prefix prevents aliases from being resolved / update the right translation

Created on 20 March 2024, 8 months ago
Updated 27 March 2024, 7 months ago

Problem/Motivation

This fails if there is a language prefix:

    $path = $this->aliasManager->getPathByAlias($path);

getPathByAlias() has a langcode parameter, but we have no idea whether there is a langcode in use or which one it is.

We probably need to:

1. Check whether the site is multilingual, and how langcode show in the URL
2. Trim something that looks a langcode from the start of the path if path prefix language negotiation is used.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom joachim

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

Comments & Activities

  • Issue created by @joachim
  • 🇬🇧United Kingdom joachim

    Fix for this is probably:

    - check if path prefix lang negotiation is in use
    - get list of enabled languages
    - check if an enabled langcode is at the start of the path
    - if so, remove it, and make sure to load host entities in that language

  • 🇬🇧United Kingdom joachim

    Also need to consider the default language case!

    - is the site multilingual?
    - does it use path prefixes?
    - if so, is there NO path prefix on the URLs?
    - then update only the default language

Production build 0.71.5 2024