Merge pull request #6829 from battye/ticket/17399

[ticket/17399] Fix selected language bug in installer
This commit is contained in:
Marc Alexander 2025-06-15 09:08:49 +02:00
commit d4a3311b76
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
3 changed files with 21 additions and 1 deletions

View file

@ -339,6 +339,14 @@ class helper
protected function render_language_select($selected_language = null) protected function render_language_select($selected_language = null)
{ {
$langs = $this->lang_helper->get_available_languages(); $langs = $this->lang_helper->get_available_languages();
// The first language will be selected by default. Unless a user has consciously included
// other languages in the installation process, it will be British English anyway.
if ($selected_language === null && count($langs))
{
$selected_language = $langs[0]['iso'];
}
foreach ($langs as $lang) foreach ($langs as $lang)
{ {
$this->template->assign_block_vars('language_select_item', array( $this->template->assign_block_vars('language_select_item', array(

View file

@ -67,6 +67,18 @@ class language_file_helper
); );
} }
usort($available_languages, [$this, 'sort_by_local_name']);
return $available_languages; return $available_languages;
} }
/**
* Sorts the languages by their name instead of iso code
*
* @return array
*/
private static function sort_by_local_name($a, $b)
{
return $a['local_name'] > $b['local_name'];
}
} }