CC-4805: Localization -> Changing default language changes datatables and add media language setting

-fixed
This commit is contained in:
denise 2013-01-07 18:18:40 -05:00
parent e9a86b7bcf
commit a65e72941f
4 changed files with 15 additions and 15 deletions

View file

@ -34,13 +34,7 @@ $front->registerPlugin(new RabbitMqPlugin());
//localization configuration //localization configuration
$codeset = 'UTF-8'; $codeset = 'UTF-8';
$auth = Zend_Auth::getInstance(); $lang = Application_Model_Preference::GetLocale().'.'.$codeset;
if ($auth->hasIdentity()) {
$id = $auth->getIdentity()->id;
$lang = Application_Model_Preference::GetCurrentUserLocale($id).'.'.$codeset;
} else {
$lang = Application_Model_Preference::GetLocale().'.'.$codeset;
}
putenv("LC_ALL=$lang"); putenv("LC_ALL=$lang");
putenv("LANG=$lang"); putenv("LANG=$lang");

View file

@ -44,7 +44,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view); Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]); Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]);
Application_Model_Preference::SetAllow3rdPartyApi($values["thirdPartyApi"]); Application_Model_Preference::SetAllow3rdPartyApi($values["thirdPartyApi"]);
Application_Model_Preference::SetLocale($values["locale"]); Application_Model_Preference::SetDefaultLocale($values["locale"]);
Application_Model_Preference::SetTimezone($values["timezone"]); Application_Model_Preference::SetTimezone($values["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]); Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);

View file

@ -55,7 +55,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$locale = new Zend_Form_Element_Select("locale"); $locale = new Zend_Form_Element_Select("locale");
$locale->setLabel(_("Default Interface Language")); $locale->setLabel(_("Default Interface Language"));
$locale->setMultiOptions(Application_Model_Locale::getLocales()); $locale->setMultiOptions(Application_Model_Locale::getLocales());
$locale->setValue(Application_Model_Preference::GetLocale()); $locale->setValue(Application_Model_Preference::GetDefaultLocale());
$locale->setDecorators(array('ViewHelper')); $locale->setDecorators(array('ViewHelper'));
$this->addElement($locale); $this->addElement($locale);

View file

@ -446,17 +446,17 @@ class Application_Model_Preference
} }
// This is the language setting on preferences page // This is the language setting on preferences page
public static function SetLocale($locale) public static function SetDefaultLocale($locale)
{ {
self::setValue("locale", $locale); self::setValue("locale", $locale);
} }
public static function GetLocale() public static function GetDefaultLocale()
{ {
return self::getValue("locale"); return self::getValue("locale");
} }
public static function GetCurrentUserLocale($id) public static function GetUserLocale($id)
{ {
return self::getValue("user_".$id."_locale", true); return self::getValue("user_".$id."_locale", true);
} }
@ -466,14 +466,20 @@ class Application_Model_Preference
// When a new user is created they will get the default locale // When a new user is created they will get the default locale
// setting which the admin sets on preferences page // setting which the admin sets on preferences page
if (is_null($locale)) { if (is_null($locale)) {
$locale = self::GetLocale(); $locale = self::GetDefaultLocale();
} }
self::setValue("user_".$userId."_locale", $locale, true, $userId); self::setValue("user_".$userId."_locale", $locale, true, $userId);
} }
public static function GetUserLocale($userId) public static function GetLocale()
{ {
return self::getValue("user_".$userId."_locale"); $auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$id = $auth->getIdentity()->id;
return self::GetUserLocale($id);
} else {
return self::GetDefaultLocale();
}
} }
public static function SetStationLogo($imagePath) public static function SetStationLogo($imagePath)