Add current language prefix

Created on 27 June 2020, over 4 years ago
Updated 6 September 2023, about 1 year ago
$lang = \Drupal::languageManager()->getCurrentLanguage()->getId();
$languages_prefixes_arr = \Drupal::config('language.negotiation')->get('url.prefixes');
$language_prefix = ($languages_prefixes_arr[$lang]) ? '/' . $languages_prefixes_arr[$lang] : FALSE;
Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

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.

  • 🇧🇪Belgium zero2one

    Module no longer supported

    Replace the tokens from this module by the tokens from the Token module & uninstall this module.

    The current language prefix is available in the Token module: [language:prefix]

Production build 0.71.5 2024