i18n: Store user culture in session

This commit is contained in:
loblao 2016-09-02 19:57:43 -03:00 committed by Alex Grintsvayg
parent d689d4d19f
commit e0b3d0921a
3 changed files with 8 additions and 2 deletions

View file

@ -6,7 +6,8 @@ class Session
KEY_DOWNLOAD_ALLOWED = 'beta_download_allowed2',
KEY_PREFINERY_USER_ID = 'prefinery_user_id',
KEY_PREFINER_USED_CUSTOM_CODE = 'prefinery_used_custom_code',
KEY_LIST_SUB_ERROR = 'list_error';
KEY_LIST_SUB_ERROR = 'list_error',
KEY_USER_CULTURE = 'user_culture';
public static function init()
{

View file

@ -17,6 +17,11 @@ class i18n
public static function register($culture = null) /*needed to trigger class include, presumably setup would happen here*/
{
if ($culture == null)
{
$culture = Session::get(Session::KEY_USER_CULTURE);
}
if ($culture === null)
{
$urlTokens = Request::getHost() ? explode('.', Request::getHost()) : [];

View file

@ -25,8 +25,8 @@ if (!IS_PRODUCTION)
try
{
i18n::register();
Session::init();
i18n::register();
if (!IS_PRODUCTION)
{
View::compileCss();