Improved error handling and localization

SVN:trunk[437]
This commit is contained in:
Romain Quetiez
2010-06-07 14:28:42 +00:00
parent dc2430332a
commit d3ffa21943
3 changed files with 23 additions and 9 deletions

View File

@@ -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);
}