* (bug 6480) Updates to German localisation
[lhc/web/wiklou.git] / languages / Language.php
index a6ba219..c528066 100644 (file)
@@ -62,6 +62,7 @@ if(isset($wgExtraNamespaces)) {
        'math'                  => 1,
        'rcdays'                => 7,
        'rclimit'               => 50,
+       'wllimit'               => 250,
        'highlightbroken'       => 1,
        'stubthreshold'         => 0,
        'previewontop'          => 1,
@@ -84,6 +85,7 @@ if(isset($wgExtraNamespaces)) {
        'showjumplinks'         => 1,
        'numberheadings'        => 0,
        'uselivepreview'        => 0,
+       'watchlistdays'         => 3.0,
 );
 
 /* private */ $wgQuickbarSettingsEn = array(
@@ -120,7 +122,7 @@ if(isset($wgExtraNamespaces)) {
  * The array keys make up the set of formats which this language allows
  * the user to select. It's exposed via Language::getDateFormats().
  *
- * @access private
+ * @private
  */
 $wgDateFormatsEn = array(
        MW_DATE_DEFAULT => 'No preference',
@@ -134,6 +136,7 @@ $wgDateFormatsEn = array(
        'highlightbroken',
        'justify',
        'hideminor',
+       'extendwatchlist',
        'usenewrc',
        'numberheadings',
        'showtoolbar',
@@ -161,6 +164,8 @@ $wgDateFormatsEn = array(
        'uselivepreview',
        'autopatrol',
        'forceeditsummary',
+       'watchlisthideown',
+       'watchlisthidebots',
 );
 
 /* private */ $wgBookstoreListEn = array(
@@ -208,6 +213,7 @@ $wgLanguageNamesEn =& $wgLanguageNames;
 #   ID                                 CASE  SYNONYMS
        MAG_REDIRECT             => array( 0,    '#REDIRECT'              ),
        MAG_NOTOC                => array( 0,    '__NOTOC__'              ),
+       MAG_NOGALLERY                    => array( 0,    '__NOGALLERY__'          ),
        MAG_FORCETOC             => array( 0,    '__FORCETOC__'           ),
        MAG_TOC                  => array( 0,    '__TOC__'                ),
        MAG_NOEDITSECTION        => array( 0,    '__NOEDITSECTION__'      ),
@@ -221,24 +227,28 @@ $wgLanguageNamesEn =& $wgLanguageNames;
        MAG_CURRENTDAYNAME       => array( 1,    'CURRENTDAYNAME'         ),
        MAG_CURRENTYEAR          => array( 1,    'CURRENTYEAR'            ),
        MAG_CURRENTTIME          => array( 1,    'CURRENTTIME'            ),
+       MAG_NUMBEROFPAGES        => array( 1,    'NUMBEROFPAGES'          ),
        MAG_NUMBEROFARTICLES     => array( 1,    'NUMBEROFARTICLES'       ),
        MAG_NUMBEROFFILES        => array( 1,    'NUMBEROFFILES'          ),
+       MAG_NUMBEROFUSERS        => array( 1,    'NUMBEROFUSERS'          ),
        MAG_PAGENAME             => array( 1,    'PAGENAME'               ),
        MAG_PAGENAMEE            => array( 1,    'PAGENAMEE'              ),
        MAG_NAMESPACE            => array( 1,    'NAMESPACE'              ),
        MAG_NAMESPACEE           => array( 1,    'NAMESPACEE'             ),
-       MAG_TALKSPACE                    => array( 1,    'TALKSPACE'                      ),
-       MAG_TALKSPACEE                   => array( 1,    'TALKSPACEE'                     ),
-       MAG_SUBJECTSPACE                 => array( 1,    'SUBJECTSPACE', 'ARTICLESPACE' ),
-       MAG_SUBJECTSPACEE                => array( 1,    'SUBJECTSPACEE', 'ARTICLESPACEE' ),
+       MAG_TALKSPACE            => array( 1,    'TALKSPACE'              ),
+       MAG_TALKSPACEE           => array( 1,    'TALKSPACEE'              ),
+       MAG_SUBJECTSPACE         => array( 1,    'SUBJECTSPACE', 'ARTICLESPACE' ),
+       MAG_SUBJECTSPACEE        => array( 1,    'SUBJECTSPACEE', 'ARTICLESPACEE' ),
        MAG_FULLPAGENAME         => array( 1,    'FULLPAGENAME'           ),
        MAG_FULLPAGENAMEE        => array( 1,    'FULLPAGENAMEE'          ),
-       MAG_SUBPAGENAME          => array( 1,    'SUBPAGENAME'                    ),
-       MAG_SUBPAGENAMEE                 => array( 1,    'SUBPAGENAMEE'                   ),
-       MAG_TALKPAGENAME                 => array( 1,    'TALKPAGENAME'                   ),
-       MAG_TALKPAGENAMEE                => array( 1,    'TALKPAGENAMEE'                  ),
-       MAG_SUBJECTPAGENAME              => array( 1,    'SUBJECTPAGENAME', 'ARTICLEPAGENAME' ),
-       MAG_SUBJECTPAGENAMEE     => array( 1,    'SUBJECTPAGENAMEE', 'ARTICLEPAGENAMEE' ),
+       MAG_SUBPAGENAME          => array( 1,    'SUBPAGENAME'            ),
+       MAG_SUBPAGENAMEE         => array( 1,    'SUBPAGENAMEE'           ),
+       MAG_BASEPAGENAME         => array( 1,    'BASEPAGENAME'           ),
+       MAG_BASEPAGENAMEE        => array( 1,    'BASEPAGENAMEE'          ),
+       MAG_TALKPAGENAME         => array( 1,    'TALKPAGENAME'           ),
+       MAG_TALKPAGENAMEE        => array( 1,    'TALKPAGENAMEE'          ),
+       MAG_SUBJECTPAGENAME      => array( 1,    'SUBJECTPAGENAME', 'ARTICLEPAGENAME' ),
+       MAG_SUBJECTPAGENAMEE     => array( 1,    'SUBJECTPAGENAMEE', 'ARTICLEPAGENAMEE' ),
        MAG_MSG                  => array( 0,    'MSG:'                   ),
        MAG_SUBST                => array( 0,    'SUBST:'                 ),
        MAG_MSGNW                => array( 0,    'MSGNW:'                 ),
@@ -274,6 +284,16 @@ $wgLanguageNamesEn =& $wgLanguageNames;
        MAG_UC                   => array( 0,    'UC:'                    ),
        MAG_RAW                  => array( 0,    'RAW:'                   ),
        MAG_DISPLAYTITLE         => array( 1,    'DISPLAYTITLE'           ),
+       MAG_RAWSUFFIX            => array( 1,    'R'                      ),
+       MAG_NEWSECTIONLINK       => array( 1,    '__NEWSECTIONLINK__'     ),
+       MAG_CURRENTVERSION       => array( 1,    'CURRENTVERSION'         ),
+       MAG_URLENCODE            => array( 0,    'URLENCODE:'             ),
+       MAG_CURRENTTIMESTAMP     => array( 1,    'CURRENTTIMESTAMP'       ),
+       MAG_DIRECTIONMARK        => array( 1,    'DIRECTIONMARK', 'DIRMARK' ),
+       MAG_LANGUAGE                     => array( 0,    '#LANGUAGE:' ),
+       MAG_CONTENTLANGUAGE              => array( 1,    'CONTENTLANGUAGE', 'CONTENTLANG' ),
+       MAG_PAGESINNAMESPACE     => array( 1,    'PAGESINNAMESPACE:', 'PAGESINNS:' ),
+       MAG_NUMBEROFADMINS               => array( 1,    'NUMBEROFADMINS' ),
 );
 
 if (!$wgCachedMessageArrays) {
@@ -302,25 +322,7 @@ class fakeConverter {
 
 class Language {
        var $mConverter;
-       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;
-                               }
-                       }
-               }
+       function __construct() {
                $this->mConverter = new fakeConverter($this);
        }
 
@@ -502,9 +504,10 @@ class Language {
 
        /**
         * Used by date() and time() to adjust the time output.
-        * @access public
+        * @public
         * @param int   $ts the time in date('YmdHis') format
-        * @param mixed $tz adjust the time by this amount (default false)
+        * @param mixed $tz adjust the time by this amount (default false,
+        *                  mean we get user timecorrection setting)
         * @return int
 
         */
@@ -515,9 +518,16 @@ class Language {
                        $tz = $wgUser->getOption( 'timecorrection' );
                }
 
+               # minutes and hours differences:
+               $minDiff = 0;
+               $hrDiff  = 0;
+
                if ( $tz === '' ) {
-                       $hrDiff = isset( $wgLocalTZoffset ) ? $wgLocalTZoffset : 0;
-                       $minDiff = 0;
+                       # Global offset in minutes.
+                       if( isset($wgLocalTZoffset) ) {
+                               $hrDiff = $wgLocalTZoffset % 60;
+                               $minDiff = $wgLocalTZoffset - ($hrDiff * 60);
+                       }
                } elseif ( strpos( $tz, ':' ) !== false ) {
                        $tzArray = explode( ':', $tz );
                        $hrDiff = intval($tzArray[0]);
@@ -525,8 +535,11 @@ class Language {
                } else {
                        $hrDiff = intval( $tz );
                }
+
+               # No difference ? Return time unchanged
                if ( 0 == $hrDiff && 0 == $minDiff ) { return $ts; }
 
+               # Generate an adjusted date
                $t = mktime( (
                  (int)substr( $ts, 8, 2) ) + $hrDiff, # Hours
                  (int)substr( $ts, 10, 2 ) + $minDiff, # Minutes
@@ -576,7 +589,7 @@ class Language {
        }
 
        /**
-        * @access public
+        * @public
         * @param mixed  $ts the time format which needs to be turned into a
         *               date('YmdHis') format with wfTimestamp(TS_MW,$ts)
         * @param bool   $adj whether to adjust the time output according to the
@@ -609,7 +622,7 @@ class Language {
        }
 
        /**
-       * @access public
+       * @public
        * @param mixed  $ts the time format which needs to be turned into a
        *               date('YmdHis') format with wfTimestamp(TS_MW,$ts)
        * @param bool   $adj whether to adjust the time output according to the
@@ -625,16 +638,20 @@ class Language {
                if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
                $datePreference = $this->dateFormat( $format );
 
-               $sep = ($datePreference == MW_DATE_ISO)
-                       ? ':'
-                       : $this->timeSeparator( $format );
+               $sep = $this->timeSeparator( $format );
 
-               $t = substr( $ts, 8, 2 ) . $sep . substr( $ts, 10, 2 );
+               $hh = substr( $ts, 8, 2 );
+               $mm = substr( $ts, 10, 2 );
+               $ss = substr( $ts, 12, 2 );
 
-               if ( $datePreference == MW_DATE_ISO ) {
-                       $t .= $sep . substr( $ts, 12, 2 );
+               if ( $datePreference != MW_DATE_ISO ) {
+                       $hh = $this->formatNum( $hh, true );
+                       $mm = $this->formatNum( $mm, true );
+                       //$ss = $this->formatNum( $ss, true );
+                       return $hh . $sep . $mm;
+               } else {
+                       return $hh . ':' . $mm . ':' . $ss;
                }
-               return $t;
        }
 
        /**
@@ -659,7 +676,7 @@ class Language {
        /**
         * Return true if the time should display before the date.
         * @return bool
-        * @access private
+        * @private
         */
        function timeBeforeDate() {
                return true;
@@ -670,11 +687,11 @@ class Language {
        }
 
        function formatDay( $day, $format ) {
-               return $this->formatNum( 0 + $day );
+               return $this->formatNum( 0 + $day, true );
        }
 
        /**
-       * @access public
+       * @public
        * @param mixed  $ts the time format which needs to be turned into a
        *               date('YmdHis') format with wfTimestamp(TS_MW,$ts)
        * @param bool   $adj whether to adjust the time output according to the
@@ -839,6 +856,13 @@ class Language {
         */
        function isRTL() { return false; }
 
+       /**
+        * A hidden direction mark (LRM or RLM), depending on the language direction
+        *
+        * @return string
+        */
+       function getDirMark() { return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E"; }
+
        /**
         * To allow "foo[[bar]]" to extend the link over the whole word "foobar"
         *
@@ -846,7 +870,6 @@ class Language {
         */
        function linkPrefixExtension() { return false; }
 
-
        function &getMagicWords() {
                global $wgMagicWordsEn;
                return $wgMagicWordsEn;
@@ -856,7 +879,7 @@ class Language {
        function getMagic( &$mw ) {
                $raw = $this->getMagicWords();
 
-               wfRunHooks( 'LanguageGetMagic', array( &$raw ) );
+               wfRunHooks( 'LanguageGetMagic', array( &$raw, $this->getCode() ) );
 
                if( !isset( $raw[$mw->mId] ) ) {
                        # Fall back to English if local list is incomplete
@@ -870,7 +893,7 @@ class Language {
        /**
         * Italic is unsuitable for some languages
         *
-        * @access public
+        * @public
         *
         * @param string $text The text to be emphasized.
         * @return string
@@ -879,10 +902,7 @@ class Language {
                return "<em>$text</em>";
        }
 
-       /**
-        * This function enables formatting of numbers, it should only come
-        * into effect when the $wgTranslateNumerals variable is TRUE.
-        *
+        /**
         * Normally we output all numbers in plain en_US style, that is
         * 293,291.235 for twohundredninetythreethousand-twohundredninetyone
         * point twohundredthirtyfive. However this is not sutable for all
@@ -900,14 +920,26 @@ class Language {
         *
         * @todo check if it's viable to use localeconv() for the decimal
         *       seperator thing.
-        * @access public
+        * @public
         * @param mixed $number the string to be formatted, should be an integer or
         *        a floating point number.
-        * @param bool $year are we being passed a year? (turns off commafication)
-        * @return mixed whatever we're fed if it's a year, a string otherwise.
+        * @param bool $nocommafy Set to true for special numbers like dates
+        * @return string
         */
-       function formatNum( $number, $year = false ) {
-               return $year ? $number : $this->commafy($number);
+       function formatNum( $number, $nocommafy = false ) {
+               global $wgTranslateNumerals;
+               if (!$nocommafy) {
+                       $number = $this->commafy($number);
+                       $s = $this->separatorTransformTable();
+                       if (!is_null($s)) { $number = strtr($number, $s); }
+               }
+
+               if ($wgTranslateNumerals) {
+                       $s = $this->digitTransformTable();
+                       if (!is_null($s)) { $number = strtr($number, $s); }
+               }
+
+               return $number;
        }
 
        /**
@@ -920,6 +952,15 @@ class Language {
                return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
        }
 
+       function digitTransformTable() {
+               return null;
+       }
+
+       function separatorTransformTable() {
+               return null;
+       }
+
+
        /**
         * For the credit list in includes/Credits.php (action=credits)
         *
@@ -973,6 +1014,10 @@ class Language {
         * @return string
         */
        function convertGrammar( $word, $case ) {
+               global $wgGrammarForms;
+               if ( isset($wgGrammarForms['en'][$case][$word]) ) {
+                       return $wgGrammarForms['en'][$case][$word];
+               }
                return $word;
        }
 
@@ -1103,7 +1148,7 @@ class Language {
         * for example, the preferred language variant
         *
         * @return string
-        * @access public
+        * @public
         */
        function getExtraHashOptions() {
                return $this->mConverter->getExtraHashOptions();
@@ -1136,7 +1181,7 @@ class Language {
         * which should be merged onto a link of the form [[foo]]bar.
         *
         * @return string
-        * @access public
+        * @public
         */
        function linkTrail() {
                return $this->getMessage( 'linktrail' );