078cc270c3f5b29d5c3f68768a5f3afe1e46ac39
[lhc/web/wiklou.git] / languages / LanguageEt.php
1 <?php
2 /** Estonian (Eesti)
3 *
4 * @package MediaWiki
5 * @subpackage Language
6 *
7 */
8
9 require_once( 'LanguageUtf8.php' );
10
11 if (!$wgCachedMessageArrays) {
12 require_once('MessagesEt.php');
13 }
14
15 class LanguageEt extends LanguageUtf8 {
16 private $mMessagesEt, $mNamespaceNamesEt = null;
17
18 private $mSkinNamesEt = array(
19 'standard' => 'Standard',
20 'nostalgia' => 'Nostalgia',
21 'cologneblue' => 'Kölni sinine',
22 'smarty' => 'Paddington',
23 'montparnasse' => 'Montparnasse',
24 'davinci' => 'DaVinci',
25 'mono' => 'Mono',
26 'monobook' => 'MonoBook',
27 'myskin' => 'Mu oma nahk'
28 );
29
30 private $mDateFormatsEt = array(
31 'Eelistus puudub',
32 '15.01.2001, kell 16.12',
33 '15. jaanuar 2001, kell 16.12',
34 '15. I 2005, kell 16.12',
35 'ISO 8601' => '2001-01-15 16:12:34'
36 );
37
38 private $mQuickbarSettingsEt = array(
39 'Ei_ole', 'Püsivalt_vasakul', 'Püsivalt paremal', 'Ujuvalt vasakul'
40 );
41
42 #Lisasin eestimaised poed, aga võõramaiseid ei julenud kustutada.
43
44 private $mBookstoreListEt = array(
45 'Apollo' => 'http://www.apollo.ee/search.php?keyword=$1&search=OTSI',
46 'minu Raamat' => 'http://www.raamat.ee/advanced_search_result.php?keywords=$1',
47 'Raamatukoi' => 'http://www.raamatukoi.ee/cgi-bin/index?valik=otsing&paring=$1',
48 'AddALL' => 'http://www.addall.com/New/Partner.cgi?query=$1&type=ISBN',
49 'PriceSCAN' => 'http://www.pricescan.com/books/bookDetail.asp?isbn=$1',
50 'Barnes & Noble' => 'http://search.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=$1',
51 'Amazon.com' => 'http://www.amazon.com/exec/obidos/ISBN=$1'
52 );
53
54
55 private $mMagicWordsEt = array(
56 # ID CASE SYNONYMS
57 'redirect' => array( 0, '#redirect', "#suuna" ),
58 );
59
60 function __construct() {
61 parent::__construct();
62
63 global $wgAllMessagesEt;
64 $this->mMessagesEt =& $wgAllMessagesEt;
65
66 global $wgMetaNamespace;
67 $this->mNamespaceNamesEt = array(
68 NS_MEDIA => 'Meedia',
69 NS_SPECIAL => 'Eri',
70 NS_MAIN => '',
71 NS_TALK => 'Arutelu',
72 NS_USER => 'Kasutaja',
73 NS_USER_TALK => 'Kasutaja_arutelu',
74 NS_PROJECT => $wgMetaNamespace,
75 NS_PROJECT_TALK => $wgMetaNamespace . '_arutelu',
76 NS_IMAGE => 'Pilt',
77 NS_IMAGE_TALK => 'Pildi_arutelu',
78 NS_MEDIAWIKI => 'MediaWiki',
79 NS_MEDIAWIKI_TALK => 'MediaWiki_arutelu',
80 NS_TEMPLATE => 'Mall',
81 NS_TEMPLATE_TALK => 'Malli_arutelu',
82 NS_HELP => 'Juhend',
83 NS_HELP_TALK => 'Juhendi_arutelu',
84 NS_CATEGORY => 'Kategooria',
85 NS_CATEGORY_TALK => 'Kategooria_arutelu'
86 );
87
88 }
89
90 function getNamespaces() {
91 return $this->mNamespaceNamesEt + parent::getNamespaces();
92 }
93
94 function getQuickbarSettings() {
95 return $this->mQuickbarSettingsEt;
96 }
97
98 function getSkinNames() {
99 return $this->mSkinNamesEt + parent::getSkinNames();
100 }
101
102 function getDateFormats() {
103 return $this->mDateFormatsEt;
104 }
105
106 function getBookstoreList() {
107 return $this->mBookstoreListEt;
108 }
109
110 function &getMagicWords() {
111 $t = $this->mMagicWordsEt + parent::getMagicWords();
112 return $t;
113 }
114
115 function getMessage( $key ) {
116 if( isset( $this->mMessagesEt[$key] ) ) {
117 return $this->mMessagesEt[$key];
118 } else {
119 return parent::getMessage( $key );
120 }
121 }
122
123 function getAllMessages() {
124 return $this->mMessagesEt;
125 }
126
127 /**
128 * Estonian numeric formatting is 123 456,78.
129 * Notice that the space is non-breaking.
130 */
131 function separatorTransformTable() {
132 return array(',' => "\xc2\xa0", '.' => ',' );
133 }
134
135 /**
136 * Avoid grouping whole numbers between 0 to 9999
137 */
138 function commafy($_) {
139 if (!preg_match('/^\d{1,4}$/',$_)) {
140 return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
141 } else {
142 return $_;
143 }
144 }
145
146 /**
147 * @access public
148 * @param mixed $ts the time format which needs to be turned into a
149 * date('YmdHis') format with wfTimestamp(TS_MW,$ts)
150 * @param bool $adj whether to adjust the time output according to the
151 * user configured offset ($timecorrection)
152 * @param mixed $format what format to return, if it's false output the
153 * default one.
154 * @param string $timecorrection the time offset as returned by
155 * validateTimeZone() in Special:Preferences
156 * @return string
157 */
158 function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
159 global $wgAmericanDates;
160
161 if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
162
163 $datePreference = $this->dateFormat($format);
164
165 if ($datePreference == '0'
166 || $datePreference == '' ) {$datePreference = $wgAmericanDates ? '0' : '2';}
167
168 $month = $this->getMonthName( substr( $ts, 4, 2 ) );
169 $day = $this->formatNum( 0 + substr( $ts, 6, 2 ) );
170 $year = $this->formatNum( substr( $ts, 0, 4 ), true );
171 $lat_month = $this->monthByLatinNumber( substr ($ts, 4, 2));
172
173 switch( $datePreference ) {
174 case '2': return "$day. $month $year";
175 case '3': return "$day. $lat_month $year";
176 case 'ISO 8601': return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
177 default: return substr($ts, 6, 2). '.' . substr($ts, 4, 2). '.' .substr($ts, 0, 4);
178 }
179 }
180
181 /**
182 * @access public
183 * @param mixed $ts the time format which needs to be turned into a
184 * date('YmdHis') format with wfTimestamp(TS_MW,$ts)
185 * @param bool $adj whether to adjust the time output according to the
186 * user configured offset ($timecorrection)
187 * @param mixed $format what format to return, if it's false output the
188 * default one (default true)
189 * @param string $timecorrection the time offset as returned by
190 * validateTimeZone() in Special:Preferences
191 * @return string
192 */
193 function time( $ts, $adj = false, $format = true, $timecorrection = false ) {
194 global $wgUser, $wgAmericanDates;
195
196 if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
197 $datePreference = $this->dateFormat($format);
198
199 if ($datePreference == '0') {$datePreference = $wgAmericanDates ? '0' : '2';}
200
201 if ( $datePreference === 'ISO 8601' ) {
202 $t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 );
203 $t .= ':' . substr( $ts, 12, 2 );
204 } else {
205 $t = substr( $ts, 8, 2 ) . '.' . substr( $ts, 10, 2 );
206 }
207 return $t;
208 }
209
210 /**
211 * @access public
212 * @param mixed $ts the time format which needs to be turned into a
213 * date('YmdHis') format with wfTimestamp(TS_MW,$ts)
214 * @param bool $adj whether to adjust the time output according to the
215 * user configured offset ($timecorrection)
216 * @param mixed $format what format to return, if it's false output the
217 * default one (default true)
218 * @param string $timecorrection the time offset as returned by
219 * validateTimeZone() in Special:Preferences
220 * @return string
221 */
222 function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false) {
223 global $wgUser, $wgAmericanDates;
224
225 $datePreference = $this->dateFormat($format);
226 switch ( $datePreference ) {
227 case 'ISO 8601': return $this->date( $ts, $adj, $datePreference, $timecorrection ) . ' ' .
228 $this->time( $ts, $adj, $datePreference, $timecorrection );
229 default: return $this->date( $ts, $adj, $datePreference, $timecorrection ) . ', kell ' .
230 $this->time( $ts, $adj, $datePreference, $timecorrection );
231
232 }
233
234 }
235
236 /**
237 * retuns latin number corresponding to given month number
238 * @access public
239 * @param number
240 * @return string
241 */
242 function monthByLatinNumber( $key ) {
243 $latinNumbers= array(
244 'I', 'II', 'III', 'IV', 'V', 'VI',
245 'VII','VIII','IX','X','XI','XII'
246 );
247
248 return $latinNumbers[$key-1];
249 }
250
251
252 }
253 ?>