mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge branch '3.3.x'
This commit is contained in:
commit
d017eff8f1
3 changed files with 21 additions and 1 deletions
|
@ -339,6 +339,14 @@ class helper
|
|||
protected function render_language_select($selected_language = null)
|
||||
{
|
||||
$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)
|
||||
{
|
||||
$this->template->assign_block_vars('language_select_item', array(
|
||||
|
|
|
@ -65,6 +65,8 @@ class language_file_helper
|
|||
$available_languages[] = $this->get_language_data_from_json($data);
|
||||
}
|
||||
|
||||
usort($available_languages, [$this, 'sort_by_local_name']);
|
||||
|
||||
return $available_languages;
|
||||
}
|
||||
|
||||
|
@ -123,4 +125,14 @@ class language_file_helper
|
|||
'turnstile_lang' => $data['extra']['turnstile-lang'] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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