Skip to content
Snippets Groups Projects
Commit 810d2fe7 authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3529159 follow-up by phenaproxima: The language switcher should list...

Issue #3529159 follow-up by phenaproxima: The language switcher should list languages in their native form
parent 892aa354
Branches
No related tags found
No related merge requests found
Pipeline #518765 passed
......@@ -3,6 +3,7 @@
declare(strict_types=1);
use Drupal\Core\File\FileUrlGeneratorInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Language\LanguageManager;
/**
......@@ -17,10 +18,14 @@ function drupal_cms_installer_theme_preprocess_install_page(array &$variables):
$batch = &batch_get();
if (empty($batch)) {
$variables['languages'] = [];
foreach (LanguageManager::getStandardLanguageList() as $langcode => [$name]) {
$variables['languages'][$langcode] = $name;
foreach (LanguageManager::getStandardLanguageList() as $langcode => $language) {
// Pass the language's native name to the template, along with its
// direction (if defined).
$variables['languages'][$langcode] = [
'name' => $language[1],
'direction' => $language[2] ?? LanguageInterface::DIRECTION_LTR,
];
}
asort($variables['languages']);
}
}
......
......@@ -21,8 +21,8 @@
{% if languages %}
<select name="langcode" class="cms-installer__language-switcher">
{% for langcode, name in languages %}
<option value="{{ langcode }}">{{ name }}</option>
{% for langcode, language in languages %}
<option dir={{ language.direction }} value="{{ langcode }}">{{ language.name }}</option>
{% endfor %}
</select>
{% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment