// do all wildcard translations first
- if (!isset(Civi::$statics[__CLASS__]) || !array_key_exists($this->locale, Civi::$statics[__CLASS__])) {
+ // FIXME: Is there a constant we can reference instead of hardcoding en_US?
+ $replacementsLocale = $this->locale ? $this->locale : 'en_US';
+ if (!isset(Civi::$statics[__CLASS__]) || !array_key_exists($replacementsLocale, Civi::$statics[__CLASS__])) {
if (defined('CIVICRM_DSN') && !CRM_Core_Config::isUpgradeMode()) {
- Civi::$statics[__CLASS__][$this->locale] = CRM_Core_BAO_WordReplacement::getLocaleCustomStrings($this->locale);
+ Civi::$statics[__CLASS__][$replacementsLocale] = CRM_Core_BAO_WordReplacement::getLocaleCustomStrings($replacementsLocale);
}
else {
- Civi::$statics[__CLASS__][$this->locale] = array();
+ Civi::$statics[__CLASS__][$replacementsLocale] = array();
}
}
- $stringTable = Civi::$statics[__CLASS__][$this->locale];
+ $stringTable = Civi::$statics[__CLASS__][$replacementsLocale];
$exactMatch = FALSE;
if (isset($stringTable['enabled']['exactMatch'])) {
&$array,
$params = array()
) {
- global $tsLocale;
+ $tsLocale = CRM_Core_I18n::getLocale();
if ($tsLocale == 'en_US') {
return;
public static function &singleton() {
static $singleton = array();
- global $tsLocale;
+ $tsLocale = CRM_Core_I18n::getLocale();
if (!isset($singleton[$tsLocale])) {
$singleton[$tsLocale] = new CRM_Core_I18n($tsLocale);
}
public static function setLcTime() {
static $locales = array();
- global $tsLocale;
+ $tsLocale = CRM_Core_I18n::getLocale();
if (!isset($locales[$tsLocale])) {
// with the config being set to pl_PL: try pl_PL.UTF-8,
// then pl_PL, if neither present fall back to C
));
}
elseif ($language == 'current_site_language') {
- global $tsLocale;
- return $tsLocale;
+ return CRM_Core_I18n::getLocale();
}
return $language;
$config = CRM_Core_Config::singleton();
}
- global $tsLocale;
+ $tsLocale = CRM_Core_I18n::getLocale();
if (!$i18n or $locale != $tsLocale) {
$i18n = CRM_Core_I18n::singleton();
$locale = $tsLocale;