6 require_once( 'LanguageUtf8.php' );
8 /* private */ $wgNamespaceNamesZh_cn = array(
10 NS_SPECIAL
=> 'Special',
14 NS_USER_TALK
=> 'User_talk',
15 NS_PROJECT
=> $wgMetaNamespace,
16 NS_PROJECT_TALK
=> $wgMetaNamespace . '_talk',
18 NS_IMAGE_TALK
=> 'Image_talk',
19 NS_MEDIAWIKI
=> 'MediaWiki',
20 NS_MEDIAWIKI_TALK
=> 'MediaWiki_talk',
21 NS_TEMPLATE
=> 'Template',
22 NS_TEMPLATE_TALK
=> 'Template_talk',
24 NS_HELP_TALK
=> 'Help_talk',
25 NS_CATEGORY
=> 'Category',
26 NS_CATEGORY_TALK
=> 'Category_talk'
28 ) +
$wgNamespaceNamesEn;
30 /* private */ $wgQuickbarSettingsZh_cn = array(
32 "左侧固定", /* "Fixed left" */
33 "右侧固定", /* "Fixed right" */
34 "左侧漂移" /* "Floating left" */
37 /* private */ $wgSkinNamesZh_cn = array(
40 'cologneblue' => "科隆香水蓝"
43 /* private */ $wgUserTogglesZh_cn = array(
48 if (!$wgCachedMessageArrays) {
49 require_once('MessagesZh_cn.php');
53 class LanguageZh_cn
extends LanguageUtf8
{
55 function getUserToggles() {
56 global $wgUserTogglesZh_cn;
57 return $wgUserTogglesZh_cn;
60 function getNamespaces() {
61 global $wgNamespaceNamesZh_cn;
62 return $wgNamespaceNamesZh_cn;
66 function getNsIndex( $text ) {
67 global $wgNamespaceNamesZh_cn;
69 foreach ( $wgNamespaceNamesZh_cn as $i => $n ) {
70 if ( 0 == strcasecmp( $n, $text ) ) { return $i; }
73 if ( 0 == strcasecmp( "特殊", $text ) ) { return -1; }
74 if ( 0 == strcasecmp( "", $text ) ) { return ; }
75 if ( 0 == strcasecmp( "对话", $text ) ) { return 1; }
76 if ( 0 == strcasecmp( "用户", $text ) ) { return 2; }
77 if ( 0 == strcasecmp( "用户对话", $text ) ) { return 3; }
78 if ( 0 == strcasecmp( "{{SITENAME}}_对话", $text ) ) { return 5; }
79 if ( 0 == strcasecmp( "图像", $text ) ) { return 6; }
80 if ( 0 == strcasecmp( "图像对话", $text ) ) { return 7; }
84 function getQuickbarSettings() {
85 global $wgQuickbarSettingsZh_cn;
86 return $wgQuickbarSettingsZh_cn;
89 function getSkinNames() {
90 global $wgSkinNamesZh_cn;
91 return $wgSkinNamesZh_cn;
94 function getDateFormats() {
98 function date( $ts, $adj = false ) {
99 if ( $adj ) { $ts = $this->userAdjust( $ts ); }
101 $d = substr( $ts, 0, 4 ) . "年" .
102 $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) .
103 (0 +
substr( $ts, 6, 2 )) . "日";
107 function timeanddate( $ts, $adj = false ) {
108 return $this->time( $ts, $adj ) . " " . $this->date( $ts, $adj );
111 function getMessage( $key ) {
112 global $wgAllMessagesZh_cn;
113 if( isset( $wgAllMessagesZh_cn[$key] ) )
114 return $wgAllMessagesZh_cn[$key];
116 return parent
::getMessage( $key );
119 # inherit default iconv(), ucfirst(), checkTitleEncoding()
121 function stripForSearch( $string ) {
122 # MySQL fulltext index doesn't grok utf-8, so we
123 # need to fold cases and convert to hex
124 # we also separate characters as "words"
125 if( function_exists( 'mb_strtolower' ) ) {
127 "/([\\xc0-\\xff][\\x80-\\xbf]*)/e",
128 "' U8' . bin2hex( \"$1\" )",
129 mb_strtolower( $string ) );
131 global $wikiLowerChars;
133 "/([\\xc0-\\xff][\\x80-\\xbf]*)/e",
134 "' U8' . bin2hex( strtr( \"\$1\", \$wikiLowerChars ) )",