r90951 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90950‎ | r90951 | r90952 >
Date:12:00, 28 June 2011
Author:demon
Status:ok
Tags:needs-php-test 
Comment:
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 (modified) (history)
  • /trunk/phase3/languages/classes/LanguageSr.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/LanguageConverter.php
@@ -322,11 +322,6 @@
323323 }
324324 }
325325
326 - if( $this->guessVariant( $text, $toVariant ) ) {
327 - wfProfileOut( __METHOD__ );
328 - return $text;
329 - }
330 -
331326 /* we convert everything except:
332327 1. HTML markups (anything between < and >)
333328 2. HTML entities
@@ -576,7 +571,7 @@
577572 */
578573 public function convertTo( $text, $variant ) {
579574 global $wgDisableLangConversion;
580 - if ( $wgDisableLangConversion || $this->guessVariant( $text, $variant ) ) {
 575+ if ( $wgDisableLangConversion ) {
581576 return $text;
582577 }
583578 return $this->recursiveConvertTopLevel( $text, $variant );
@@ -778,20 +773,6 @@
779774 }
780775
781776 /**
782 - * Guess if a text is written in a variant. This should be implemented in subclasses.
783 - *
784 - * @param string $text the text to be checked
785 - * @param string $variant language code of the variant to be checked for
786 - * @return bool true if $text appears to be written in $variant, false if not
787 - *
788 - * @author Nikola Smolenski <smolensk@eunet.rs>
789 - * @since 1.18
790 - */
791 - public function guessVariant($text, $variant) {
792 - return false;
793 - }
794 -
795 - /**
796777 * Load default conversion tables.
797778 * This method must be implemented in derived class.
798779 *
Index: trunk/phase3/languages/classes/LanguageSr.php
@@ -173,30 +173,6 @@
174174
175175 return $ret;
176176 }
177 -
178 - /**
179 - * Guess if a text is written in Cyrillic or Latin.
180 - *
181 - * @author Nikola Smolenski <smolensk@eunet.rs>
182 - * @since 1.18
183 - *
184 - * @param $text string
185 - * @param $variant string
186 - *
187 - * @return bool
188 - */
189 - public function guessVariant( $text, $variant ) {
190 - $numCyrillic = preg_match_all("/[шђчћжШЂЧЋЖ]/u", $text, $dummy);
191 - $numLatin = preg_match_all("/[šđč枊ĐČĆŽ]/u", $text, $dummy);
192 -
193 - if( $variant == 'sr-ec' ) {
194 - return $numCyrillic > $numLatin;
195 - } elseif( $variant == 'sr-el' ) {
196 - return $numLatin > $numCyrillic;
197 - } else {
198 - return false;
199 - }
200 - }
201177 }
202178
203179 /**
@@ -257,5 +233,4 @@
258234 }
259235 }
260236 }
261 -
262237 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86623(bug 28643) Merge Serbian language variant conversion improvements to trunk (...demon14:02, 21 April 2011

Status & tagging log