* Restructured
[lhc/web/wiklou.git] / languages / LanguageZh_cn.php
1 <?php
2 /** Simplified Chinese (中文(简体))
3 *
4 * @package MediaWiki
5 * @subpackage Language
6 */
7
8 require_once( 'LanguageUtf8.php' );
9
10 if (!$wgCachedMessageArrays) {
11 require_once('MessagesZh_cn.php');
12 }
13
14 class LanguageZh_cn extends LanguageUtf8 {
15 private $mMessagesZh_cn, $mNamespaceNamesZh_cn = null;
16
17 private $mQuickbarSettingsZh_cn = array(
18 '无', /* 'None' */
19 '左侧固定', /* 'Fixed left' */
20 '右侧固定', /* 'Fixed right' */
21 '左侧漂移' /* 'Floating left' */
22 );
23
24 private $mSkinNamesZh_cn = array(
25 'standard' => '标准',
26 'nostalgia' => '怀旧',
27 'cologneblue' => '科隆香水蓝'
28 );
29
30
31 function __construct() {
32 parent::__construct();
33
34 global $wgAllMessagesZh_cn;
35 $this->mMessagesZh_cn =& $wgAllMessagesZh_cn;
36
37 }
38
39 function getQuickbarSettings() {
40 return $this->mQuickbarSettingsZh_cn;
41 }
42
43 function getSkinNames() {
44 return $this->mSkinNamesZh_cn + parent::getSkinNames();
45 }
46
47 function getDateFormats() {
48 return false;
49 }
50
51 function getMessage( $key ) {
52 if( isset( $this->mMessagesZh_cn[$key] ) ) {
53 return $this->mMessagesZh_cn[$key];
54 } else {
55 return parent::getMessage( $key );
56 }
57 }
58
59 function getAllMessages() {
60 return $this->mMessagesZh_cn;
61 }
62
63 function getNsIndex( $text ) {
64 # Aliases
65 if ( 0 == strcasecmp( "特殊", $text ) ) { return -1; }
66 if ( 0 == strcasecmp( "对话", $text ) ) { return 1; }
67 if ( 0 == strcasecmp( "用户", $text ) ) { return 2; }
68 if ( 0 == strcasecmp( "用户对话", $text ) ) { return 3; }
69 if ( 0 == strcasecmp( "图像", $text ) ) { return 6; }
70 if ( 0 == strcasecmp( "图像对话", $text ) ) { return 7; }
71 return false;
72 }
73
74 function date( $ts, $adj = false ) {
75 if ( $adj ) { $ts = $this->userAdjust( $ts ); }
76
77 $d = substr( $ts, 0, 4 ) . "年" .
78 $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) .
79 (0 + substr( $ts, 6, 2 )) . "日";
80 return $d;
81 }
82
83 function timeDateSeparator( $format ) {
84 return ' ';
85 }
86
87 # inherit default iconv(), ucfirst(), checkTitleEncoding()
88
89 function stripForSearch( $string ) {
90 # MySQL fulltext index doesn't grok utf-8, so we
91 # need to fold cases and convert to hex
92 # we also separate characters as "words"
93 if( function_exists( 'mb_strtolower' ) ) {
94 return preg_replace(
95 "/([\\xc0-\\xff][\\x80-\\xbf]*)/e",
96 "' U8' . bin2hex( \"$1\" )",
97 mb_strtolower( $string ) );
98 } else {
99 global $wikiLowerChars;
100 return preg_replace(
101 "/([\\xc0-\\xff][\\x80-\\xbf]*)/e",
102 "' U8' . bin2hex( strtr( \"\$1\", \$wikiLowerChars ) )",
103 $string );
104 }
105 }
106 }
107
108
109 ?>