Skip to content

Commit

Permalink
Added select_lang option #218
Browse files Browse the repository at this point in the history
  • Loading branch information
tltneon committed Aug 27, 2024
1 parent 1d4444e commit e133711
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
18 changes: 12 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,20 @@ function alertContents() {
}
}
?>
<select name='language' onChange='changeLang(event)'>
<?php
foreach (tltneon\LGSL\Lang::list() as $lang) {
$select = $_COOKIE['lgsl_lang'] === $lang ? "selected": "";
echo "<option {$select}>{$lang}</option>";
}
if ($lgsl_config['select_lang']) {
?>
<select name='language' onChange='changeLang(event)'>
<?php
foreach (tltneon\LGSL\Lang::list() as $lang) {
$select = $_COOKIE['lgsl_lang'] === $lang ? "selected": "";
echo "<option {$select}>{$lang}</option>";
}
?>
</select>
<?php
}
?>
</select>
</div>
<a id="adminlink" href="admin.php"></a>

Expand Down
8 changes: 7 additions & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ function type($var) {
\$lgsl_config['retry_offline'] = 0; // 1=repeats query when there is no response but adds loading delay
\$lgsl_config['cms'] = 'sa'; // sets which CMS specific code to use
\$lgsl_config['disabled_types']= false; // allow to exclude some protocols (games) from list. usage: ['disabled_types']= ['halflifewon', 'test'];
\$lgsl_config['select_lang'] = {$conf['select_lang']}; // allow to select language for users
\$lgsl_config['language'] = '{$conf['language']}'; // sets LGSL language
include('languages/{$conf['language']}.php'); // loads LGSL language
?>";
Expand Down Expand Up @@ -494,6 +495,10 @@ function check($name, $bool, $hint = '') {
<l k='hideo'></l>:
<input type='checkbox' name='hide_offline' onChange='changeCheckbox(event)' />
</p>
<p>
<l k='sella'></l>:
<input type='checkbox' name='select_lang' onChange='changeCheckbox(event)' />
</p>
<p>
<l k='pubad'></l>:
<select type='text' name='public_add' onChange='changeValue(event)' />
Expand Down Expand Up @@ -569,7 +574,8 @@ function reloadLocale() {
public_add: false,
totals: false,
locations: false,
preloader: false
preloader: false,
select_lang: false
}
function changeValue(event, options = {}) {
if (options.styleChanged) {
Expand Down
1 change: 1 addition & 0 deletions src/lgsl_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
$lgsl_config['pagination_lim']= 15; // limit per page
$lgsl_config['preloader'] = true; // true=using ajax to faster loading page
$lgsl_config['disabled_types']= false; // allow to exclude some protocols (games) from list. usage: $lgsl_config['disabled_types']= ['warsowold', 'halflifewon', 'test'];
$lgsl_config['select_lang'] = true; // allow to select language for users

//------------------------------------------------------------------------------------------------------------+
//[ TRANSLATION ]
Expand Down

0 comments on commit e133711

Please sign in to comment.