Localisation updates for core messages from translatewiki.net (2009-08-26 17:25 UTC)
[lhc/web/wiklou.git] / languages / Language.php
index 6987129..19520fa 100644 (file)
@@ -168,6 +168,9 @@ class Language {
                return $lang;
        }
 
+       /**
+        * Get the LocalisationCache instance
+        */
        public static function getLocalisationCache() {
                if ( is_null( self::$dataCache ) ) {
                        global $wgLocalisationCacheConf;
@@ -175,7 +178,7 @@ class Language {
                        self::$dataCache = new $class( $wgLocalisationCacheConf );
                }
                return self::$dataCache;
-       }               
+       }
 
        function __construct() {
                $this->mConverter = new FakeConverter($this);
@@ -1464,8 +1467,17 @@ class Language {
        }
 
        function iconv( $in, $out, $string ) {
-               # For most languages, this is a wrapper for iconv
-               return iconv( $in, $out . '//IGNORE', $string );
+               # This is a wrapper for iconv in all languages except esperanto,
+               # which does some nasty x-conversions beforehand
+
+               # Even with //IGNORE iconv can whine about illegal characters in
+               # *input* string. We just ignore those too.
+               # REF: http://bugs.php.net/bug.php?id=37166
+               # REF: https://bugzilla.wikimedia.org/show_bug.cgi?id=16885
+               wfSuppressWarnings();
+               $text = iconv( $in, $out . '//IGNORE', $string );
+               wfRestoreWarnings();
+               return $text;
        }
 
        // callback functions for uc(), lc(), ucwords(), ucwordbreaks()
@@ -1851,6 +1863,38 @@ class Language {
        function isRTL() { 
                return self::$dataCache->getItem( $this->mCode, 'rtl' );
        }
+       
+       /**
+        * Return the correct HTML 'dir' attribute value for this language.
+        * @return String
+        */
+       function getDir() {
+               return $this->isRTL() ? 'rtl' : 'ltr';
+       }
+       
+       /**
+        * Return 'left' or 'right' as appropriate alignment for line-start
+        * for this language's text direction.
+        *
+        * Should be equivalent to CSS3 'start' text-align value....
+        *
+        * @return String
+        */
+       function alignStart() {
+               return $this->isRTL() ? 'right' : 'left';
+       }
+       
+       /**
+        * Return 'right' or 'left' as appropriate alignment for line-end
+        * for this language's text direction.
+        *
+        * Should be equivalent to CSS3 'end' text-align value....
+        *
+        * @return String
+        */
+       function alignEnd() {
+               return $this->isRTL() ? 'left' : 'right';
+       }
 
        /**
         * A hidden direction mark (LRM or RLM), depending on the language direction
@@ -1888,7 +1932,7 @@ class Language {
        }
 
        # Fill a MagicWord object with data from here
-       function getMagic( &$mw ) {
+       function getMagic( $mw ) {
                if ( !$this->mMagicHookDone ) {
                        $this->mMagicHookDone = true;
                        wfRunHooks( 'LanguageGetMagic', array( &$this->mMagicExtensions, $this->getCode() ) );
@@ -2289,8 +2333,8 @@ class Language {
 
        /**
         * Perform output conversion on a string, and encode for safe HTML output.
-        * @param $text String
-        * @param $isTitle Bool -- wtf?
+        * @param $text String text to be converted
+        * @param $isTitle Bool whether this conversion is for the article title
         * @return string
         * @todo this should get integrated somewhere sane
         */