favicon fix
[lhc/web/wiklou.git] / languages / Language.php
index fc893c0..a32b374 100644 (file)
@@ -244,7 +244,7 @@ class Language {
         * @return string
         */
        function getVariantname( $code ) {
-               return wfMsg( "variantname-$code" );
+               return $this->getMessageFromDB( "variantname-$code" );
        }
 
        function specialPage( $name ) {
@@ -276,6 +276,11 @@ class Language {
                return $this->dateFormats;
        }
 
+       function getDefaultDateFormat() {
+               $this->load();
+               return $this->defaultDateFormat;
+       }
+
        function getDatePreferenceMigrationMap() {
                $this->load();
                return $this->datePreferenceMigrationMap;
@@ -292,7 +297,7 @@ class Language {
        }
 
        function getUserToggle( $tog ) {
-               return wfMsg( "tog-$tog" );
+               return $this->getMessageFromDB( "tog-$tog" );
        }
 
        /**
@@ -320,8 +325,8 @@ class Language {
        }
 
        /**
-        * Ugly hack to get a message maybe from the MediaWiki namespace, if this 
-        * language object is the content or user language. 
+        * Ugly hack to get a message maybe from the MediaWiki namespace, if this
+        * language object is the content or user language.
         */
        function getMessageFromDB( $msg ) {
                global $wgContLang, $wgLang;
@@ -760,7 +765,7 @@ class Language {
        }
 
        function isMultibyte( $str ) {
-               return (bool)preg_match( '/^[\x80-\xff]/', $str );
+               return (bool)preg_match( '/[\x80-\xff]/', $str );
        }
 
        function checkTitleEncoding( $s ) {
@@ -884,16 +889,27 @@ class Language {
         *
         * @return string
         */
-       function getDirMark() { return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E"; }
+       function getDirMark() {
+               return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E";
+       }
+
+       /**
+        * An arrow, depending on the language direction
+        *
+        * @return string
+        */
+       function getArrow() {
+               return $this->isRTL() ? '←' : '→';
+       }
 
        /**
         * To allow "foo[[bar]]" to extend the link over the whole word "foobar"
         *
         * @return bool
         */
-       function linkPrefixExtension() { 
+       function linkPrefixExtension() {
                $this->load();
-               return $this->linkPrefixExtension; 
+               return $this->linkPrefixExtension;
        }
 
        function &getMagicWords() {
@@ -1010,7 +1026,7 @@ class Language {
                        if ($i == $m) {
                                $s = $l[$i];
                        } else if ($i == $m - 1) {
-                               $s = $l[$i] . ' ' . wfMsg('and') . ' ' . $s;
+                               $s = $l[$i] . ' ' . $this->getMessageFromDB( 'and' ) . ' ' . $s;
                        } else {
                                $s = $l[$i] . ', ' . $s;
                        }
@@ -1101,7 +1117,7 @@ class Language {
         */
        function translateBlockExpiry( $str ) {
 
-               $scBlockExpiryOptions = wfMsg( 'ipboptions' );
+               $scBlockExpiryOptions = $this->getMessageFromDB( 'ipboptions' );
 
                if ( $scBlockExpiryOptions == '-') {
                        return $str;
@@ -1346,7 +1362,7 @@ class Language {
                                throw new MWException( "Error: Circular fallback reference in language code $code" );
                        }
                        $recursionGuard[$code] = true;
-                       $newDeps = self::loadLocalisation( $fallback );
+                       $newDeps = self::loadLocalisation( $fallback, $disableCache );
                        unset( $recursionGuard[$code] );
 
                        $secondary = self::$mLocalisationCache[$fallback];
@@ -1428,6 +1444,14 @@ class Language {
                return self::$mLocalisationCache[$code]['messages'];
        }
 
+       /** 
+        * Get a message for a given language
+        */
+       static function getMessageFor( $key, $code ) {
+               self::loadLocalisation( $code );
+               return @self::$mLocalisationCache[$code]['messages'][$key];
+       }
+
        /**
         * Load localisation data for this object
         */
@@ -1524,6 +1548,4 @@ class Language {
        }
 }
 
-/** @deprecated */
-class LanguageUtf8 extends Language {}
 ?>