- Issue created by @saidatom
- 🇷🇴Romania claudiu.cristea Arad 🇷🇴
Thank you for reporting but it's not the case anymore as this was implemented differently in other issues
When accessing the Babel configuration page without specifying a language in the URL, existing translations are not displayed.
If the URL includes the language (e.g., /it
), translations are shown correctly.
This happens because the code uses:
$language ??= $this->languageManager->getCurrentLanguage();
which sets the language to the site's default language instead of 'it'
, the only option available in the select list.
If no language is provided in the URL, automatically use the language available in the select list (in this case 'it'
) instead of defaulting to the site's default language.
Suggested code adjustment:
Instead of:
$language ??= $this->languageManager->getCurrentLanguage();
Consider checking the available languages from the select list and defaulting to the first one if none is provided:
if (!$language) { $available_languages = array_keys($this->languageManager->getLanguages()); $language = reset($available_languages) ?: $this->languageManager->getCurrentLanguage(); }
Where $this->languageManager->getLanguages()
returns the languages displayed in the dropdown.
$language
to use the first available language from the select list when none is provided in the URL.$this->languageManager->getLanguages()
retrieves the same set used to populate the dropdown.Active
1.0
Code
Thank you for reporting but it's not the case anymore as this was implemented differently in other issues