diff --git a/core/dict.class.inc.php b/core/dict.class.inc.php index 8c7845672..9be9fb7f2 100644 --- a/core/dict.class.inc.php +++ b/core/dict.class.inc.php @@ -101,6 +101,11 @@ class Dict { // Attempt to find the string in the user language // + if (!array_key_exists(self::$m_sCurrentLanguage, self::$m_aData)) + { + // It may happen, when something happens before the dictionnaries get loaded + return $sStringCode; + } $aCurrentDictionary = self::$m_aData[self::$m_sCurrentLanguage]; if (array_key_exists($sStringCode, $aCurrentDictionary)) { @@ -140,8 +145,14 @@ class Dict public static function Format($sFormatCode /*, ... arguments ....*/) { $sLocalizedFormat = self::S($sFormatCode); - $aArguments = func_get_args(); + + if ($sLocalizedFormat == $sFormatCode) + { + // Make sure the information will be displayed (ex: an error occuring before the dictionary gets loaded) + return $sFormatCode.' - '.implode(', ', $aArguments); + } + array_shift($aArguments); return vsprintf($sLocalizedFormat, $aArguments); } diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 2ed53dfea..f8c775117 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -2935,6 +2935,15 @@ abstract class MetaModel self::$m_bLogWebService = false; } + // Note: load the dictionary as soon as possible, because it might be + // needed when some error occur + foreach ($oConfig->GetDictionaries() as $sModule => $sToInclude) + { + self::Plugin($sConfigFile, 'dictionaries', $sToInclude); + } + // Set the language... after the dictionaries have been loaded! + Dict::SetDefaultLanguage($oConfig->GetDefaultLanguage()); + foreach ($oConfig->GetAppModules() as $sModule => $sToInclude) { self::Plugin($sConfigFile, 'application', $sToInclude); @@ -2947,12 +2956,6 @@ abstract class MetaModel { self::Plugin($sConfigFile, 'addons', $sToInclude); } - foreach ($oConfig->GetDictionaries() as $sModule => $sToInclude) - { - self::Plugin($sConfigFile, 'dictionaries', $sToInclude); - } - // Set the language... after the dictionaries have been loaded! - Dict::SetDefaultLanguage($oConfig->GetDefaultLanguage()); $sServer = $oConfig->GetDBHost(); $sUser = $oConfig->GetDBUser(); diff --git a/pages/UI.php b/pages/UI.php index bfa1c18cf..a714807f5 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -1306,7 +1306,7 @@ catch(CoreException $e) if (MetaModel::IsLogEnabledIssue()) { - if (class_exists('EventIssue')) + if (MetaModel::IsValidClass('EventIssue')) { $oLog = new EventIssue(); @@ -1335,7 +1335,7 @@ catch(Exception $e) if (MetaModel::IsLogEnabledIssue()) { - if (class_exists('EventIssue')) + if (MetaModel::IsValidClass('EventIssue')) { $oLog = new EventIssue();