http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90951

Revision: 90951
Author:   demon
Date:     2011-06-28 12:00:04 +0000 (Tue, 28 Jun 2011)
Log Message:
-----------
Revert r86623: merging Serbian language improvements to trunk. Per CR: this 
needs some tests, and I really don't know what's going on here well enough to 
write them :)

Modified Paths:
--------------
    trunk/phase3/languages/LanguageConverter.php
    trunk/phase3/languages/classes/LanguageSr.php

Modified: trunk/phase3/languages/LanguageConverter.php
===================================================================
--- trunk/phase3/languages/LanguageConverter.php        2011-06-28 10:42:32 UTC 
(rev 90950)
+++ trunk/phase3/languages/LanguageConverter.php        2011-06-28 12:00:04 UTC 
(rev 90951)
@@ -322,11 +322,6 @@
                        }
                }
 
-               if( $this->guessVariant( $text, $toVariant ) ) {
-                       wfProfileOut( __METHOD__ );
-                       return $text;
-               }
-
                /* we convert everything except:
                   1. HTML markups (anything between < and >)
                   2. HTML entities
@@ -576,7 +571,7 @@
         */
        public function convertTo( $text, $variant ) {
                global $wgDisableLangConversion;
-               if ( $wgDisableLangConversion || $this->guessVariant( $text, 
$variant ) ) {
+               if ( $wgDisableLangConversion ) {
                        return $text;
                }
                return $this->recursiveConvertTopLevel( $text, $variant );
@@ -778,20 +773,6 @@
        }
 
        /**
-        * Guess if a text is written in a variant. This should be implemented 
in subclasses.
-        *
-        * @param string        $text the text to be checked
-        * @param string        $variant language code of the variant to be 
checked for
-        * @return bool true if $text appears to be written in $variant, false 
if not
-        *
-        * @author Nikola Smolenski <[email protected]>
-        * @since 1.18
-        */
-       public function guessVariant($text, $variant) {
-               return false;
-       }
-
-       /**
         * Load default conversion tables.
         * This method must be implemented in derived class.
         *

Modified: trunk/phase3/languages/classes/LanguageSr.php
===================================================================
--- trunk/phase3/languages/classes/LanguageSr.php       2011-06-28 10:42:32 UTC 
(rev 90950)
+++ trunk/phase3/languages/classes/LanguageSr.php       2011-06-28 12:00:04 UTC 
(rev 90951)
@@ -173,30 +173,6 @@
 
                return $ret;
        }
-
-       /**
-        * Guess if a text is written in Cyrillic or Latin.
-        *
-        * @author Nikola Smolenski <[email protected]>
-        * @since 1.18
-        *
-        * @param $text string
-        * @param $variant string
-        *
-        * @return bool
-        */
-       public function guessVariant( $text, $variant ) {
-               $numCyrillic = preg_match_all("/[шђчћжШЂЧЋЖ]/u", $text, $dummy);
-               $numLatin = preg_match_all("/[šđč枊ĐČĆŽ]/u", $text, $dummy);
-
-               if( $variant == 'sr-ec' ) {
-                       return $numCyrillic > $numLatin;
-               } elseif( $variant == 'sr-el' ) {
-                       return $numLatin > $numCyrillic;
-               } else {
-                       return false;
-               }
-       }
 }
 
 /**
@@ -257,5 +233,4 @@
                        }
                }
        }
-
 }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to