mirror of
https://github.com/unraid/webgui.git
synced 2026-01-02 07:30:06 -06:00
38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
Menu="Buttons:1"
|
|
Title="Switch Language"
|
|
Icon="icon-u-switch"
|
|
Code="e982"
|
|
---
|
|
<?PHP
|
|
/* Copyright 2005-2023, Lime Technology
|
|
* Copyright 2012-2023, Bergware International.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*/
|
|
?>
|
|
<script>
|
|
<?if (count(glob('/var/log/plugins/lang-*.xml'))==0):?>
|
|
// hide switch button when no other language packs
|
|
$(function(){$('.nav-item.LanguageButton').hide();});
|
|
<?endif;?>
|
|
|
|
function LanguageButton() {
|
|
var locale = '<?=$locale?>';
|
|
if (locale) {
|
|
switchLanguage('');
|
|
$.cookie('locale',locale);
|
|
} else {
|
|
switchLanguage($.cookie('locale'));
|
|
$.removeCookie('locale');
|
|
}
|
|
}
|
|
|
|
function switchLanguage(lang) {
|
|
$.post('/webGui/include/LanguageReset.php',{lang:lang},function(){location.reload();});
|
|
}
|
|
</script> |