$this->mTables = array();
$this->mTables['zh-cn'] = $zh2CN;
$this->mTables['zh-tw'] = $zh2TW;
- $this->mTables['zh-sg'] = array_merge($zh2CN, $zh2SG);
- $this->mTables['zh-hk'] = array_merge($zh2TW, $zh2HK);
+ $this->mTables['zh-sg'] = $zh2SG;
+ $this->mTables['zh-hk'] = $zh2HK;
$cached = $this->parseCachedTable('zh-cn');
$this->mTables['zh-cn'] = array_merge($this->mTables['zh-cn'], $cached);
$this->mTables['zh-tw'] = array_merge($this->mTables['zh-tw'], $cached);
$cached = $this->parseCachedTable('zh-sg');
- $this->mTables['zh-sg'] = array_merge($this->mTables['zh-sg'], $cached);
+ $this->mTables['zh-sg'] = array_merge($this->mTables['zh-cn'], $this->mTables['zh-sg'], $cached);
$cached = $this->parseCachedTable('zh-hk');
- $this->mTables['zh-hk'] = array_merge($this->mTables['zh-hk'], $cached);
+ $this->mTables['zh-hk'] = array_merge($this->mTables['zh-tw'], $this->mTables['zh-hk'], $cached);
if($this->lockCache()) {
$wgMemc->set($this->mCacheKey, $this->mTables, 43200);
$this->unlockCache();
$m = explode( '=>', $t );
if( count( $m ) != 2)
continue;
- $ret[trim($m[0])] = trim($m[1]);
+ // trim any trailling comments starting with '//'
+ $tt = explode('//', $m[1], 2);
+ $ret[trim($m[0])] = trim($tt[0]);
}
}
$parsed[$key] = true;
}
// get language variant preference from logged in users
- if($wgUser->getID()!=0) {
+ if( $wgUser->isLoggedIn() ) {
$this->mZhLanguageCode = $wgUser->getOption('variant');
}
static $cache=array();
global $wgDisableLangConversion;
$pref = $this->getPreferredVariant();
- if( $wgDisableLangConversion || $pref == 'zh' || $count > 50)
+ if( $count > 50 )
return;
$count++;
$variants = $this->autoConvertToAllVariants($link);
$varnt = Title::newFromText( $v );
if( $varnt && $varnt->getArticleID() > 0 ) {
$nt = $varnt;
- $link = $v;
+ if( !$wgDisableLangConversion && $pref != 'zh' )
+ $link = $v;
break;
}
}