PathProcessor::getPath not working with non-default language code

Created on 16 July 2018, over 6 years ago
Updated 13 February 2023, about 2 years ago

Problem/Motivation

Drupal`s URL language detection configuration give us possibility to use our own language codes instead of default ones.
but PathProcessor::getPath uses language id instead configured paths.

  protected function getPath($path_info) {
    $language_prefix = '/' . $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL)->getId() . '/';

    if (substr($path_info, 0, strlen($language_prefix)) == $language_prefix) {
      $path_info = '/' . substr($path_info, strlen($language_prefix));
    }

    return $path_info;
  }

How to reproduce

  1. create a node with alias /a
  2. add language
  3. change default language prefix to /lang
  4. try to open page /lang/a/edit
πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine pnagornyak

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