Add default translations
This commit is contained in:
@@ -44,13 +44,12 @@ class Translator extends PhpObject
|
|||||||
$bAllTrans = ($sTransKey=='');
|
$bAllTrans = ($sTransKey=='');
|
||||||
|
|
||||||
//Look up in the selected language dictionary
|
//Look up in the selected language dictionary
|
||||||
if(in_array($sLang, $this->asLanguages) && ($bAllTrans || array_key_exists($sTransKey, $this->asTranslations[$sLang])))
|
if(in_array($sLang, $this->asLanguages) && ($bAllTrans || array_key_exists($sTransKey, $this->asTranslations[$sLang]))) {
|
||||||
{
|
if($bAllTrans) $oTransText = array_merge($this->asTranslations[$this->sDefaultLang], $this->asTranslations[$sLang]);
|
||||||
$oTransText = $bAllTrans?$this->asTranslations[$sLang]:$this->asTranslations[$sLang][$sTransKey];
|
else $oTransText = $this->asTranslations[$sLang][$sTransKey];
|
||||||
}
|
}
|
||||||
//Look up in the default language dictionary
|
//Look up in the default language dictionary
|
||||||
elseif(array_key_exists($sTransKey, $this->asTranslations[$this->sDefaultLang]))
|
elseif(!$bAllTrans && array_key_exists($sTransKey, $this->asTranslations[$this->sDefaultLang])) {
|
||||||
{
|
|
||||||
$this->addWarning('Missing translation in "'.$sLang.'" for the key "'.$sTransKey.'", falling back to "'.$this->sDefaultLang.'"');
|
$this->addWarning('Missing translation in "'.$sLang.'" for the key "'.$sTransKey.'", falling back to "'.$this->sDefaultLang.'"');
|
||||||
$oTransText = $this->asTranslations[$this->sDefaultLang][$sTransKey];
|
$oTransText = $this->asTranslations[$this->sDefaultLang][$sTransKey];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user