Switch language when user is not logged
Permalink
Hi,
I try to find a way to change the site language (package translation) when the user is not logged. I'm working with 5.6+ and it seems that lot of things have changed.
Here my solution that doesn't work, packages are not translated during the session. I've created a small package with in the controller :
Anyone can help me ?
I try to find a way to change the site language (package translation) when the user is not logged. I'm working with 5.6+ and it seems that lot of things have changed.
Here my solution that doesn't work, packages are not translated during the session. I've created a small package with in the controller :
function on_start() { if (!$_SESSION['uID'] || $_GET['lang']) { if($_GET['lang']) { $lang = $_GET['lang']; } else { Loader::library('3rdparty/Zend/Locale'); Loader::library('3rdparty/Zend/Locale/Data'); $languages = Localization::getAvailableInterfaceLanguages(); $lang = $languages[0]; } $_SESSION['uDefaultLanguage'] = $lang; define('LOCALE', $lang); setlocale(LC_ALL,$lang); } }
Anyone can help me ?
There is a few more bits that you seem to be able to access from the model section.php,
packages/multilingual/models/section.php
Sorry I don't know if this is exactly what you want? I am still very new to the translation package and struggling to get through it. C5 is not that good when compared to other cms that multiple languages already.