* @return CRM_Core_I18n
*/
public static function &singleton() {
- static $singleton = array();
-
+ if (!isset(Civi::$statics[__CLASS__]['singleton'])) {
+ Civi::$statics[__CLASS__]['singleton'] = array();
+ }
$tsLocale = CRM_Core_I18n::getLocale();
- if (!isset($singleton[$tsLocale])) {
- $singleton[$tsLocale] = new CRM_Core_I18n($tsLocale);
+ if (!isset(Civi::$statics[__CLASS__]['singleton'][$tsLocale])) {
+ Civi::$statics[__CLASS__]['singleton'][$tsLocale] = new CRM_Core_I18n($tsLocale);
}
- return $singleton[$tsLocale];
+ return Civi::$statics[__CLASS__]['singleton'][$tsLocale];
}
/**
$locale = CRM_Core_I18n::getLocale();
$this->assertEquals($locale, 'fr_CA');
+ CRM_Core_I18n::singleton()->setLocale('en_US');
+ Civi::$statics['CRM_Core_I18n']['singleton'] = [];
}
}