r5325 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5324‎ | r5325 | r5326 >
Date:11:17, 20 September 2004
Author:timstarling
Status:old
Tags:
Comment:
cleaned up
Modified paths:
  • /branches/REL1_3/phase3/languages/LanguageNv.php (modified) (history)

Diff [purge]

Index: branches/REL1_3/phase3/languages/LanguageNv.php
@@ -1,16 +1,14 @@
22 <?php
33
 4+# Navajo language file
 5+# No messages at the moment, just all the other stuff
 6+
47 require_once( "LanguageUtf8.php" );
58
6 -# The names of the namespaces can be set here, but the numbers
7 -# are magical, so don't change or move them! The Namespace class
8 -# encapsulates some of the magic-ness.
9 -#
10 -
119 if($wgMetaNamespace === FALSE)
1210 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
1311
14 -/* private */ $wgNamespaceNamesnv = array(
 12+/* private */ $wgNamespaceNamesNv = array(
1513 NS_MEDIA => 'Media',
1614 NS_SPECIAL => 'Special',
1715 NS_MAIN => '',
@@ -31,7 +29,7 @@
3230 NS_CATEGORY_TALK => 'T\'ááłáhági_át\'éego_baa_yinísht\'į́'
3331 );
3432
35 -/* private */ $wgDefaultUserOptionsnv = array(
 33+/* private */ $wgDefaultUserOptionsNv = array(
3634 'quickbar' => 1, 'underline' => 1, 'hover' => 1,
3735 'cols' => 80, 'rows' => 25, 'searchlimit' => 20,
3836 'contextlines' => 5, 'contextchars' => 50,
@@ -42,11 +40,11 @@
4341 'date' => 0
4442 );
4543
46 -/* private */ $wgQuickbarSettingsnv = array(
 44+/* private */ $wgQuickbarSettingsNv = array(
4745 'None', 'Fixed left', 'Fixed right', 'Floating left'
4846 );
4947
50 -/* private */ $wgSkinNamesnv = array(
 48+/* private */ $wgSkinNamesNv = array(
5149 'standard' => 'Standard',
5250 'nostalgia' => 'Nostalgia',
5351 'cologneblue' => 'Cologne Blue',
@@ -56,14 +54,7 @@
5755 'myskin' => 'MySkin'
5856 );
5957
60 -define( "MW_MATH_PNG", 0 );
61 -define( "MW_MATH_SIMPLE", 1 );
62 -define( "MW_MATH_HTML", 2 );
63 -define( "MW_MATH_SOURCE", 3 );
64 -define( "MW_MATH_MODERN", 4 );
65 -define( "MW_MATH_MATHML", 5 );
66 -
67 -/* private */ $wgMathNamesnv = array(
 58+/* private */ $wgMathNamesNv = array(
6859 MW_MATH_PNG => 'Always render PNG',
6960 MW_MATH_SIMPLE => 'HTML if very simple or else PNG',
7061 MW_MATH_HTML => 'HTML if possible or else PNG',
@@ -72,7 +63,7 @@
7364 MW_MATH_MATHML => 'MathML if possible (experimental)',
7465 );
7566
76 -/* private */ $wgDateFormatsnv = array(
 67+/* private */ $wgDateFormatsNv = array(
7768 'No preference',
7869 'Yas Niłt\'ees 15, 2001',
7970 '15 Yas Niłt\'ees 2001',
@@ -80,7 +71,7 @@
8172 '2001-01-15'
8273 );
8374
84 -/* private */ $wgUserTogglesnv = array(
 75+/* private */ $wgUserTogglesNv = array(
8576 'hover' => 'Show hoverbox over wiki links',
8677 'underline' => 'Biyaadi iissoh',
8778 'highlightbroken' => 'Format broken links <a href="" class="new">like
@@ -102,7 +93,7 @@
10394 'nocache' => 'Naaltsoos doo nooh yishchí da'
10495 );
10596
106 -/* private */ $wgBookstoreListnv = array(
 97+/* private */ $wgBookstoreListNv = array(
10798 "AddALL" => "http://www.addall.com/New/Partner.cgi?query=$1&type=ISBN",
10899 "PriceSCAN" => "http://www.pricescan.com/books/bookDetail.asp?isbn=$1",
109100 "Barnes & Noble" => "http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=$1",
@@ -110,29 +101,18 @@
111102 //"ISBN" => "$1"
112103 );
113104
114 -# Read language names
115 -global $wgLanguageNames;
116 -require_once( "Names.php" );
117 -
118 -$wgLanguageNamesnv =& $wgLanguageNames;
119 -
120 -
121 -/* private */ $wgWeekdayNamesnv = array(
 105+/* private */ $wgWeekdayNamesNv = array(
122106 'Damóogo', 'Damóo biiskání', 'Damóodóó naakiską́o', 'Damóodóó tágí jį́', 'Damóodóó dį́į́\' yiską́o',
123107 'Nda\'iiníísh', 'Yiską́ damóo'
124108 );
125109
126 -/* private */ $wgWeekdayAbbreviationsJa = array(
127 - "Dam", "Dm1", "Dm2", "Dm3", "Dm4", "Nda", "Ysk"
128 -);
129 -
130 -/* private */ $wgMonthNamesnv = array(
 110+/* private */ $wgMonthNamesNv = array(
131111 'Yas Niłt\'ees', 'Atsá Biyáázh', 'Wóózhch\'į́į́d', 'T\'ą́ą́chil', 'T\'ą́ą́tsoh', 'Ya\'iishjááshchilí',
132112 'Ya\'iishjáástsoh', 'Bini\'ant\'ą́ą́ts\'ózí', 'Bini\'ant\'ą́ą́tsoh', 'Ghąąjį', 'Níłch\'its\'ósí',
133113 'Níłch\'itsoh'
134114 );
135115
136 -/* private */ $wgMonthAbbreviationsnv = array(
 116+/* private */ $wgMonthAbbreviationsNv = array(
137117 'Ynts', 'Atsb', 'Wozh', 'Tchi', 'Ttso', 'Yjsh', 'Yjts', 'Btsz',
138118 'Btsx', 'Ghąj', 'Ntss', 'Ntsx'
139119 );
@@ -141,7 +121,7 @@
142122 # Please include the English words as synonyms. This allows people
143123 # from other wikis to contribute more easily.
144124 #
145 -/* private */ $wgMagicWordsnv = array(
 125+/* private */ $wgMagicWordsNv = array(
146126 # ID CASE SYNONYMS
147127 MAG_REDIRECT => array( 0, '#redirect' ),
148128 MAG_NOTOC => array( 0, '__NOTOC__' ),
@@ -156,8 +136,8 @@
157137 MAG_CURRENTTIME => array( 1, 'CURRENTTIME' ),
158138 MAG_NUMBEROFARTICLES => array( 1, 'NUMBEROFARTICLES' ),
159139 MAG_CURRENTMONTHNAMEGEN => array( 1, 'CURRENTMONTHNAMEGEN' ),
160 - MAG_PAGENAME => array( 1, 'PAGENAME' ),
161 - MAG_NAMESPACE => array( 1, 'NAMESPACE' ),
 140+ MAG_PAGENAME => array( 1, 'PAGENAME' ),
 141+ MAG_NAMESPACE => array( 1, 'NAMESPACE' ),
162142 MAG_MSG => array( 0, 'MSG:' ),
163143 MAG_SUBST => array( 0, 'SUBST:' ),
164144 MAG_MSGNW => array( 0, 'MSGNW:' ),
@@ -168,7 +148,7 @@
169149 MAG_IMG_NONE => array( 1, 'none' ),
170150 MAG_IMG_WIDTH => array( 1, '$1px' ),
171151 MAG_IMG_CENTER => array( 1, 'center', 'centre' ),
172 - MAG_IMG_FRAMED => array( 1, 'framed', 'enframed', 'frame' ),
 152+ MAG_IMG_FRAMED => array( 1, 'framed', 'enframed', 'frame' ),
173153 MAG_INT => array( 0, 'INT:' ),
174154 MAG_SITENAME => array( 1, 'SITENAME' ),
175155 MAG_NS => array( 0, 'NS:' ),
@@ -197,82 +177,60 @@
198178 # Internationalisation code
199179 #--------------------------------------------------------------------------
200180
201 -class Language {
202 - function Language(){
203 - # Copies any missing values in the specified arrays from En to the current language
204 - $fillin = array( 'wgSysopSpecialPages', 'wgValidSpecialPages', 'wgDeveloperSpecialPages' );
205 - $name = get_class( $this );
206 - if( strpos( $name, 'language' ) == 0){
207 - $lang = ucfirst( substr( $name, 8 ) );
208 - foreach( $fillin as $arrname ){
209 - $langver = "{$arrname}{$lang}";
210 - $enver = "{$arrname}En";
211 - if( ! isset( $GLOBALS[$langver] ) || ! isset( $GLOBALS[$enver] ))
212 - continue;
213 - foreach($GLOBALS[$enver] as $spage => $text){
214 - if( ! isset( $GLOBALS[$langver][$spage] ) )
215 - $GLOBALS[$langver][$spage] = $text;
216 - }
217 - }
218 - }
219 - }
 181+class LanguageNv extends LanguageUtf8 {
220182
221183 function getDefaultUserOptions () {
222 - global $wgDefaultUserOptionsnv ;
223 - return $wgDefaultUserOptionsnv ;
 184+ global $wgDefaultUserOptionsNv ;
 185+ return $wgDefaultUserOptionsNv ;
224186 }
225187
226188 function getBookstoreList () {
227 - global $wgBookstoreListnv ;
228 - return $wgBookstoreListnv ;
 189+ global $wgBookstoreListNv ;
 190+ return $wgBookstoreListNv ;
229191 }
230192
231193 function getNamespaces() {
232 - global $wgNamespaceNamesnv;
233 - return $wgNamespaceNamesnv;
 194+ global $wgNamespaceNamesNv;
 195+ return $wgNamespaceNamesNv;
234196 }
235197
236198 function getNsText( $index ) {
237 - global $wgNamespaceNamesnv;
238 - return $wgNamespaceNamesnv[$index];
 199+ global $wgNamespaceNamesNv;
 200+ return $wgNamespaceNamesNv[$index];
239201 }
240202
241203 function getNsIndex( $text ) {
242 - global $wgNamespaceNamesnv;
 204+ global $wgNamespaceNamesNv;
243205
244 - foreach ( $wgNamespaceNamesnv as $i => $n ) {
 206+ foreach ( $wgNamespaceNamesNv as $i => $n ) {
245207 if ( 0 == strcasecmp( $n, $text ) ) { return $i; }
246208 }
247209 return false;
248210 }
249211
250 - function specialPage( $name ) {
251 - return $this->getNsText( Namespace::getSpecial() ) . ':' . $name;
252 - }
253 -
254212 function getQuickbarSettings() {
255 - global $wgQuickbarSettingsnv;
256 - return $wgQuickbarSettingsnv;
 213+ global $wgQuickbarSettingsNv;
 214+ return $wgQuickbarSettingsNv;
257215 }
258216
259217 function getSkinNames() {
260 - global $wgSkinNamesnv;
261 - return $wgSkinNamesnv;
 218+ global $wgSkinNamesNv;
 219+ return $wgSkinNamesNv;
262220 }
263221
264222 function getMathNames() {
265 - global $wgMathNamesnv;
266 - return $wgMathNamesnv;
 223+ global $wgMathNamesNv;
 224+ return $wgMathNamesNv;
267225 }
268226
269227 function getDateFormats() {
270 - global $wgDateFormatsnv;
271 - return $wgDateFormatsnv;
 228+ global $wgDateFormatsNv;
 229+ return $wgDateFormatsNv;
272230 }
273231
274232 function getUserToggles() {
275 - global $wgUserTogglesnv;
276 - return $wgUserTogglesnv;
 233+ global $wgUserTogglesNv;
 234+ return $wgUserTogglesNv;
277235 }
278236
279237 function getUserToggle( $tog ) {
@@ -280,23 +238,10 @@
281239 return $togs[$tog];
282240 }
283241
284 - function getLanguageNames() {
285 - global $wgLanguageNamesnv;
286 - return $wgLanguageNamesnv;
287 - }
288 -
289 - function getLanguageName( $code ) {
290 - global $wgLanguageNamesnv;
291 - if ( ! array_key_exists( $code, $wgLanguageNamesnv ) ) {
292 - return "";
293 - }
294 - return $wgLanguageNamesnv[$code];
295 - }
296 -
297242 function getMonthName( $key )
298243 {
299 - global $wgMonthNamesnv;
300 - return $wgMonthNamesnv[$key-1];
 244+ global $wgMonthNamesNv;
 245+ return $wgMonthNamesNv[$key-1];
301246 }
302247
303248 /* by default we just return base form */
@@ -307,264 +252,53 @@
308253
309254 function getMonthAbbreviation( $key )
310255 {
311 - global $wgMonthAbbreviationsnv;
312 - return @$wgMonthAbbreviationsnv[$key-1];
 256+ global $wgMonthAbbreviationsNv;
 257+ return @$wgMonthAbbreviationsNv[$key-1];
313258 }
314259
315260 function getWeekdayName( $key )
316261 {
317 - global $wgWeekdayNamesnv;
318 - return $wgWeekdayNamesnv[$key-1];
 262+ global $wgWeekdayNamesNv;
 263+ return $wgWeekdayNamesNv[$key-1];
319264 }
320265
321 - function userAdjust( $ts )
322 - {
323 - global $wgUser, $wgLocalTZoffset;
324 -
325 - $tz = $wgUser->getOption( 'timecorrection' );
326 - if ( $tz === '' ) {
327 - $hrDiff = isset( $wgLocalTZoffset ) ? $wgLocalTZoffset : 0;
328 - $minDiff = 0;
329 - } elseif ( strpos( $tz, ":" ) !== false ) {
330 - $tzArray = explode( ":", $tz );
331 - $hrDiff = intval($tzArray[0]);
332 - $minDiff = intval($hrDiff < 0 ? -$tzArray[1] : $tzArray[1]);
333 - } else {
334 - $hrDiff = intval( $tz );
335 - }
336 - if ( 0 == $hrDiff && 0 == $minDiff ) { return $ts; }
337 -
338 - $t = mktime( (
339 - (int)substr( $ts, 8, 2) ) + $hrDiff, # Hours
340 - (int)substr( $ts, 10, 2 ) + $minDiff, # Minutes
341 - (int)substr( $ts, 12, 2 ), # Seconds
342 - (int)substr( $ts, 4, 2 ), # Month
343 - (int)substr( $ts, 6, 2 ), # Day
344 - (int)substr( $ts, 0, 4 ) ); #Year
345 - return date( 'YmdHis', $t );
346 - }
347 -
348 - function date( $ts, $adj = false )
349 - {
350 - global $wgAmericanDates, $wgUser, $wgUseDynamicDates;
351 -
352 - if ( $adj ) { $ts = $this->userAdjust( $ts ); }
353 -
354 - if ( $wgUseDynamicDates ) {
355 - $datePreference = $wgUser->getOption( 'date' );
356 - if ( $datePreference == 0 ) {
357 - $datePreference = $wgAmericanDates ? 1 : 2;
358 - }
359 - } else {
360 - $datePreference = $wgAmericanDates ? 1 : 2;
361 - }
362 -
363 - $month = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) );
364 - $day = $this->formatNum( 0 + substr( $ts, 6, 2 ) );
365 - $year = $this->formatNum( substr( $ts, 0, 4 ) );
366 -
367 - switch( $datePreference ) {
368 - case 1: return "$month $day, $year";
369 - case 2: return "$day $month $year";
370 - default: return "$year $month $day";
371 - }
372 - }
373 -
374 - function time( $ts, $adj = false, $seconds = false )
375 - {
376 - if ( $adj ) { $ts = $this->userAdjust( $ts ); }
377 -
378 - $t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 );
379 - if ( $seconds ) {
380 - $t .= ':' . substr( $ts, 12, 2 );
381 - }
382 - return $this->formatNum( $t );
383 - }
384 -
385 - function timeanddate( $ts, $adj = false )
386 - {
387 - return $this->time( $ts, $adj ) . ', ' . $this->date( $ts, $adj );
388 - }
389 -
390 - function rfc1123( $ts )
391 - {
392 - return date( 'D, d M Y H:i:s T', $ts );
393 - }
394 -
395266 function getValidSpecialPages()
396267 {
397 - global $wgValidSpecialPagesnv;
398 - return $wgValidSpecialPagesnv;
 268+ global $wgValidSpecialPagesNv;
 269+ return $wgValidSpecialPagesNv;
399270 }
400271
401272 function getSysopSpecialPages()
402273 {
403 - global $wgSysopSpecialPagesnv;
404 - return $wgSysopSpecialPagesnv;
 274+ global $wgSysopSpecialPagesNv;
 275+ return $wgSysopSpecialPagesNv;
405276 }
406277
407278 function getDeveloperSpecialPages()
408279 {
409 - global $wgDeveloperSpecialPagesnv;
410 - return $wgDeveloperSpecialPagesnv;
 280+ global $wgDeveloperSpecialPagesNv;
 281+ return $wgDeveloperSpecialPagesNv;
411282 }
412283
 284+/*
413285 function getMessage( $key )
414286 {
415 - global $wgAllMessagesnv;
416 - return @$wgAllMessagesnv[$key];
 287+ global $wgAllMessagesNv;
 288+ return @$wgAllMessagesNv[$key];
417289 }
418290
419291 function getAllMessages()
420292 {
421 - global $wgAllMessagesnv;
422 - return $wgAllMessagesnv;
 293+ global $wgAllMessagesNv;
 294+ return $wgAllMessagesNv;
423295 }
 296+*/
424297
425 - function iconv( $in, $out, $string ) {
426 - # For most languages, this is a wrapper for iconv
427 - return iconv( $in, $out, $string );
428 - }
429 -
430 - function ucfirst( $string ) {
431 - # For most languages, this is a wrapper for ucfirst()
432 - return ucfirst( $string );
433 - }
434 -
435 - function lcfirst( $s ) {
436 - return strtolower( $s{0} ). substr( $s, 1 );
437 - }
438 -
439 - function checkTitleEncoding( $s ) {
440 - global $wgInputEncoding;
441 -
442 - # Check for UTF-8 URLs; Internet Explorer produces these if you
443 - # type non-ASCII chars in the URL bar or follow unescaped links.
444 - $ishigh = preg_match( '/[\x80-\xff]/', $s);
445 - $isutf = ($ishigh ? preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
446 - '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ) : true );
447 -
448 - if( ($wgInputEncoding != 'utf-8') and $ishigh and $isutf )
449 - return @iconv( 'UTF-8', $wgInputEncoding, $s );
450 -
451 - if( ($wgInputEncoding == 'utf-8') and $ishigh and !$isutf )
452 - return utf8_encode( $s );
453 -
454 - # Other languages can safely leave this function, or replace
455 - # it with one to detect and convert another legacy encoding.
456 - return $s;
457 - }
458 -
459 - function stripForSearch( $in ) {
460 - # Some languages have special punctuation to strip out
461 - # or characters which need to be converted for MySQL's
462 - # indexing to grok it correctly. Make such changes here.
463 - return $in;
464 - }
465 -
466 - function firstChar( $s ) {
467 - # Get the first character of a string. In ASCII, return
468 - # first byte of the string. UTF8 and others have to
469 - # overload this.
470 - return $s[0];
471 - }
472 -
473 - function setAltEncoding() {
474 - # Some languages may have an alternate char encoding option
475 - # (Esperanto X-coding, Japanese furigana conversion, etc)
476 - # If 'altencoding' is checked in user prefs, this gives a
477 - # chance to swap out the default encoding settings.
478 - #global $wgInputEncoding, $wgOutputEncoding, $wgEditEncoding;
479 - }
480 -
481 - function recodeForEdit( $s ) {
482 - # For some languages we'll want to explicitly specify
483 - # which characters make it into the edit box raw
484 - # or are converted in some way or another.
485 - # Note that if wgOutputEncoding is different from
486 - # wgInputEncoding, this text will be further converted
487 - # to wgOutputEncoding.
488 - global $wgInputEncoding, $wgEditEncoding;
489 - if( $wgEditEncoding == '' or
490 - $wgEditEncoding == $wgInputEncoding ) {
491 - return $s;
492 - } else {
493 - return $this->iconv( $wgInputEncoding, $wgEditEncoding, $s );
494 - }
495 - }
496 -
497 - function recodeInput( $s ) {
498 - # Take the previous into account.
499 - global $wgInputEncoding, $wgOutputEncoding, $wgEditEncoding;
500 - if($wgEditEncoding != "") {
501 - $enc = $wgEditEncoding;
502 - } else {
503 - $enc = $wgOutputEncoding;
504 - }
505 - if( $enc == $wgInputEncoding ) {
506 - return $s;
507 - } else {
508 - return $this->iconv( $enc, $wgInputEncoding, $s );
509 - }
510 - }
511 -
512 - # For right-to-left language support
513 - function isRTL() { return false; }
514 -
515 - # To allow "foo[[bar]]" to extend the link over the whole word "foobar"
516 - function linkPrefixExtension() { return false; }
517 -
518 -
519298 function &getMagicWords()
520299 {
521 - global $wgMagicWordsnv;
522 - return $wgMagicWordsnv;
 300+ global $wgMagicWordsNv;
 301+ return $wgMagicWordsNv;
523302 }
524 -
525 - # Fill a MagicWord object with data from here
526 - function getMagic( &$mw )
527 - {
528 - $raw =& $this->getMagicWords();
529 - if( !isset( $raw[$mw->mId] ) ) {
530 - # Fall back to English if local list is incomplete
531 - $raw =& Language::getMagicWords();
532 - }
533 - $rawEntry = $raw[$mw->mId];
534 - $mw->mCaseSensitive = $rawEntry[0];
535 - $mw->mSynonyms = array_slice( $rawEntry, 1 );
536 - }
537 -
538 - # Italic is unsuitable for some languages
539 - function emphasize( $text )
540 - {
541 - return '<em>'.$text.'</em>';
542 - }
543 -
544 -
545 - # Normally we use the plain ASCII digits. Some languages such as Arabic will
546 - # want to output numbers using script-appropriate characters: override this
547 - # function with a translator. See LanguageAr.php for an example.
548 - function formatNum( $number ) {
549 - return $number;
550 - }
551 -
552 - function listToText( $l ) {
553 - $s = '';
554 - $m = count($l) - 1;
555 - for ($i = $m; $i >= 0; $i--) {
556 - if ($i == $m) {
557 - $s = $l[$i];
558 - } else if ($i == $m - 1) {
559 - $s = $l[$i] . ' ' . $this->getMessage('and') . ' ' . $s;
560 - } else {
561 - $s = $l[$i] . ', ' . $s;
562 - }
563 - }
564 - return $s;
565 - }
566303 }
567304
568 -# This should fail gracefully if there's not a localization available
569 -@include_once( 'Language' . ucfirst( $wgLanguageCode ) . '.php' );
570305 ?>
571 -

Status & tagging log