$zhSimp2Trad = $wgMemc->get($key1 = "$wgDBname:zhConvert:s2t");
$zhTrad2Simp = $wgMemc->get($key2 = "$wgDBname:zhConvert:t2s");
if(empty($zhSimp2Trad) || empty($zhTrad2Simp)) {
- require_once("includes/ZhConversion.php");
- $wgMemc->set($key1, $zhSimp2Trad);
- $wgMemc->set($key2, $zhTrad2Simp);
+ require_once("includes/ZhConversion.php");
+ $wgMemc->set($key1, $zhSimp2Trad);
+ $wgMemc->set($key2, $zhTrad2Simp);
}
/* class that handles both Traditional and Simplified Chinese
non-zh_cn), will add support for zh_sg, zh_hk, etc, later.
*/
class LanguageZh extends LanguageZh_cn {
-
- var $mZhLanguageCode=false;
-
- function LanguageZh() {
- $this->mZhLanguageCode = $this->getPreferredVariant();
- }
-
- /*
- get preferred language variants. eventually this will check the
- user's preference setting as well, once the language option in
- the setting pages is finalized.
- */
- function getPreferredVariant() {
- global $wgUser;
-
- if($this->mZhLanguageCode)
- return $this->mZhLanguageCode;
-
- // get language variant preference for logged in users
- if($wgUser->getID()!=0) {
- $this->mZhLanguageCode = $wgUser->getOption('variant');
- }
- else {
- // see if some zh- variant is set in the http header,
- $this->mZhLanguageCode="zh-cn";
- $header = str_replace( '_', '-', strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"]));
- $zh = strstr($header, 'zh-');
- if($zh) {
- $this->mZhLanguageCode = substr($zh,0,5);
- }
- }
- return $this->mZhLanguageCode;
- }
-
-
+
+ var $mZhLanguageCode=false;
+
+ function LanguageZh() {
+ $this->mZhLanguageCode = $this->getPreferredVariant();
+ }
+
+ /*
+ get preferred language variants. eventually this will check the
+ user's preference setting as well, once the language option in
+ the setting pages is finalized.
+ */
+ function getPreferredVariant() {
+ global $wgUser;
+
+ if($this->mZhLanguageCode)
+ return $this->mZhLanguageCode;
+
+ // get language variant preference for logged in users
+ if($wgUser->getID()!=0) {
+ $this->mZhLanguageCode = $wgUser->getOption('variant');
+ }
+ else {
+ // see if some zh- variant is set in the http header,
+ $this->mZhLanguageCode="zh-cn";
+ $header = str_replace( '_', '-', strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"]));
+ $zh = strstr($header, 'zh-');
+ if($zh) {
+ $this->mZhLanguageCode = substr($zh,0,5);
+ }
+ }
+ return $this->mZhLanguageCode;
+ }
+
+
/* the Simplified/Traditional conversion stuff */
function simp2trad($text) {
}
}
- function getVariants() {
- return array("zh-cn", "zh-tw");
- }
+ function getVariants() {
+ return array("zh-cn", "zh-tw");
+ }
}
?>