From: Philip Tzou Date: Thu, 29 Jan 2009 07:43:03 +0000 (+0000) Subject: mTables' element must not be left blank, to ensure the translate() function could... X-Git-Tag: 1.31.0-rc.0~43140 X-Git-Url: http://git.cyclocoop.org///%22%40url%40//%22?a=commitdiff_plain;h=2a59db5897296b30af277abba8e9a4d1471da27e;p=lhc%2Fweb%2Fwiklou.git mTables' element must not be left blank, to ensure the translate() function could always return a string. --- diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index a070f3f281..63b98f1292 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -296,12 +296,19 @@ class LanguageConverter { if( !in_array($v,$this->mVariants) )continue; if( $action=="add" ) { foreach($t as $from=>$to) { - // more efficient than array_merge(), about 2.5 times. - $this->mManualAddTables[$v][$from] = $to; + // to ensure that $from and $to not be left blank + // so $this->translate() could always return a string + if ($from || $to) + // more efficient than array_merge(), about 2.5 times. + $this->mManualAddTables[$v][$from] = $to; + } + } + elseif ( $action=="remove" ) { + foreach($t as $from=>$to) { + if ($from || $to) + $this->mManualRemoveTables[$v][$from] = $to; } } - elseif ( $action=="remove" ) - $this->mManualRemoveTables[$v] = array_merge($this->mManualRemoveTables[$v], $t); } }