cleaned up
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 20 Sep 2004 11:16:56 +0000 (11:16 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 20 Sep 2004 11:16:56 +0000 (11:16 +0000)
languages/LanguageNv.php

index 10ee560..e21f637 100755 (executable)
@@ -1,16 +1,14 @@
 <?php
 
-require_once( "LanguageUtf8.php" );
+# Navajo language file
+# No messages at the moment, just all the other stuff
 
-# The names of the namespaces can be set here, but the numbers
-# are magical, so don't change or move them!  The Namespace class
-# encapsulates some of the magic-ness.
-#
+require_once( "LanguageUtf8.php" );
 
 if($wgMetaNamespace === FALSE)
        $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
 
-/* private */ $wgNamespaceNamesnv = array(
+/* private */ $wgNamespaceNamesNv = array(
        NS_MEDIA            => 'Media',
        NS_SPECIAL          => 'Special',
        NS_MAIN             => '',
@@ -31,7 +29,7 @@ if($wgMetaNamespace === FALSE)
        NS_CATEGORY_TALK    => 'T\'ááłáhági_át\'éego_baa_yinísht\'į́'
 );
 
-/* private */ $wgDefaultUserOptionsnv = array(
+/* private */ $wgDefaultUserOptionsNv = array(
        'quickbar' => 1, 'underline' => 1, 'hover' => 1,
        'cols' => 80, 'rows' => 25, 'searchlimit' => 20,
        'contextlines' => 5, 'contextchars' => 50,
@@ -42,11 +40,11 @@ if($wgMetaNamespace === FALSE)
        'date' => 0
 );
 
-/* private */ $wgQuickbarSettingsnv = array(
+/* private */ $wgQuickbarSettingsNv = array(
        'None', 'Fixed left', 'Fixed right', 'Floating left'
 );
 
-/* private */ $wgSkinNamesnv = array(
+/* private */ $wgSkinNamesNv = array(
        'standard' => 'Standard',
        'nostalgia' => 'Nostalgia',
        'cologneblue' => 'Cologne Blue',
@@ -56,14 +54,7 @@ if($wgMetaNamespace === FALSE)
  'myskin' => 'MySkin'
 );
 
-define( "MW_MATH_PNG",    0 );
-define( "MW_MATH_SIMPLE", 1 );
-define( "MW_MATH_HTML",   2 );
-define( "MW_MATH_SOURCE", 3 );
-define( "MW_MATH_MODERN", 4 );
-define( "MW_MATH_MATHML", 5 );
-
-/* private */ $wgMathNamesnv = array(
+/* private */ $wgMathNamesNv = array(
        MW_MATH_PNG => 'Always render PNG',
        MW_MATH_SIMPLE => 'HTML if very simple or else PNG',
        MW_MATH_HTML => 'HTML if possible or else PNG',
@@ -72,7 +63,7 @@ define( "MW_MATH_MATHML", 5 );
        MW_MATH_MATHML => 'MathML if possible (experimental)',
 );
 
-/* private */ $wgDateFormatsnv = array(
+/* private */ $wgDateFormatsNv = array(
        'No preference',
        'Yas Niłt\'ees 15, 2001',
        '15 Yas Niłt\'ees 2001',
@@ -80,7 +71,7 @@ define( "MW_MATH_MATHML", 5 );
        '2001-01-15'
 );
 
-/* private */ $wgUserTogglesnv = array(
+/* private */ $wgUserTogglesNv = array(
        'hover'         => 'Show hoverbox over wiki links',
        'underline' => 'Biyaadi iissoh',
        'highlightbroken' => 'Format broken links <a href="" class="new">like
@@ -102,7 +93,7 @@ this</a> (alternative: like this<a href="" class="internal">?</a>).',
        'nocache' => 'Naaltsoos doo nooh yishchí da'
 );
 
-/* private */ $wgBookstoreListnv = array(
+/* private */ $wgBookstoreListNv = array(
        "AddALL" => "http://www.addall.com/New/Partner.cgi?query=$1&type=ISBN",
        "PriceSCAN" => "http://www.pricescan.com/books/bookDetail.asp?isbn=$1",
        "Barnes & Noble" => "http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=$1",
@@ -110,29 +101,18 @@ this</a> (alternative: like this<a href="" class="internal">?</a>).',
        //"ISBN" => "$1"
 );
 
-# Read language names
-global $wgLanguageNames;
-require_once( "Names.php" );
-
-$wgLanguageNamesnv =& $wgLanguageNames;
-
-
-/* private */ $wgWeekdayNamesnv = array(
+/* private */ $wgWeekdayNamesNv = array(
        'Damóogo', 'Damóo biiskání', 'Damóodóó naakiską́o', 'Damóodóó tágí jį́', 'Damóodóó dį́į́\' yiską́o',
        'Nda\'iiníísh', 'Yiską́ damóo'
 );
 
-/* private */ $wgWeekdayAbbreviationsJa = array(
-        "Dam", "Dm1", "Dm2", "Dm3", "Dm4", "Nda", "Ysk"
-);
-
-/* private */ $wgMonthNamesnv = array(
+/* private */ $wgMonthNamesNv = array(
        'Yas Niłt\'ees', 'Atsá Biyáázh', 'Wóózhch\'į́į́d', 'T\'ą́ą́chil', 'T\'ą́ą́tsoh', 'Ya\'iishjááshchilí',
        'Ya\'iishjáástsoh', 'Bini\'ant\'ą́ą́ts\'ózí', 'Bini\'ant\'ą́ą́tsoh', 'Ghąąjį', 'Níłch\'its\'ósí',
        'Níłch\'itsoh'
 );
 
-/* private */ $wgMonthAbbreviationsnv = array(
+/* private */ $wgMonthAbbreviationsNv = array(
        'Ynts', 'Atsb', 'Wozh', 'Tchi', 'Ttso', 'Yjsh', 'Yjts', 'Btsz',
        'Btsx', 'Ghąj', 'Ntss', 'Ntsx'
 );
@@ -141,7 +121,7 @@ $wgLanguageNamesnv =& $wgLanguageNames;
 #   Please include the English words as synonyms.  This allows people
 #   from other wikis to contribute more easily.
 #
-/* private */ $wgMagicWordsnv = array(
+/* private */ $wgMagicWordsNv = array(
 #   ID                                 CASE  SYNONYMS
     MAG_REDIRECT             => array( 0,    '#redirect'              ),
     MAG_NOTOC                => array( 0,    '__NOTOC__'              ),
@@ -156,8 +136,8 @@ $wgLanguageNamesnv =& $wgLanguageNames;
     MAG_CURRENTTIME          => array( 1,    'CURRENTTIME'            ),
     MAG_NUMBEROFARTICLES     => array( 1,    'NUMBEROFARTICLES'       ),
     MAG_CURRENTMONTHNAMEGEN  => array( 1,    'CURRENTMONTHNAMEGEN'    ),
-               MAG_PAGENAME             => array( 1,    'PAGENAME'               ),
-               MAG_NAMESPACE            => array( 1,    'NAMESPACE'              ),
+       MAG_PAGENAME             => array( 1,    'PAGENAME'               ),
+       MAG_NAMESPACE            => array( 1,    'NAMESPACE'              ),
        MAG_MSG                  => array( 0,    'MSG:'                   ),
        MAG_SUBST                => array( 0,    'SUBST:'                 ),
     MAG_MSGNW                => array( 0,    'MSGNW:'                 ),
@@ -168,7 +148,7 @@ $wgLanguageNamesnv =& $wgLanguageNames;
     MAG_IMG_NONE             => array( 1,    'none'                   ),
     MAG_IMG_WIDTH            => array( 1,    '$1px'                   ),
     MAG_IMG_CENTER           => array( 1,    'center', 'centre'       ),
-    MAG_IMG_FRAMED          => array( 1,    'framed', 'enframed', 'frame' ),
+    MAG_IMG_FRAMED           => array( 1,    'framed', 'enframed', 'frame' ),
     MAG_INT                  => array( 0,    'INT:'                   ),
     MAG_SITENAME             => array( 1,    'SITENAME'               ),
     MAG_NS                   => array( 0,    'NS:'                    ),
@@ -197,82 +177,60 @@ $wgLanguageNamesnv =& $wgLanguageNames;
 # Internationalisation code
 #--------------------------------------------------------------------------
 
-class Language {
-       function Language(){
-               # Copies any missing values in the specified arrays from En to the current language
-               $fillin = array( 'wgSysopSpecialPages', 'wgValidSpecialPages', 'wgDeveloperSpecialPages' );
-               $name = get_class( $this );
-               if( strpos( $name, 'language' ) == 0){
-                       $lang = ucfirst( substr( $name, 8 ) );
-                       foreach( $fillin as $arrname ){
-                               $langver = "{$arrname}{$lang}";
-                               $enver = "{$arrname}En";
-                               if( ! isset( $GLOBALS[$langver] ) || ! isset( $GLOBALS[$enver] ))
-                                       continue;
-                               foreach($GLOBALS[$enver] as $spage => $text){
-                                       if( ! isset( $GLOBALS[$langver][$spage] ) )
-                                               $GLOBALS[$langver][$spage] = $text;
-                               }
-                       }
-               }
-       }
+class LanguageNv extends LanguageUtf8 {
 
        function getDefaultUserOptions () {
-               global $wgDefaultUserOptionsnv ;
-               return $wgDefaultUserOptionsnv ;
+               global $wgDefaultUserOptionsNv ;
+               return $wgDefaultUserOptionsNv ;
        }
 
        function getBookstoreList () {
-               global $wgBookstoreListnv ;
-               return $wgBookstoreListnv ;
+               global $wgBookstoreListNv ;
+               return $wgBookstoreListNv ;
        }
 
        function getNamespaces() {
-               global $wgNamespaceNamesnv;
-               return $wgNamespaceNamesnv;
+               global $wgNamespaceNamesNv;
+               return $wgNamespaceNamesNv;
        }
 
        function getNsText( $index ) {
-               global $wgNamespaceNamesnv;
-               return $wgNamespaceNamesnv[$index];
+               global $wgNamespaceNamesNv;
+               return $wgNamespaceNamesNv[$index];
        }
 
        function getNsIndex( $text ) {
-               global $wgNamespaceNamesnv;
+               global $wgNamespaceNamesNv;
 
-               foreach ( $wgNamespaceNamesnv as $i => $n ) {
+               foreach ( $wgNamespaceNamesNv as $i => $n ) {
                        if ( 0 == strcasecmp( $n, $text ) ) { return $i; }
                }
                return false;
        }
 
-       function specialPage( $name ) {
-               return $this->getNsText( Namespace::getSpecial() ) . ':' . $name;
-       }
-
        function getQuickbarSettings() {
-               global $wgQuickbarSettingsnv;
-               return $wgQuickbarSettingsnv;
+               global $wgQuickbarSettingsNv;
+               return $wgQuickbarSettingsNv;
        }
 
        function getSkinNames() {
-               global $wgSkinNamesnv;
-               return $wgSkinNamesnv;
+               global $wgSkinNamesNv;
+               return $wgSkinNamesNv;
        }
 
        function getMathNames() {
-               global $wgMathNamesnv;
-               return $wgMathNamesnv;
+               global $wgMathNamesNv;
+               return $wgMathNamesNv;
        }
 
        function getDateFormats() {
-               global $wgDateFormatsnv;
-               return $wgDateFormatsnv;
+               global $wgDateFormatsNv;
+               return $wgDateFormatsNv;
        }
 
        function getUserToggles() {
-               global $wgUserTogglesnv;
-               return $wgUserTogglesnv;
+               global $wgUserTogglesNv;
+               return $wgUserTogglesNv;
        }
 
        function getUserToggle( $tog ) {
@@ -280,23 +238,10 @@ class Language {
                return $togs[$tog];
        }
 
-       function getLanguageNames() {
-               global $wgLanguageNamesnv;
-               return $wgLanguageNamesnv;
-       }
-
-       function getLanguageName( $code ) {
-               global $wgLanguageNamesnv;
-               if ( ! array_key_exists( $code, $wgLanguageNamesnv ) ) {
-                       return "";
-               }
-               return $wgLanguageNamesnv[$code];
-       }
-
        function getMonthName( $key )
        {
-               global $wgMonthNamesnv;
-               return $wgMonthNamesnv[$key-1];
+               global $wgMonthNamesNv;
+               return $wgMonthNamesNv[$key-1];
        }
 
        /* by default we just return base form */
@@ -307,264 +252,53 @@ class Language {
 
        function getMonthAbbreviation( $key )
        {
-               global $wgMonthAbbreviationsnv;
-               return @$wgMonthAbbreviationsnv[$key-1];
+               global $wgMonthAbbreviationsNv;
+               return @$wgMonthAbbreviationsNv[$key-1];
        }
 
        function getWeekdayName( $key )
        {
-               global $wgWeekdayNamesnv;
-               return $wgWeekdayNamesnv[$key-1];
-       }
-
-       function userAdjust( $ts )
-       {
-               global $wgUser, $wgLocalTZoffset;
-
-               $tz = $wgUser->getOption( 'timecorrection' );
-               if ( $tz === '' ) {
-                       $hrDiff = isset( $wgLocalTZoffset ) ? $wgLocalTZoffset : 0;
-                       $minDiff = 0;
-               } elseif ( strpos( $tz, ":" ) !== false ) {
-                       $tzArray = explode( ":", $tz );
-                       $hrDiff = intval($tzArray[0]);
-                       $minDiff = intval($hrDiff < 0 ? -$tzArray[1] : $tzArray[1]);
-               } else {
-                       $hrDiff = intval( $tz );
-               }
-               if ( 0 == $hrDiff && 0 == $minDiff ) { return $ts; }
-
-               $t = mktime( (
-                 (int)substr( $ts, 8, 2) ) + $hrDiff, # Hours
-                 (int)substr( $ts, 10, 2 ) + $minDiff, # Minutes
-                 (int)substr( $ts, 12, 2 ), # Seconds
-                 (int)substr( $ts, 4, 2 ), # Month
-                 (int)substr( $ts, 6, 2 ), # Day
-                 (int)substr( $ts, 0, 4 ) ); #Year
-               return date( 'YmdHis', $t );
-       }
-
-       function date( $ts, $adj = false )
-       {
-               global $wgAmericanDates, $wgUser, $wgUseDynamicDates;
-
-               if ( $adj ) { $ts = $this->userAdjust( $ts ); }
-
-               if ( $wgUseDynamicDates ) {
-                       $datePreference = $wgUser->getOption( 'date' );
-                       if ( $datePreference == 0 ) {
-                               $datePreference = $wgAmericanDates ? 1 : 2;
-                       }
-               } else {
-                       $datePreference = $wgAmericanDates ? 1 : 2;
-               }
-
-               $month = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) );
-               $day = $this->formatNum( 0 + substr( $ts, 6, 2 ) );
-               $year = $this->formatNum( substr( $ts, 0, 4 ) );
-
-               switch( $datePreference ) {
-                       case 1: return "$month $day, $year";
-                       case 2: return "$day $month $year";
-                       default: return "$year $month $day";
-               }
-       }
-
-       function time( $ts, $adj = false, $seconds = false )
-       {
-               if ( $adj ) { $ts = $this->userAdjust( $ts ); }
-
-               $t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 );
-               if ( $seconds ) {
-                       $t .= ':' . substr( $ts, 12, 2 );
-               }
-               return $this->formatNum( $t );
-       }
-
-       function timeanddate( $ts, $adj = false )
-       {
-               return $this->time( $ts, $adj ) . ', ' . $this->date( $ts, $adj );
-       }
-
-       function rfc1123( $ts )
-       {
-               return date( 'D, d M Y H:i:s T', $ts );
+               global $wgWeekdayNamesNv;
+               return $wgWeekdayNamesNv[$key-1];
        }
 
        function getValidSpecialPages()
        {
-               global $wgValidSpecialPagesnv;
-               return $wgValidSpecialPagesnv;
+               global $wgValidSpecialPagesNv;
+               return $wgValidSpecialPagesNv;
        }
 
        function getSysopSpecialPages()
        {
-               global $wgSysopSpecialPagesnv;
-               return $wgSysopSpecialPagesnv;
+               global $wgSysopSpecialPagesNv;
+               return $wgSysopSpecialPagesNv;
        }
 
        function getDeveloperSpecialPages()
        {
-               global $wgDeveloperSpecialPagesnv;
-               return $wgDeveloperSpecialPagesnv;
+               global $wgDeveloperSpecialPagesNv;
+               return $wgDeveloperSpecialPagesNv;
        }
 
+/*
        function getMessage( $key )
        {
-               global $wgAllMessagesnv;
-               return @$wgAllMessagesnv[$key];
+               global $wgAllMessagesNv;
+               return @$wgAllMessagesNv[$key];
        }
 
        function getAllMessages()
        {
-               global $wgAllMessagesnv;
-               return $wgAllMessagesnv;
+               global $wgAllMessagesNv;
+               return $wgAllMessagesNv;
        }
-
-       function iconv( $in, $out, $string ) {
-               # For most languages, this is a wrapper for iconv
-               return iconv( $in, $out, $string );
-       }
-
-       function ucfirst( $string ) {
-               # For most languages, this is a wrapper for ucfirst()
-               return ucfirst( $string );
-       }
-
-       function lcfirst( $s ) {
-               return strtolower( $s{0}  ). substr( $s, 1 );
-       }
-
-       function checkTitleEncoding( $s ) {
-        global $wgInputEncoding;
-
-        # Check for UTF-8 URLs; Internet Explorer produces these if you
-               # type non-ASCII chars in the URL bar or follow unescaped links.
-        $ishigh = preg_match( '/[\x80-\xff]/', $s);
-               $isutf = ($ishigh ? preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
-                '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ) : true );
-
-               if( ($wgInputEncoding != 'utf-8') and $ishigh and $isutf )
-                       return @iconv( 'UTF-8', $wgInputEncoding, $s );
-
-               if( ($wgInputEncoding == 'utf-8') and $ishigh and !$isutf )
-                       return utf8_encode( $s );
-
-               # Other languages can safely leave this function, or replace
-               # it with one to detect and convert another legacy encoding.
-               return $s;
-       }
-
-       function stripForSearch( $in ) {
-               # Some languages have special punctuation to strip out
-               # or characters which need to be converted for MySQL's
-               # indexing to grok it correctly. Make such changes here.
-               return $in;
-       }
-
-       function firstChar( $s ) {
-               # Get the first character of a string. In ASCII, return
-               # first byte of the string. UTF8 and others have to
-               # overload this.
-               return $s[0];
-       }
-
-       function setAltEncoding() {
-               # Some languages may have an alternate char encoding option
-               # (Esperanto X-coding, Japanese furigana conversion, etc)
-               # If 'altencoding' is checked in user prefs, this gives a
-               # chance to swap out the default encoding settings.
-               #global $wgInputEncoding, $wgOutputEncoding, $wgEditEncoding;
-       }
-
-       function recodeForEdit( $s ) {
-               # For some languages we'll want to explicitly specify
-               # which characters make it into the edit box raw
-               # or are converted in some way or another.
-               # Note that if wgOutputEncoding is different from
-               # wgInputEncoding, this text will be further converted
-               # to wgOutputEncoding.
-               global $wgInputEncoding, $wgEditEncoding;
-               if( $wgEditEncoding == '' or
-                 $wgEditEncoding == $wgInputEncoding ) {
-                       return $s;
-               } else {
-                       return $this->iconv( $wgInputEncoding, $wgEditEncoding, $s );
-               }
-       }
-
-       function recodeInput( $s ) {
-               # Take the previous into account.
-               global $wgInputEncoding, $wgOutputEncoding, $wgEditEncoding;
-               if($wgEditEncoding != "") {
-                       $enc = $wgEditEncoding;
-               } else {
-                       $enc = $wgOutputEncoding;
-               }
-               if( $enc == $wgInputEncoding ) {
-                       return $s;
-               } else {
-                       return $this->iconv( $enc, $wgInputEncoding, $s );
-               }
-       }
-
-       # For right-to-left language support
-       function isRTL() { return false; }
-
-       # To allow "foo[[bar]]" to extend the link over the whole word "foobar"
-       function linkPrefixExtension() { return false; }
-
+*/
 
        function &getMagicWords()
        {
-               global $wgMagicWordsnv;
-               return $wgMagicWordsnv;
-       }
-
-       # Fill a MagicWord object with data from here
-       function getMagic( &$mw )
-       {
-               $raw =& $this->getMagicWords();
-               if( !isset( $raw[$mw->mId] ) ) {
-                       # Fall back to English if local list is incomplete
-                       $raw =& Language::getMagicWords();
-               }
-               $rawEntry = $raw[$mw->mId];
-               $mw->mCaseSensitive = $rawEntry[0];
-               $mw->mSynonyms = array_slice( $rawEntry, 1 );
-       }
-
-       # Italic is unsuitable for some languages
-       function emphasize( $text )
-       {
-               return '<em>'.$text.'</em>';
-       }
-
-
-       # Normally we use the plain ASCII digits. Some languages such as Arabic will
-       # want to output numbers using script-appropriate characters: override this
-       # function with a translator. See LanguageAr.php for an example.
-       function formatNum( $number ) {
-               return $number;
-       }
-
-        function listToText( $l ) {
-               $s = '';
-               $m = count($l) - 1;
-               for ($i = $m; $i >= 0; $i--) {
-                   if ($i == $m) {
-                       $s = $l[$i];
-                   } else if ($i == $m - 1) {
-                       $s = $l[$i] . ' ' . $this->getMessage('and') . ' ' . $s;
-                   } else {
-                       $s = $l[$i] . ', ' . $s;
-                   }
-               }
-               return $s;
+               global $wgMagicWordsNv;
+               return $wgMagicWordsNv;
        }
 }
 
-# This should fail gracefully if there's not a localization available
-@include_once( 'Language' . ucfirst( $wgLanguageCode ) . '.php' );
 ?>
-