707b9556f2f3702ef84e4290101eb31afce77e74
[lhc/web/wiklou.git] / languages / LanguageKo.php
1 <?php
2 /** Korean (한국어)
3 *
4 * @package MediaWiki
5 * @subpackage Language
6 */
7
8 require_once('LanguageUtf8.php');
9
10 if (!$wgCachedMessageArrays) {
11 require_once('MessagesKo.php');
12 }
13
14 class LanguageKo extends LanguageUtf8 {
15 private $mMessagesKo, $mNamespaceNamesKo = null;
16
17 private $mQuickbarSettingsKo = array(
18 '없음', '왼쪽', '오른쪽', '왼쪽 고정', '오른쪽 고정'
19 );
20
21 private $mSkinNamesKo = array(
22 'standard' => '표준',
23 'davinci' => '다빈치',
24 'mono' => '모노',
25 'monobook' => '모노북',
26 'my skin' => '내 스킨',
27 );
28
29 private $mBookstoreListKo = array(
30 'Aladdin.co.kr' => 'http://www.aladdin.co.kr/catalog/book.asp?ISBN=$1'
31 );
32
33 # (Okay, I think I got it right now. This can be adjusted
34 # in the 'date' function down at the bottom. --Brion)
35 #
36 # Thanks. And it's usual that the time comes after dates.
37 # So I've change the timeanddate function, just exchanged $time and $date
38 # But you should check before you install it, 'cause I'm quite stupid about
39 # the programming.
40 #
41
42 private $mWeekdayAbbreviationsKo = array(
43 '일', '월', '화', '수', '목', '금', '토'
44 );
45
46 function __construct() {
47 parent::__construct();
48
49 global $wgAllMessagesKo;
50 $this->mMessagesKo =& $wgAllMessagesKo;
51
52 global $wgMetaNamespace;
53 $this->mNamespaceNamesKo = array(
54 NS_MEDIA => 'Media',
55 NS_SPECIAL => '특수기능',
56 NS_MAIN => '',
57 NS_TALK => '토론',
58 NS_USER => '사용자',
59 NS_USER_TALK => '사용자토론',
60 NS_PROJECT => $wgMetaNamespace,
61 NS_PROJECT_TALK => $wgMetaNamespace.'토론',
62 NS_IMAGE => '그림',
63 NS_IMAGE_TALK => '그림토론',
64 NS_MEDIAWIKI => 'MediaWiki',
65 NS_MEDIAWIKI_TALK => 'MediaWiki토론',
66 NS_TEMPLATE => '틀',
67 NS_TEMPLATE_TALK => '틀토론',
68 NS_HELP => '도움말',
69 NS_HELP_TALK => '도움말토론',
70 NS_CATEGORY => '분류',
71 NS_CATEGORY_TALK => '분류토론',
72 );
73 }
74
75 function getNamespaces() {
76 return $this->mNamespaceNamesKo + parent::getNamespaces();
77 }
78
79 function getQuickbarSettings() {
80 return $this->mQuickbarSettingsKo;
81 }
82
83 function getSkinNames() {
84 return $this->mSkinNamesKo + parent::getSkinNames();
85 }
86
87 function getBookstoreList() {
88 return $this->mBookstoreListKo + parent::getBookstoreList();
89 }
90
91 function getDateFormats() {
92 return false;
93 }
94
95 function getMessage( $key ) {
96 if( isset( $this->mMessagesKo[$key] ) ) {
97 return $this->mMessagesKo[$key];
98 } else {
99 return parent::getMessage( $key );
100 }
101 }
102
103 function getAllMessages() {
104 return $this->mMessagesKo;
105 }
106
107 /**
108 * $format and $timecorrection are for compatibility with Language::date
109 */
110 function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
111 if ( $adj ) { $ts = $this->userAdjust( $ts ); }
112
113 $year = (int)substr( $ts, 0, 4 );
114 $month = (int)substr( $ts, 4, 2 );
115 $mday = (int)substr( $ts, 6, 2 );
116 $hour = (int)substr( $ts, 8, 2 );
117 $minute = (int)substr( $ts, 10, 2 );
118 $second = (int)substr( $ts, 12, 2 );
119 $time = mktime( $hour, $minute, $second, $month, $mday, $year );
120 $date = getdate( $time );
121
122 # "xxxx년 xx월 xx일 (월)"
123 # timeanddate works "xxxx년 xx월 xx일 (월) xx:xx"
124 $d = $year . "년 " .
125 $this->getMonthAbbreviation( $month ) . "월 " .
126 $mday . "일 ".
127 "(" . $this->mWeekdayAbbreviationsKo[ $date['wday'] ]. ")";
128
129 return $d;
130 }
131
132 function timeBeforeDate() {
133 return false;
134 }
135
136 function timeDateSeparator( $format ) {
137 return ' ';
138 }
139
140 function firstChar( $s ) {
141 preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
142 '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})/', $s, $matches);
143
144 if ( isset( $matches[1] ) ) {
145 if ( strlen( $matches[1] ) != 3 ) {
146 return $matches[1];
147 }
148 $code = (ord($matches[1]{0}) & 0x0f) << 12;
149 $code |= (ord($matches[1]{1}) & 0x3f) << 6;
150 $code |= (ord($matches[1]{2}) & 0x3f);
151 if ( $code < 0xac00 || 0xd7a4 <= $code) {
152 return $matches[1];
153 } elseif ( $code < 0xb098 ) {
154 return "\xe3\x84\xb1";
155 } elseif ( $code < 0xb2e4 ) {
156 return "\xe3\x84\xb4";
157 } elseif ( $code < 0xb77c ) {
158 return "\xe3\x84\xb7";
159 } elseif ( $code < 0xb9c8 ) {
160 return "\xe3\x84\xb9";
161 } elseif ( $code < 0xbc14 ) {
162 return "\xe3\x85\x81";
163 } elseif ( $code < 0xc0ac ) {
164 return "\xe3\x85\x82";
165 } elseif ( $code < 0xc544 ) {
166 return "\xe3\x85\x85";
167 } elseif ( $code < 0xc790 ) {
168 return "\xe3\x85\x87";
169 } elseif ( $code < 0xcc28 ) {
170 return "\xe3\x85\x88";
171 } elseif ( $code < 0xce74 ) {
172 return "\xe3\x85\x8a";
173 } elseif ( $code < 0xd0c0 ) {
174 return "\xe3\x85\x8b";
175 } elseif ( $code < 0xd30c ) {
176 return "\xe3\x85\x8c";
177 } elseif ( $code < 0xd558 ) {
178 return "\xe3\x85\x8d";
179 } else {
180 return "\xe3\x85\x8e";
181 }
182 } else {
183 return "";
184 }
185 }
186 }
187
188 ?>