mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/17399] Fix selected language in installer
This fixes a bug where a user could have other languages in the installer but the language dropdown did not match the language shown. PHPBB-17399
This commit is contained in:
parent
8f8a93fa71
commit
8411da1819
3 changed files with 21 additions and 1 deletions
|
@ -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(
|
||||||
|
|
|
@ -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'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue