mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 20:08:55 +00:00
Compare commits
5 commits
eea903bf33
...
c7ab20e347
Author | SHA1 | Date | |
---|---|---|---|
|
c7ab20e347 | ||
|
0e0214a71d | ||
|
d017eff8f1 | ||
|
d4a3311b76 | ||
|
8411da1819 |
4 changed files with 79 additions and 1 deletions
|
@ -20,7 +20,7 @@
|
||||||
<form method="post" action="#" id="language_selector">
|
<form method="post" action="#" id="language_selector">
|
||||||
<fieldset class="nobg">
|
<fieldset class="nobg">
|
||||||
<label for="language">{L_SELECT_LANG}{L_COLON}</label>
|
<label for="language">{L_SELECT_LANG}{L_COLON}</label>
|
||||||
<select id="language" name="language">
|
<select id="language" name="language">
|
||||||
<!-- BEGIN language_select_item -->
|
<!-- BEGIN language_select_item -->
|
||||||
<option value="{language_select_item.VALUE}"<!-- IF language_select_item.SELECTED --> selected="selected"<!-- ENDIF -->>{language_select_item.NAME}</option>
|
<option value="{language_select_item.VALUE}"<!-- IF language_select_item.SELECTED --> selected="selected"<!-- ENDIF -->>{language_select_item.NAME}</option>
|
||||||
<!-- END language_select_item -->
|
<!-- END language_select_item -->
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
|
use phpbb\db\migration\migration;
|
||||||
|
|
||||||
|
class rename_auth_role_id_index extends migration
|
||||||
|
{
|
||||||
|
public static function depends_on()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'\phpbb\db\migration\data\v400\dev',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_schema()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'drop_keys' => [
|
||||||
|
$this->table_prefix . 'acl_users' => [
|
||||||
|
'auth_role_id',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'add_index' => [
|
||||||
|
$this->table_prefix . 'acl_users' => [
|
||||||
|
'usr_auth_role_id' => ['auth_role_id'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function revert_schema()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'drop_keys' => [
|
||||||
|
$this->table_prefix . 'acl_users' => [
|
||||||
|
'usr_auth_role_id',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'add_index' => [
|
||||||
|
$this->table_prefix . 'acl_users' => [
|
||||||
|
'auth_role_id' => ['auth_role_id'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -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(
|
||||||
|
|
|
@ -65,6 +65,8 @@ class language_file_helper
|
||||||
$available_languages[] = $this->get_language_data_from_json($data);
|
$available_languages[] = $this->get_language_data_from_json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usort($available_languages, [$this, 'sort_by_local_name']);
|
||||||
|
|
||||||
return $available_languages;
|
return $available_languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,4 +125,14 @@ class language_file_helper
|
||||||
'turnstile_lang' => $data['extra']['turnstile-lang'] ?? '',
|
'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