Hello Unfortunately, can't do it as addon. So we have to work a little FIrstly need open FluxCP/lib/Flux.php Find this
if ($lang=self::config('DefaultLanguage')) {
$current = $addonName ? FLUX_ADDON_DIR."/$addonName/lang/$lang.php" : FLUX_LANG_DIR."/$lang.php";
}
And add few lines after
// [Sanasol] LangSwitcher
$dictionary = array("en" => "en_us", "ru" => "ru_ru"); // keeping bad guys from use ../../../../
if(!empty($_COOKIE["language"]) && array_key_exists($_COOKIE["language"], $dictionary))
{
$lang = $dictionary[$_COOKIE["language"]];
$current = $addonName ? FLUX_ADDON_DIR."/$addonName/lang/$lang.php" : FLUX_LANG_DIR."/$lang.php";
}
// [Sanasol] LangSwitcher
Here you should change $dictionary to your own lang list. For example: "lang_key" => "lang_file" and create translation file in FluxCP/lang/ named lang_file.php And now output switcher Open FluxCP/themes/your_theme/footer.php or other theme part where you want to place it. For default theme I added to footer.php some magic code before this line
<?php if (Flux::config('ShowCopyright')): ?>
add this
<tr>
<td colspan="3"></td>
<td>
<script>
function setCookie(key, value) {
var expires = new Date();
expires.setTime(expires.getTime() + expires.getTime()); // never expires
document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
}
function getCookie(key) {
var keyValue = document.cookie.match('(^| ?' + key + '=([^;]*)(;|$)');
return keyValue ? keyValue[2] : null;
}
$(document).ready(function(){
$("a[data-lang]").click(function(e){
e.preventDefault();
if(getCookie('language') != $(this).data("lang"))
{
setCookie('language', $(this).data("lang"));
reload();
}
});
$("a[data-lang]").each(function(i){
if(getCookie('language') == $(this).data("lang"))
{
$(this).css("font-weight","700");
}
});
});
</script>
<p>
<a href="#" data-lang="en">English</a>/<a href="#" data-lang="ru">Russian</a>
</p>
</td>
<td></td>
</tr>
Very simple code. You see lang links where data-lang = lang_key Thats all! When you save it and visit your site you will see something like this Now you can switch language in your FluxCP. Demo available here: http://ro.sanasol.ws/demo/fluxcp/?module=woe Only this page have differences in langs Interesting fact: drawing logo (two flags with poring(from DeviantArt)) took more time than writing code