diff options
Diffstat (limited to 'languages/classes')
41 files changed, 411 insertions, 857 deletions
diff --git a/languages/classes/LanguageAz.php b/languages/classes/LanguageAz.php index 0956dc42..48f70e85 100644 --- a/languages/classes/LanguageAz.php +++ b/languages/classes/LanguageAz.php @@ -32,7 +32,7 @@ class LanguageAz extends Language { * @param $string string * @return mixed|string */ - function ucfirst ( $string ) { + function ucfirst( $string ) { if ( $string[0] == 'i' ) { return 'İ' . substr( $string, 1 ); } else { diff --git a/languages/classes/LanguageBe_tarask.php b/languages/classes/LanguageBe_tarask.php index b781d7a6..6497b50c 100644 --- a/languages/classes/LanguageBe_tarask.php +++ b/languages/classes/LanguageBe_tarask.php @@ -46,13 +46,17 @@ class LanguageBe_tarask extends Language { * @return string */ function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } + if ( !count( $forms ) ) { + return ''; + } // If the actual number is not mentioned in the expression, then just two forms are enough: // singular for $count == 1 // plural for $count != 1 // For example, "This user belongs to {{PLURAL:$1|one group|several groups}}." - if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1]; + if ( count( $forms ) === 2 ) { + return $count == 1 ? $forms[0] : $forms[1]; + } // @todo FIXME: CLDR defines 4 plural forms instead of 3 // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html @@ -62,10 +66,10 @@ class LanguageBe_tarask extends Language { return $forms[2]; } else { switch ( $count % 10 ) { - case 1: return $forms[0]; + case 1: return $forms[0]; case 2: case 3: - case 4: return $forms[1]; + case 4: return $forms[1]; default: return $forms[2]; } } diff --git a/languages/classes/LanguageCu.php b/languages/classes/LanguageCu.php index 2016a43c..60cf2b1a 100644 --- a/languages/classes/LanguageCu.php +++ b/languages/classes/LanguageCu.php @@ -48,36 +48,19 @@ class LanguageCu extends Language { # join and array_slice instead mb_substr $ar = array(); preg_match_all( '/./us', $word, $ar ); - if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) + if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) { switch ( $case ) { case 'genitive': # родительный падеж - if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) ) - { } - elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ї' ) + if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) ) { + } elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ї' ) { $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ'; + } break; case 'accusative': # винительный падеж # stub break; } - return $word; - } - - /** - * @param $count int - * @param $forms array - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 4 ); - - switch ( $count % 10 ) { - case 1: return $forms[0]; - case 2: return $forms[1]; - case 3: - case 4: return $forms[2]; - default: return $forms[3]; } + return $word; } } diff --git a/languages/classes/LanguageEo.php b/languages/classes/LanguageEo.php index 8f843224..0e2d8b4a 100644 --- a/languages/classes/LanguageEo.php +++ b/languages/classes/LanguageEo.php @@ -78,14 +78,14 @@ class LanguageEo extends Language { * @return string */ function strrtuxCallback( $matches ) { - static $ux = array ( - 'x' => 'xx' , 'X' => 'Xx' , - "\xc4\x88" => "Cx" , "\xc4\x89" => "cx" , - "\xc4\x9c" => "Gx" , "\xc4\x9d" => "gx" , - "\xc4\xa4" => "Hx" , "\xc4\xa5" => "hx" , - "\xc4\xb4" => "Jx" , "\xc4\xb5" => "jx" , - "\xc5\x9c" => "Sx" , "\xc5\x9d" => "sx" , - "\xc5\xac" => "Ux" , "\xc5\xad" => "ux" + static $ux = array( + 'x' => 'xx', 'X' => 'Xx', + "\xc4\x88" => "Cx", "\xc4\x89" => "cx", + "\xc4\x9c" => "Gx", "\xc4\x9d" => "gx", + "\xc4\xa4" => "Hx", "\xc4\xa5" => "hx", + "\xc4\xb4" => "Jx", "\xc4\xb5" => "jx", + "\xc5\x9c" => "Sx", "\xc5\x9d" => "sx", + "\xc5\xac" => "Ux", "\xc5\xad" => "ux", ); return strtr( $matches[1], $ux ); } @@ -95,49 +95,25 @@ class LanguageEo extends Language { * @return string */ function strrtxuCallback( $matches ) { - static $xu = array ( - 'xx' => 'x' , 'xX' => 'x' , - 'Xx' => 'X' , 'XX' => 'X' , - "Cx" => "\xc4\x88" , "CX" => "\xc4\x88" , - "cx" => "\xc4\x89" , "cX" => "\xc4\x89" , - "Gx" => "\xc4\x9c" , "GX" => "\xc4\x9c" , - "gx" => "\xc4\x9d" , "gX" => "\xc4\x9d" , - "Hx" => "\xc4\xa4" , "HX" => "\xc4\xa4" , - "hx" => "\xc4\xa5" , "hX" => "\xc4\xa5" , - "Jx" => "\xc4\xb4" , "JX" => "\xc4\xb4" , - "jx" => "\xc4\xb5" , "jX" => "\xc4\xb5" , - "Sx" => "\xc5\x9c" , "SX" => "\xc5\x9c" , - "sx" => "\xc5\x9d" , "sX" => "\xc5\x9d" , - "Ux" => "\xc5\xac" , "UX" => "\xc5\xac" , - "ux" => "\xc5\xad" , "uX" => "\xc5\xad" + static $xu = array( + 'xx' => 'x', 'xX' => 'x', + 'Xx' => 'X', 'XX' => 'X', + "Cx" => "\xc4\x88", "CX" => "\xc4\x88", + "cx" => "\xc4\x89", "cX" => "\xc4\x89", + "Gx" => "\xc4\x9c", "GX" => "\xc4\x9c", + "gx" => "\xc4\x9d", "gX" => "\xc4\x9d", + "Hx" => "\xc4\xa4", "HX" => "\xc4\xa4", + "hx" => "\xc4\xa5", "hX" => "\xc4\xa5", + "Jx" => "\xc4\xb4", "JX" => "\xc4\xb4", + "jx" => "\xc4\xb5", "jX" => "\xc4\xb5", + "Sx" => "\xc5\x9c", "SX" => "\xc5\x9c", + "sx" => "\xc5\x9d", "sX" => "\xc5\x9d", + "Ux" => "\xc5\xac", "UX" => "\xc5\xac", + "ux" => "\xc5\xad", "uX" => "\xc5\xad", ); return strtr( $matches[1], $xu ) . strtr( $matches[2], $xu ); } - /** - * @param $s string - * @return string - */ - function checkTitleEncoding( $s ) { - # Check for X-system backwards-compatibility URLs - $ishigh = preg_match( '/[\x80-\xff]/', $s ); - $isutf = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' . - '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ); - - if ( $ishigh and !$isutf ) { - # Assume Latin1 - $s = utf8_encode( $s ); - } else { - if ( preg_match( '/(\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]' . - '|\xc5[\x9c\x9d\xac\xad])/', $s ) ) - return $s; - } - - // if( preg_match( '/[cghjsu]x/i', $s ) ) - // return $this->iconv( 'x', 'utf-8', $s ); - return $s; - } - function initEncoding() { global $wgEditEncoding; $wgEditEncoding = 'x'; diff --git a/languages/classes/LanguageTl.php b/languages/classes/LanguageEs.php index 15bce760..f55c2e43 100644 --- a/languages/classes/LanguageTl.php +++ b/languages/classes/LanguageEs.php @@ -1,6 +1,6 @@ <?php /** - * Tagalog (Tagalog) specific code. + * Spanish (español) specific code. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,23 +22,21 @@ */ /** - * Tagalog (Tagalog) + * Spanish (español) * * @ingroup Language */ -class LanguageTl extends Language { +class LanguageEs extends Language { + /** - * Use singular form for zero - * - * @param $count int - * @param $forms array - * + * @param $_ string * @return string */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 2 ); - - return ( $count <= 1 ) ? $forms[0] : $forms[1]; + function commafy( $_ ) { + if ( !preg_match( '/^-?\d{1,4}(\.\d+)?$/', $_ ) ) { + return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) ); + } else { + return $_; + } } } diff --git a/languages/classes/LanguageFi.php b/languages/classes/LanguageFi.php index 6a2820d1..ee1d1b52 100644 --- a/languages/classes/LanguageFi.php +++ b/languages/classes/LanguageFi.php @@ -53,12 +53,14 @@ class LanguageFi extends Language { # The general case cannot be handled without a dictionary, but there's at least one notable # special case we should check for: - if ( preg_match( '/wiki$/i', $word ) ) + if ( preg_match( '/wiki$/i', $word ) ) { $aou = false; + } # append i after final consonant - if ( preg_match( '/[bcdfghjklmnpqrstvwxz]$/i', $word ) ) + if ( preg_match( '/[bcdfghjklmnpqrstvwxz]$/i', $word ) ) { $word .= 'i'; + } switch ( $case ) { case 'genitive': diff --git a/languages/classes/LanguageGa.php b/languages/classes/LanguageGa.php index 2f58384a..339ad4de 100644 --- a/languages/classes/LanguageGa.php +++ b/languages/classes/LanguageGa.php @@ -46,19 +46,26 @@ class LanguageGa extends Language { case 'ainmlae': switch ( $word ) { case 'an Domhnach': - $word = 'Dé Domhnaigh'; break; + $word = 'Dé Domhnaigh'; + break; case 'an Luan': - $word = 'Dé Luain'; break; + $word = 'Dé Luain'; + break; case 'an Mháirt': - $word = 'Dé Mháirt'; break; + $word = 'Dé Mháirt'; + break; case 'an Chéadaoin': - $word = 'Dé Chéadaoin'; break; + $word = 'Dé Chéadaoin'; + break; case 'an Déardaoin': - $word = 'Déardaoin'; break; + $word = 'Déardaoin'; + break; case 'an Aoine': - $word = 'Dé hAoine'; break; + $word = 'Dé hAoine'; + break; case 'an Satharn': - $word = 'Dé Sathairn'; break; + $word = 'Dé Sathairn'; + break; } } return $word; diff --git a/languages/classes/LanguageGan.php b/languages/classes/LanguageGan.php index 0d652d43..d81574d1 100644 --- a/languages/classes/LanguageGan.php +++ b/languages/classes/LanguageGan.php @@ -21,8 +21,8 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); -require_once( __DIR__ . '/LanguageZh.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; +require_once __DIR__ . '/LanguageZh.php'; /** * @ingroup Language @@ -50,7 +50,7 @@ class GanConverter extends LanguageConverter { $flags, $manualLevel ); $names = array( - 'gan' => '原文', + 'gan' => '原文', 'gan-hans' => '简体', 'gan-hant' => '繁體', ); @@ -58,11 +58,11 @@ class GanConverter extends LanguageConverter { } function loadDefaultTables() { - require( __DIR__ . "/../../includes/ZhConversion.php" ); + require __DIR__ . '/../../includes/ZhConversion.php'; $this->mTables = array( 'gan-hans' => new ReplacementArray( $zh2Hans ), 'gan-hant' => new ReplacementArray( $zh2Hant ), - 'gan' => new ReplacementArray + 'gan' => new ReplacementArray ); } @@ -89,12 +89,12 @@ class LanguageGan extends LanguageZh { $variants = array( 'gan', 'gan-hans', 'gan-hant' ); $variantfallbacks = array( - 'gan' => array( 'gan-hans', 'gan-hant' ), + 'gan' => array( 'gan-hans', 'gan-hant' ), 'gan-hans' => array( 'gan' ), 'gan-hant' => array( 'gan' ), ); $ml = array( - 'gan' => 'disable', + 'gan' => 'disable', ); $this->mConverter = new GanConverter( $this, 'gan', @@ -106,28 +106,6 @@ class LanguageGan extends LanguageZh { } /** - * this should give much better diff info - * - * @param $text string - * @return string - */ - function segmentForDiff( $text ) { - return preg_replace( - "/([\\xc0-\\xff][\\x80-\\xbf]*)/e", - "' ' .\"$1\"", $text ); - } - - /** - * @param $text string - * @return string - */ - function unsegmentForDiff( $text ) { - return preg_replace( - "/ ([\\xc0-\\xff][\\x80-\\xbf]*)/e", - "\"$1\"", $text ); - } - - /** * word segmentation * * @param $string string @@ -139,15 +117,4 @@ class LanguageGan extends LanguageZh { return parent::normalizeForSearch( $string, $autoVariant ); } - /** - * @param $termsArray array - * @return array - */ - function convertForSearchResult( $termsArray ) { - $terms = implode( '|', $termsArray ); - $terms = self::convertDoubleWidth( $terms ); - $terms = implode( '|', $this->mConverter->autoConvertToAllVariants( $terms ) ); - $ret = array_unique( explode( '|', $terms ) ); - return $ret; - } } diff --git a/languages/classes/LanguageGv.php b/languages/classes/LanguageGv.php index 70b80ad6..ba8a53ce 100644 --- a/languages/classes/LanguageGv.php +++ b/languages/classes/LanguageGv.php @@ -35,7 +35,9 @@ class LanguageGv extends Language { * @return string */ function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } + if ( !count( $forms ) ) { + return ''; + } $forms = $this->preConvertPlural( $forms, 4 ); diff --git a/languages/classes/LanguageHi.php b/languages/classes/LanguageHi.php deleted file mode 100644 index 6a2302c0..00000000 --- a/languages/classes/LanguageHi.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Hindi (हिन्दी) specific code. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Language - */ - -/** - * Hindi (हिन्दी) - * - * @ingroup Language - */ -class LanguageHi extends Language { - /** - * Use singular form for zero - * - * @param $count int - * @param $forms array - * - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 2 ); - - return ( $count <= 1 ) ? $forms[0] : $forms[1]; - } -} diff --git a/languages/classes/LanguageHr.php b/languages/classes/LanguageHr.php index a0e9a87a..910bc100 100644 --- a/languages/classes/LanguageHr.php +++ b/languages/classes/LanguageHr.php @@ -34,7 +34,9 @@ class LanguageHr extends Language { * @return string */ function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } + if ( !count( $forms ) ) { + return ''; + } // @todo FIXME: CLDR defines 4 plural forms instead of 3. Plural for for decimals is missing. // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html $forms = $this->preConvertPlural( $forms, 3 ); @@ -43,10 +45,10 @@ class LanguageHr extends Language { return $forms[2]; } else { switch ( $count % 10 ) { - case 1: return $forms[0]; + case 1: return $forms[0]; case 2: case 3: - case 4: return $forms[1]; + case 4: return $forms[1]; default: return $forms[2]; } } diff --git a/languages/classes/LanguageHy.php b/languages/classes/LanguageHy.php index 50798131..24068296 100644 --- a/languages/classes/LanguageHy.php +++ b/languages/classes/LanguageHy.php @@ -49,17 +49,18 @@ class LanguageHy extends Language { # join and array_slice instead mb_substr $ar = array(); preg_match_all( '/./us', $word, $ar ); - if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) + if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) { switch ( $case ) { case 'genitive': # սեռական հոլով - if ( join( '', array_slice( $ar[0], -1 ) ) == 'ա' ) + if ( join( '', array_slice( $ar[0], -1 ) ) == 'ա' ) { $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'այի'; - elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ո' ) + } elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ո' ) { $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'ոյի'; - elseif ( join( '', array_slice( $ar[0], -4 ) ) == 'գիրք' ) + } elseif ( join( '', array_slice( $ar[0], -4 ) ) == 'գիրք' ) { $word = join( '', array_slice( $ar[0], 0, -4 ) ) . 'գրքի'; - else + } else { $word .= 'ի'; + } break; case 'dative': # Տրական հոլով # stub @@ -74,6 +75,7 @@ class LanguageHy extends Language { # stub break; } + } return $word; } diff --git a/languages/classes/LanguageIu.php b/languages/classes/LanguageIu.php index fe5cdf8d..abd2e7c8 100644 --- a/languages/classes/LanguageIu.php +++ b/languages/classes/LanguageIu.php @@ -21,7 +21,7 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; /** * Conversion script between Latin and Syllabics for Inuktitut. @@ -92,7 +92,7 @@ class IuConverter extends LanguageConverter { 'lowercase' => new ReplacementArray( $this->mUpperToLowerCaseLatin ), 'ike-cans' => new ReplacementArray( $this->mToSyllabics ), 'ike-latn' => new ReplacementArray( $this->mToLatin ), - 'iu' => new ReplacementArray() + 'iu' => new ReplacementArray() ); } @@ -144,17 +144,19 @@ class IuConverter extends LanguageConverter { * @param $ignoreOtherCond bool */ function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) { - // check for user namespace + // check for user namespace if ( is_object( $nt ) ) { $ns = $nt->getNamespace(); - if ( $ns == NS_USER || $ns == NS_USER_TALK ) + if ( $ns == NS_USER || $ns == NS_USER_TALK ) { return; + } } $oldlink = $link; parent::findVariantLink( $link, $nt, $ignoreOtherCond ); - if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) + if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) { $link = $oldlink; + } } /** @@ -168,9 +170,11 @@ class IuConverter extends LanguageConverter { */ function autoConvert( $text, $toVariant = false ) { global $wgTitle; - if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) { + if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) { $imagename = $wgTitle->getNsText(); - if ( preg_match( "/^$imagename:/", $text ) ) return $text; + if ( preg_match( "/^$imagename:/", $text ) ) { + return $text; + } } return parent::autoConvert( $text, $toVariant ); } @@ -189,7 +193,7 @@ class IuConverter extends LanguageConverter { if ( trim( $text ) ) { $this->loadTables(); // To syllabics, first translate uppercase to lowercase Latin - if($toVariant == 'ike-cans') { + if ( $toVariant == 'ike-cans' ) { $text = $this->mTables['lowercase']->replace( $text ); } $text = $this->mTables[$toVariant]->replace( $text ); diff --git a/languages/classes/LanguageKaa.php b/languages/classes/LanguageKaa.php index a397bc0f..6203b4ba 100644 --- a/languages/classes/LanguageKaa.php +++ b/languages/classes/LanguageKaa.php @@ -41,7 +41,7 @@ class LanguageKaa extends Language { function convertGrammar( $word, $case ) { global $wgGrammarForms; if ( isset( $wgGrammarForms['kaa'][$case][$word] ) ) { - return $wgGrammarForms['kaa'][$case][$word]; + return $wgGrammarForms['kaa'][$case][$word]; } /* Full code of function convertGrammar() is in development. Updates coming soon. */ return $word; @@ -54,7 +54,7 @@ class LanguageKaa extends Language { * * @return string */ - function ucfirst ( $string ) { + function ucfirst( $string ) { if ( substr( $string, 0, 1 ) === 'i' ) { return 'İ' . substr( $string, 1 ); } else { @@ -69,7 +69,7 @@ class LanguageKaa extends Language { * * @return mixed|string */ - function lcfirst ( $string ) { + function lcfirst( $string ) { if ( substr( $string, 0, 1 ) === 'I' ) { return 'ı' . substr( $string, 1 ); } else { diff --git a/languages/classes/LanguageKk.php b/languages/classes/LanguageKk.php index 6dd6959f..f96b0d92 100644 --- a/languages/classes/LanguageKk.php +++ b/languages/classes/LanguageKk.php @@ -21,8 +21,8 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); -require_once( __DIR__ . '/LanguageKk_cyrl.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; +require_once __DIR__ . '/LanguageKk_cyrl.php'; define( 'KK_C_UC', 'АӘБВГҒДЕЁЖЗИЙКҚЛМНҢОӨПРСТУҰҮФХҺЦЧШЩЪЫІЬЭЮЯ' ); # Kazakh Cyrillic uppercase define( 'KK_C_LC', 'аәбвгғдеёжзийкқлмнңоөпрстуұүфхһцчшщъыіьэюя' ); # Kazakh Cyrillic lowercase @@ -62,24 +62,24 @@ class KkConverter extends LanguageConverter { } function loadDefaultTables() { - // require( __DIR__."/../../includes/KkConversion.php" ); + // require __DIR__."/../../includes/KkConversion.php"; // Placeholder for future implementing. Remove variables declarations // after generating KkConversion.php $kk2Cyrl = array(); $kk2Latn = array(); $kk2Arab = array(); - $kk2KZ = array(); - $kk2TR = array(); - $kk2CN = array(); + $kk2KZ = array(); + $kk2TR = array(); + $kk2CN = array(); $this->mTables = array( 'kk-cyrl' => new ReplacementArray( $kk2Cyrl ), 'kk-latn' => new ReplacementArray( $kk2Latn ), 'kk-arab' => new ReplacementArray( $kk2Arab ), - 'kk-kz' => new ReplacementArray( array_merge( $kk2Cyrl, $kk2KZ ) ), - 'kk-tr' => new ReplacementArray( array_merge( $kk2Latn, $kk2TR ) ), - 'kk-cn' => new ReplacementArray( array_merge( $kk2Arab, $kk2CN ) ), - 'kk' => new ReplacementArray() + 'kk-kz' => new ReplacementArray( array_merge( $kk2Cyrl, $kk2KZ ) ), + 'kk-tr' => new ReplacementArray( array_merge( $kk2Latn, $kk2TR ) ), + 'kk-cn' => new ReplacementArray( array_merge( $kk2Arab, $kk2CN ) ), + 'kk' => new ReplacementArray() ); } @@ -173,9 +173,9 @@ class KkConverter extends LanguageConverter { # # Punctuation -> Arabic '/#|№|No\./u' => '', # ؀ '/\,/' => '،', # ، - '/;/' => '؛', # ؛ + '/;/' => '؛', # ؛ '/\?/' => '؟', # ؟ - '/%/' => '٪', # ٪ + '/%/' => '٪', # ٪ '/\*/' => '٭', # ٭ # # Digits -> Arabic '/0/' => '۰', # ۰ @@ -259,14 +259,16 @@ class KkConverter extends LanguageConverter { // check for user namespace if ( is_object( $nt ) ) { $ns = $nt->getNamespace(); - if ( $ns == NS_USER || $ns == NS_USER_TALK ) + if ( $ns == NS_USER || $ns == NS_USER_TALK ) { return; + } } $oldlink = $link; parent::findVariantLink( $link, $nt, $ignoreOtherCond ); - if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) + if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) { $link = $oldlink; + } } /** @@ -280,9 +282,11 @@ class KkConverter extends LanguageConverter { */ function autoConvert( $text, $toVariant = false ) { global $wgTitle; - if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) { + if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) { $imagename = $wgTitle->getNsText(); - if ( preg_match( "/^$imagename:/", $text ) ) return $text; + if ( preg_match( "/^$imagename:/", $text ) ) { + return $text; + } } return parent::autoConvert( $text, $toVariant ); } @@ -299,7 +303,7 @@ class KkConverter extends LanguageConverter { global $wgLanguageCode; $text = parent::translate( $text, $toVariant ); - switch( $toVariant ) { + switch ( $toVariant ) { case 'kk-cyrl': case 'kk-kz': $letters = KK_L_UC . KK_L_LC . 'ʺʹ#0123456789'; @@ -343,7 +347,7 @@ class KkConverter extends LanguageConverter { return $text; } - switch( $toVariant ) { + switch ( $toVariant ) { case 'kk-arab': case 'kk-cn': $letters = KK_C_LC . KK_C_UC/*.KK_L_LC.KK_L_UC*/; @@ -414,13 +418,13 @@ class LanguageKk extends LanguageKk_cyrl { $variants = array( 'kk', 'kk-cyrl', 'kk-latn', 'kk-arab', 'kk-kz', 'kk-tr', 'kk-cn' ); $variantfallbacks = array( - 'kk' => 'kk-cyrl', + 'kk' => 'kk-cyrl', 'kk-cyrl' => 'kk', 'kk-latn' => 'kk', 'kk-arab' => 'kk', - 'kk-kz' => 'kk-cyrl', - 'kk-tr' => 'kk-latn', - 'kk-cn' => 'kk-arab' + 'kk-kz' => 'kk-cyrl', + 'kk-tr' => 'kk-latn', + 'kk-cn' => 'kk-arab' ); $this->mConverter = new KkConverter( $this, 'kk', $variants, $variantfallbacks ); @@ -435,7 +439,7 @@ class LanguageKk extends LanguageKk_cyrl { * * @return string */ - function ucfirst ( $string ) { + function ucfirst( $string ) { $variant = $this->getPreferredVariant(); if ( ( $variant == 'kk-latn' || $variant == 'kk-tr' ) && $string[0] == 'i' ) { $string = 'İ' . substr( $string, 1 ); @@ -452,7 +456,7 @@ class LanguageKk extends LanguageKk_cyrl { * * @return string */ - function lcfirst ( $string ) { + function lcfirst( $string ) { $variant = $this->getPreferredVariant(); if ( ( $variant == 'kk-latn' || $variant == 'kk-tr' ) && $string[0] == 'I' ) { $string = 'ı' . substr( $string, 1 ); diff --git a/languages/classes/LanguageKk_cyrl.php b/languages/classes/LanguageKk_cyrl.php index 081a20f8..5a7bbf36 100644 --- a/languages/classes/LanguageKk_cyrl.php +++ b/languages/classes/LanguageKk_cyrl.php @@ -115,14 +115,14 @@ class LanguageKk_cyrl extends Language { } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "а"; } - } elseif ( in_array( $wordEnding, $secondPerson ) ) { + } elseif ( in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "ге"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "ға"; } - } elseif ( in_array( $wordEnding, $thirdPerson ) ) { - if ( in_array( $wordLastVowel, $frontVowels ) ) { + } elseif ( in_array( $wordEnding, $thirdPerson ) ) { + if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "не"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "на"; @@ -153,13 +153,13 @@ class LanguageKk_cyrl extends Language { break; case "dc31": case "possessive accusative": # täweldık + tabıs - if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { + if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "ді"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "ды"; } - } elseif ( in_array( $wordEnding, $thirdPerson ) ) { + } elseif ( in_array( $wordEnding, $thirdPerson ) ) { $word = $word . "н"; } break; @@ -181,13 +181,13 @@ class LanguageKk_cyrl extends Language { break; case "dc41": case "possessive locative": # täweldık + jatıs - if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { + if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "де"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "да"; } - } elseif ( in_array( $wordEnding, $thirdPerson ) ) { + } elseif ( in_array( $wordEnding, $thirdPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "нде"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { @@ -209,7 +209,7 @@ class LanguageKk_cyrl extends Language { } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "дан"; } - } elseif ( in_array( $wordEnding, $Nasals ) ) { + } elseif ( in_array( $wordEnding, $Nasals ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "нен"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { @@ -219,13 +219,13 @@ class LanguageKk_cyrl extends Language { break; case "dc51": case "possessive ablative": # täweldık + şığıs - if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) { + if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "нен"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "нан"; } - } elseif ( in_array( $wordEnding, $secondPerson ) ) { + } elseif ( in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "ден"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { @@ -340,14 +340,14 @@ class LanguageKk_cyrl extends Language { } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "a"; } - } elseif ( in_array( $wordEnding, $secondPerson ) ) { + } elseif ( in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "ge"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "ğa"; } - } elseif ( in_array( $wordEnding, $thirdPerson ) ) { - if ( in_array( $wordLastVowel, $frontVowels ) ) { + } elseif ( in_array( $wordEnding, $thirdPerson ) ) { + if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "ne"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "na"; @@ -378,13 +378,13 @@ class LanguageKk_cyrl extends Language { break; case "dc31": case "possessive accusative": # täweldık + tabıs - if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { + if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "di"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "dı"; } - } elseif ( in_array( $wordEnding, $thirdPerson ) ) { + } elseif ( in_array( $wordEnding, $thirdPerson ) ) { $word = $word . "n"; } break; @@ -406,13 +406,13 @@ class LanguageKk_cyrl extends Language { break; case "dc41": case "possessive locative": # täweldık + jatıs - if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { + if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "de"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "da"; } - } elseif ( in_array( $wordEnding, $thirdPerson ) ) { + } elseif ( in_array( $wordEnding, $thirdPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "nde"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { @@ -434,7 +434,7 @@ class LanguageKk_cyrl extends Language { } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "dan"; } - } elseif ( in_array( $wordEnding, $Nasals ) ) { + } elseif ( in_array( $wordEnding, $Nasals ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "nen"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { @@ -444,13 +444,13 @@ class LanguageKk_cyrl extends Language { break; case "dc51": case "possessive ablative": # täweldık + şığıs - if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) { + if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "nen"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "nan"; } - } elseif ( in_array( $wordEnding, $secondPerson ) ) { + } elseif ( in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "den"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { @@ -499,7 +499,7 @@ class LanguageKk_cyrl extends Language { // Set up some constants... // Vowels in last syllable $frontVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە" ); - $backVowels = array( "ا", "و", "ۇ", "ى" ); + $backVowels = array( "ا", "و", "ۇ", "ى" ); $allVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە", "ا", "و", "ۇ", "ى" ); // Preceding letters $Nasals = array( "م", "ن", "ڭ" ); @@ -565,14 +565,14 @@ class LanguageKk_cyrl extends Language { } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "ا"; } - } elseif ( in_array( $wordEnding, $secondPerson ) ) { + } elseif ( in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "گە"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "عا"; } - } elseif ( in_array( $wordEnding, $thirdPerson ) ) { - if ( in_array( $wordLastVowel, $frontVowels ) ) { + } elseif ( in_array( $wordEnding, $thirdPerson ) ) { + if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "نە"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "نا"; @@ -603,13 +603,13 @@ class LanguageKk_cyrl extends Language { break; case "dc31": case "possessive accusative": # täweldık + tabıs - if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { + if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "دٸ"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "دى"; } - } elseif ( in_array( $wordEnding, $thirdPerson ) ) { + } elseif ( in_array( $wordEnding, $thirdPerson ) ) { $word = $word . "ن"; } break; @@ -631,13 +631,13 @@ class LanguageKk_cyrl extends Language { break; case "dc41": case "possessive locative": # täweldık + jatıs - if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { + if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "دە"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "دا"; } - } elseif ( in_array( $wordEnding, $thirdPerson ) ) { + } elseif ( in_array( $wordEnding, $thirdPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "ندە"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { @@ -659,7 +659,7 @@ class LanguageKk_cyrl extends Language { } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "دان"; } - } elseif ( in_array( $wordEnding, $Nasals ) ) { + } elseif ( in_array( $wordEnding, $Nasals ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "نەن"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { @@ -669,13 +669,13 @@ class LanguageKk_cyrl extends Language { break; case "dc51": case "possessive ablative": # täweldık + şığıs - if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) { + if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "نەن"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { $word = $word . "نان"; } - } elseif ( in_array( $wordEnding, $secondPerson ) ) { + } elseif ( in_array( $wordEnding, $secondPerson ) ) { if ( in_array( $wordLastVowel, $frontVowels ) ) { $word = $word . "دەن"; } elseif ( in_array( $wordLastVowel, $backVowels ) ) { diff --git a/languages/classes/LanguageKsh.php b/languages/classes/LanguageKsh.php index 074ad139..09c57279 100644 --- a/languages/classes/LanguageKsh.php +++ b/languages/classes/LanguageKsh.php @@ -104,17 +104,17 @@ class LanguageKsh extends Language { # däm WikiMaatplaz sing, dä Wikipeedija ier, däm Wikiwööterbooch sing # dem/em WikiMaatplaz sing, de Wikipeedija ier, dem/em Wikiwööterbooch sing $word = ( preg_match( '/ b/', $case ) - ? ( $gender=='f' ? 'dä' : 'däm' ) - : ( $gender=='f' ? 'de' : 'dem' ) + ? ( $gender == 'f' ? 'dä' : 'däm' ) + : ( $gender == 'f' ? 'de' : 'dem' ) ) . ' ' . $word . ' ' . - ( $gender=='f' ? 'ier' : 'sing' ) . + ( $gender == 'f' ? 'ier' : 'sing' ) . ( preg_match( '/ m/', $case ) ? 'e' : '' ); } elseif ( preg_match( '/ e/', $case ) ) { # en dämm WikiMaatPlaz, en dä Wikipeedija, en dämm Wikiwööterbooch # em WikiMaatplaz, en de Wikipeedija, em Wikiwööterbooch if ( preg_match( '/ b/', $case ) ) { - $word = 'en '.( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word; + $word = 'en ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word; } else { $word = ( $gender == 'f' ? 'en de' : 'em' ) . ' ' . $word; } @@ -124,13 +124,13 @@ class LanguageKsh extends Language { if ( preg_match( '/ b/', $case ) ) { $word = 'vun ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word; } else { - $word = ( $gender== 'f' ? 'vun de' : 'vum' ) . ' ' . $word; + $word = ( $gender == 'f' ? 'vun de' : 'vum' ) . ' ' . $word; } } elseif ( preg_match( '/ [3d]/', $case ) ) { # dämm WikiMaatPlaz, dä Wikipeedija, dämm Wikiwööterbooch # dem/em WikiMaatplaz, de Wikipeedija, dem/em Wikiwööterbooch if ( preg_match( '/ b/', $case ) ) { - $word = ( $gender == 'f' ? 'dää' : 'dämm' ) .' ' . $word; + $word = ( $gender == 'f' ? 'dää' : 'dämm' ) . ' ' . $word; } else { $word = ( $gender == 'f' ? 'de' : 'dem' ) . ' ' . $word; } @@ -141,7 +141,7 @@ class LanguageKsh extends Language { switch ( $gender ) { case 'm': $lord = 'dä'; - break ; + break; case 'f': $lord = 'di'; break; @@ -160,7 +160,7 @@ class LanguageKsh extends Language { $lord = 'et'; } } - $word = $lord.' '.$word; + $word = $lord . ' ' . $word; } return $word; } @@ -189,7 +189,9 @@ class LanguageKsh extends Language { * @return string */ function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } + if ( !count( $forms ) ) { + return ''; + } $forms = $this->preConvertPlural( $forms, 3 ); if ( $count == 1 ) { diff --git a/languages/classes/LanguageKu.php b/languages/classes/LanguageKu.php index 56a52ccb..75ac1c77 100644 --- a/languages/classes/LanguageKu.php +++ b/languages/classes/LanguageKu.php @@ -21,8 +21,8 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); -require_once( __DIR__ . '/LanguageKu_ku.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; +require_once __DIR__ . '/LanguageKu_ku.php'; /** * Kurdish converter routines @@ -41,23 +41,23 @@ class KuConverter extends LanguageConverter { /* Doppel- und Halbvokale */ 'ڵ' => 'll', # ll - 'ڕ' => 'rr', # rr - 'ا' => 'a', + 'ڕ' => 'rr', # rr + 'ا' => 'a', # 'ئێ' => 'ê', # initial e - 'ە' => 'e', - 'ه' => 'e', # with one non-joiner - 'ه' => 'e', # with two non-joiner - 'ة' => 'e', + 'ە' => 'e', + 'ه' => 'e', # with one non-joiner + 'ه' => 'e', # with two non-joiner + 'ة' => 'e', 'ێ' => 'ê', - 'ي' => 'î', - 'ی' => 'î', # U+06CC db 8c ARABIC LETTER FARSI YEH - 'ى' => 'î', # U+0649 d9 89 ARABIC LETTER ALEF MAKSURA - 'ۆ' => 'o', - 'و' => 'w', - 'ئ' => '', # initial hemze should not be shown - '،' => ',', - 'ع' => '\'', # ayn - '؟' => '?', + 'ي' => 'î', + 'ی' => 'î', # U+06CC db 8c ARABIC LETTER FARSI YEH + 'ى' => 'î', # U+0649 d9 89 ARABIC LETTER ALEF MAKSURA + 'ۆ' => 'o', + 'و' => 'w', + 'ئ' => '', # initial hemze should not be shown + '،' => ',', + 'ع' => '\'', # ayn + '؟' => '?', # digits '٠' => '0', # ٠ @@ -113,13 +113,13 @@ class KuConverter extends LanguageConverter { ' o' => 'ئۆ ', ' u' => 'ئو ', ' û' => 'ئوو ', - 'A' => 'ئا', - 'E' => 'ئە', - 'Ê' => 'ئێ', - 'Î' => 'ئی', - 'O' => 'ئۆ', - 'U' => 'ئو', - 'Û' => 'ئوو', + 'A' => 'ئا', + 'E' => 'ئە', + 'Ê' => 'ئێ', + 'Î' => 'ئی', + 'O' => 'ئۆ', + 'U' => 'ئو', + 'Û' => 'ئوو', ' A' => 'ئا ', ' E' => 'ئە ', ' Ê' => 'ئێ ', @@ -149,7 +149,7 @@ class KuConverter extends LanguageConverter { $this->mTables = array( 'ku-latn' => new ReplacementArray( $this->mArabicToLatin ), 'ku-arab' => new ReplacementArray( $this->mLatinToArabic ), - 'ku' => new ReplacementArray() + 'ku' => new ReplacementArray() ); } @@ -167,14 +167,16 @@ class KuConverter extends LanguageConverter { // check for user namespace if ( is_object( $nt ) ) { $ns = $nt->getNamespace(); - if ( $ns == NS_USER || $ns == NS_USER_TALK ) + if ( $ns == NS_USER || $ns == NS_USER_TALK ) { return; + } } $oldlink = $link; parent::findVariantLink( $link, $nt, $ignoreOtherCond ); - if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) + if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) { $link = $oldlink; + } } /** @@ -188,9 +190,11 @@ class KuConverter extends LanguageConverter { */ function autoConvert( $text, $toVariant = false ) { global $wgTitle; - if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) { + if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) { $imagename = $wgTitle->getNsText(); - if ( preg_match( "/^$imagename:/", $text ) ) return $text; + if ( preg_match( "/^$imagename:/", $text ) ) { + return $text; + } } return parent::autoConvert( $text, $toVariant ); } @@ -253,7 +257,7 @@ class LanguageKu extends LanguageKu_ku { $variants = array( 'ku', 'ku-arab', 'ku-latn' ); $variantfallbacks = array( - 'ku' => 'ku-latn', + 'ku' => 'ku-latn', 'ku-arab' => 'ku-latn', 'ku-latn' => 'ku-arab', ); diff --git a/languages/classes/LanguageLa.php b/languages/classes/LanguageLa.php index ba0f1404..9c778782 100644 --- a/languages/classes/LanguageLa.php +++ b/languages/classes/LanguageLa.php @@ -49,54 +49,60 @@ class LanguageLa extends Language { switch ( $case ) { case 'genitive': // only a few declensions, and even for those mostly the singular only - $in = array( '/u[ms]$/', # 2nd declension singular - '/ommunia$/', # 3rd declension neuter plural (partly) - '/a$/', # 1st declension singular - '/libri$/', '/nuntii$/', # 2nd declension plural (partly) - '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly) - '/es$/' # 5th declension singular - ); - $out = array( 'i', - 'ommunium', - 'ae', - 'librorum', 'nuntiorum', - 'tionis', 'ntis', 'atis', - 'ei' - ); + $in = array( + '/u[ms]$/', # 2nd declension singular + '/ommunia$/', # 3rd declension neuter plural (partly) + '/a$/', # 1st declension singular + '/libri$/', '/nuntii$/', # 2nd declension plural (partly) + '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly) + '/es$/' # 5th declension singular + ); + $out = array( + 'i', + 'ommunium', + 'ae', + 'librorum', 'nuntiorum', + 'tionis', 'ntis', 'atis', + 'ei' + ); return preg_replace( $in, $out, $word ); case 'accusative': // only a few declensions, and even for those mostly the singular only - $in = array( '/u[ms]$/', # 2nd declension singular - '/a$/', # 1st declension singular - '/ommuniam$/', # 3rd declension neuter plural (partly) - '/libri$/', '/nuntii$/', # 2nd declension plural (partly) - '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly) - '/es$/' # 5th declension singular - ); - $out = array( 'um', - 'am', - 'ommunia', - 'libros', 'nuntios', - 'tionem', 'ntem', 'atem', - 'em' - ); + $in = array( + '/u[ms]$/', # 2nd declension singular + '/a$/', # 1st declension singular + '/ommuniam$/', # 3rd declension neuter plural (partly) + '/libri$/', '/nuntii$/', # 2nd declension plural (partly) + '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly) + '/es$/' # 5th declension singular + ); + $out = array( + 'um', + 'am', + 'ommunia', + 'libros', 'nuntios', + 'tionem', 'ntem', 'atem', + 'em' + ); return preg_replace( $in, $out, $word ); case 'ablative': // only a few declensions, and even for those mostly the singular only - $in = array( '/u[ms]$/', # 2nd declension singular - '/ommunia$/', # 3rd declension neuter plural (partly) - '/a$/', # 1st declension singular - '/libri$/', '/nuntii$/', # 2nd declension plural (partly) - '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly) - '/es$/' # 5th declension singular - ); - $out = array( 'o', - 'ommunibus', - 'a', - 'libris', 'nuntiis', - 'tione', 'nte', 'ate', - 'e' - ); + $in = array( + '/u[ms]$/', # 2nd declension singular + '/ommunia$/', # 3rd declension neuter plural (partly) + '/a$/', # 1st declension singular + '/libri$/', '/nuntii$/', # 2nd declension plural (partly) + '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly) + '/es$/' # 5th declension singular + ); + $out = array( + 'o', + 'ommunibus', + 'a', + 'libris', 'nuntiis', + 'tione', 'nte', 'ate', + 'e' + ); return preg_replace( $in, $out, $word ); default: return $word; diff --git a/languages/classes/LanguageMg.php b/languages/classes/LanguageMg.php deleted file mode 100644 index ace0a4c3..00000000 --- a/languages/classes/LanguageMg.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Malagasy (Malagasy) specific code. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Language - */ - -/** - * Malagasy (Malagasy) - * - * @ingroup Language - */ -class LanguageMg extends Language { - /** - * Use singular form for zero - * - * @param $count int - * @param $forms array - * - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 2 ); - - return ( $count <= 1 ) ? $forms[0] : $forms[1]; - } -} diff --git a/languages/classes/LanguageMk.php b/languages/classes/LanguageMk.php deleted file mode 100644 index 968fe265..00000000 --- a/languages/classes/LanguageMk.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Macedonian (Македонски) specific code. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Language - */ - -/** - * Macedonian (Македонски) - * - * @ingroup Language - */ -class LanguageMk extends Language { - /** - * Plural forms per - * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#mk - * - * @param $count int - * @param $forms array - * - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 2 ); - // TODO CLDR defines forms[0] for n != 11 and not for n%100 !== 11 - if ( $count % 10 === 1 && $count % 100 !== 11 ) { - return $forms[0]; - } else { - return $forms[1]; - } - } -} diff --git a/languages/classes/LanguageMt.php b/languages/classes/LanguageMt.php deleted file mode 100644 index 68bd7ca9..00000000 --- a/languages/classes/LanguageMt.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Maltese (Malti) specific code. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @author Niklas Laxström - * @ingroup Language - */ - -/** - * Maltese (Malti) - * - * @ingroup Language - */ -class LanguageMt extends Language { - - /** - * @param $count int - * @param $forms array - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - - $forms = $this->preConvertPlural( $forms, 4 ); - - if ( $count == 1 ) $index = 0; - elseif ( $count == 0 || ( $count % 100 > 1 && $count % 100 < 11 ) ) $index = 1; - elseif ( $count % 100 > 10 && $count % 100 < 20 ) $index = 2; - else $index = 3; - return $forms[$index]; - } -} diff --git a/languages/classes/LanguageNso.php b/languages/classes/LanguageNso.php deleted file mode 100644 index 0c086750..00000000 --- a/languages/classes/LanguageNso.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Northern Sotho (Sesotho sa Leboa) specific code. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Language - */ - -/** - * Northern Sotho (Sesotho sa Leboa) - * - * @ingroup Language - */ -class LanguageNso extends Language { - /** - * Use singular form for zero - * - * @param $count int - * @param $forms array - * - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 2 ); - - return ( $count <= 1 ) ? $forms[0] : $forms[1]; - } -} diff --git a/languages/classes/LanguageOs.php b/languages/classes/LanguageOs.php index a808840f..f37e2d54 100644 --- a/languages/classes/LanguageOs.php +++ b/languages/classes/LanguageOs.php @@ -81,27 +81,41 @@ class LanguageOs extends Language { # Checking if $word ends on 'у'. 'У' can be either consonant 'W' or vowel 'U' in cyrillic Ossetic. # Examples: {{grammar:genitive|аунеу}} = аунеуы, {{grammar:genitive|лæппу}} = лæппуйы. elseif ( preg_match( "/у$/u", $word ) ) { - if ( !preg_match( "/[аæеёиоыэюя]$/u", mb_substr( $word, -2, 1 ) ) ) + if ( !preg_match( "/[аæеёиоыэюя]$/u", mb_substr( $word, -2, 1 ) ) ) { $jot = 'й'; + } } elseif ( !preg_match( "/[бвгджзйклмнопрстфхцчшщьъ]$/u", $word ) ) { $hyphen = '-'; } switch ( $case ) { - case 'genitive': $ending = $hyphen . $jot . 'ы'; break; - case 'dative': $ending = $hyphen . $jot . 'æн'; break; - case 'allative': $ending = $hyphen . $end_allative; break; + case 'genitive': + $ending = $hyphen . $jot . 'ы'; + break; + case 'dative': + $ending = $hyphen . $jot . 'æн'; + break; + case 'allative': + $ending = $hyphen . $end_allative; + break; case 'ablative': if ( $jot == 'й' ) { - $ending = $hyphen . $jot . 'æ'; break; + $ending = $hyphen . $jot . 'æ'; + } else { + $ending = $hyphen . $jot . 'æй'; } - else { - $ending = $hyphen . $jot . 'æй'; break; - } - case 'inessive': break; - case 'superessive': $ending = $hyphen . $jot . 'ыл'; break; - case 'equative': $ending = $hyphen . $jot . 'ау'; break; - case 'comitative': $ending = $hyphen . 'имæ'; break; + break; + case 'inessive': + break; + case 'superessive': + $ending = $hyphen . $jot . 'ыл'; + break; + case 'equative': + $ending = $hyphen . $jot . 'ау'; + break; + case 'comitative': + $ending = $hyphen . 'имæ'; + break; } return $word . $ending; } diff --git a/languages/classes/LanguagePl.php b/languages/classes/LanguagePl.php index 68bf0208..8e286c94 100644 --- a/languages/classes/LanguagePl.php +++ b/languages/classes/LanguagePl.php @@ -27,31 +27,6 @@ * @ingroup Language */ class LanguagePl extends Language { - - /** - * @param $count string - * @param $forms array - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 3 ); - $count = abs( $count ); - if ( $count == 1 ) { - return $forms[0]; // singular - } - switch ( $count % 10 ) { - case 2: - case 3: - case 4: - if ( $count / 10 % 10 != 1 ) { - return $forms[1]; // plural - } - default: - return $forms[2]; // plural genitive - } - } - /** * @param $_ string * @return string diff --git a/languages/classes/LanguageSh.php b/languages/classes/LanguageSh.php deleted file mode 100644 index 1fcddfc1..00000000 --- a/languages/classes/LanguageSh.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -/** - * Serbo-Croatian (Srpskohrvatski / Српскохрватски) specific code. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Language - */ - -/** - * Serbo-Croatian (Srpskohrvatski / Српскохрватски) - * - * @ingroup Language - */ -class LanguageSh extends Language { - - /** - * @param $count string - * @param $forms array - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - - // if no number with word, then use $form[0] for singular and $form[1] for plural or zero - if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1]; - - // @todo FIXME: CLDR defines 4 plural forms. Form with decimals missing. - // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sh - $forms = $this->preConvertPlural( $forms, 3 ); - - if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) { - return $forms[2]; - } else { - switch ( $count % 10 ) { - case 1: return $forms[0]; - case 2: - case 3: - case 4: return $forms[1]; - default: return $forms[2]; - } - } - } -} diff --git a/languages/classes/LanguageShi.php b/languages/classes/LanguageShi.php index 5ddcfdef..f4180cb8 100644 --- a/languages/classes/LanguageShi.php +++ b/languages/classes/LanguageShi.php @@ -21,7 +21,7 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; /** * Conversion script between Latin and Tifinagh for Tachelhit. @@ -42,25 +42,25 @@ class ShiConverter extends LanguageConverter { public $mToLatin = array( 'ⴰ' => 'a', 'ⴱ' => 'b', 'ⴳ' => 'g', 'ⴷ' => 'd', 'ⴹ' => 'ḍ', 'ⴻ' => 'e', 'ⴼ' => 'f', 'ⴽ' => 'k', 'ⵀ' => 'h', 'ⵃ' => 'ḥ', 'ⵄ' => 'ε', 'ⵅ' => 'x', - 'ⵇ' => 'q', 'ⵉ' => 'i', 'ⵊ' => 'j', 'ⵍ' => 'l', 'ⵎ' => 'm', 'ⵏ' => 'n', + 'ⵇ' => 'q', 'ⵉ' => 'i', 'ⵊ' => 'j', 'ⵍ' => 'l', 'ⵎ' => 'm', 'ⵏ' => 'n', 'ⵓ' => 'u', 'ⵔ' => 'r', 'ⵕ' => 'ṛ', 'ⵖ' => 'γ', 'ⵙ' => 's', 'ⵚ' => 'ṣ', 'ⵛ' => 'š', 'ⵜ' => 't', 'ⵟ' => 'ṭ', 'ⵡ' => 'w', 'ⵢ' => 'y', 'ⵣ' => 'z', 'ⵥ' => 'ẓ', 'ⵯ' => 'ʷ', 'ⵖ' => 'ɣ', 'ⵠ' => 'v', 'ⵒ' => 'p', ); public $mUpperToLowerCaseLatin = array( - 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', - 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', - 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', - 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', - 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', + 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', + 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', + 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', + 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', + 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', 'Z' => 'z', 'Ɣ' => 'ɣ', ); public $mToTifinagh = array( 'a' => 'ⴰ', 'b' => 'ⴱ', 'g' => 'ⴳ', 'd' => 'ⴷ', 'ḍ' => 'ⴹ', 'e' => 'ⴻ', 'f' => 'ⴼ', 'k' => 'ⴽ', 'h' => 'ⵀ', 'ḥ' => 'ⵃ', 'ε' => 'ⵄ', 'x' => 'ⵅ', - 'q' => 'ⵇ', 'i' => 'ⵉ', 'j' => 'ⵊ', 'l' => 'ⵍ', 'm' => 'ⵎ', 'n' => 'ⵏ', + 'q' => 'ⵇ', 'i' => 'ⵉ', 'j' => 'ⵊ', 'l' => 'ⵍ', 'm' => 'ⵎ', 'n' => 'ⵏ', 'u' => 'ⵓ', 'r' => 'ⵔ', 'ṛ' => 'ⵕ', 'γ' => 'ⵖ', 's' => 'ⵙ', 'ṣ' => 'ⵚ', 'š' => 'ⵛ', 't' => 'ⵜ', 'ṭ' => 'ⵟ', 'w' => 'ⵡ', 'y' => 'ⵢ', 'z' => 'ⵣ', 'ẓ' => 'ⵥ', 'ʷ' => 'ⵯ', 'ɣ' => 'ⵖ', 'v' => 'ⵠ', 'p' => 'ⵒ', @@ -71,7 +71,7 @@ class ShiConverter extends LanguageConverter { 'lowercase' => new ReplacementArray( $this->mUpperToLowerCaseLatin ), 'shi-tfng' => new ReplacementArray( $this->mToTifinagh ), 'shi-latn' => new ReplacementArray( $this->mToLatin ), - 'shi' => new ReplacementArray() + 'shi' => new ReplacementArray() ); } @@ -123,17 +123,19 @@ class ShiConverter extends LanguageConverter { * @param $ignoreOtherCond bool */ function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) { - // check for user namespace + // check for user namespace if ( is_object( $nt ) ) { $ns = $nt->getNamespace(); - if ( $ns == NS_USER || $ns == NS_USER_TALK ) + if ( $ns == NS_USER || $ns == NS_USER_TALK ) { return; + } } $oldlink = $link; parent::findVariantLink( $link, $nt, $ignoreOtherCond ); - if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) + if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) { $link = $oldlink; + } } /** @@ -147,9 +149,11 @@ class ShiConverter extends LanguageConverter { */ function autoConvert( $text, $toVariant = false ) { global $wgTitle; - if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) { + if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) { $imagename = $wgTitle->getNsText(); - if ( preg_match( "/^$imagename:/", $text ) ) return $text; + if ( preg_match( "/^$imagename:/", $text ) ) { + return $text; + } } return parent::autoConvert( $text, $toVariant ); } @@ -168,7 +172,7 @@ class ShiConverter extends LanguageConverter { if ( trim( $text ) ) { $this->loadTables(); // To Tifinagh, first translate uppercase to lowercase Latin - if( $toVariant == 'shi-tfng' ) { + if ( $toVariant == 'shi-tfng' ) { $text = $this->mTables['lowercase']->replace( $text ); } $text = $this->mTables[$toVariant]->replace( $text ); @@ -190,7 +194,7 @@ class LanguageShi extends Language { $variants = array( 'shi', 'shi-tfng', 'shi-latn' ); $variantfallbacks = array( - 'shi' => 'shi-tfng', + 'shi' => 'shi-tfng', 'shi-tfng' => 'shi', 'shi-latn' => 'shi', ); diff --git a/languages/classes/LanguageSk.php b/languages/classes/LanguageSk.php deleted file mode 100644 index b1da70e6..00000000 --- a/languages/classes/LanguageSk.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Slovak (Slovenčina) specific code. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Language - */ - -/** - * Slovak (Slovenčina) - * - * @ingroup Language - */ -class LanguageSk extends Language { - - /** - * @param $count int - * @param $forms array - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 3 ); - - if ( $count == 1 ) { - $index = 0; - } elseif ( $count == 2 || $count == 3 || $count == 4 ) { - $index = 1; - } else { - $index = 2; - } - return $forms[$index]; - } -} diff --git a/languages/classes/LanguageSl.php b/languages/classes/LanguageSl.php index c075e515..06c75c95 100644 --- a/languages/classes/LanguageSl.php +++ b/languages/classes/LanguageSl.php @@ -45,35 +45,14 @@ class LanguageSl extends Language { switch ( $case ) { case 'mestnik': # locative - $word = 'o ' . $word; break; + $word = 'o ' . $word; + break; case 'orodnik': # instrumental $word = 'z ' . $word; + break; } return $word; # this will return the original value for 'imenovalnik' (nominativ) and all undefined case values } - /** - * @param $count int - * @param $forms array - * - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 5 ); - - if ( $count % 100 == 1 ) { - $index = 0; - } elseif ( $count % 100 == 2 ) { - $index = 1; - } elseif ( $count % 100 == 3 || $count % 100 == 4 ) { - $index = 2; - } elseif ( $count != 0 ) { - $index = 3; - } else { - $index = 4; - } - return $forms[$index]; - } } diff --git a/languages/classes/LanguageSr.php b/languages/classes/LanguageSr.php index 55aec32e..6f0ff4b5 100644 --- a/languages/classes/LanguageSr.php +++ b/languages/classes/LanguageSr.php @@ -21,9 +21,9 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); -require_once( __DIR__ . '/LanguageSr_ec.php' ); -require_once( __DIR__ . '/LanguageSr_el.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; +require_once __DIR__ . '/LanguageSr_ec.php'; +require_once __DIR__ . '/LanguageSr_el.php'; /** * There are two levels of conversion for Serbian: the script level @@ -75,7 +75,7 @@ class SrConverter extends LanguageConverter { $this->mTables = array( 'sr-ec' => new ReplacementArray( $this->mToCyrillics ), 'sr-el' => new ReplacementArray( $this->mToLatin ), - 'sr' => new ReplacementArray() + 'sr' => new ReplacementArray() ); } @@ -118,14 +118,16 @@ class SrConverter extends LanguageConverter { // check for user namespace if ( is_object( $nt ) ) { $ns = $nt->getNamespace(); - if ( $ns == NS_USER || $ns == NS_USER_TALK ) + if ( $ns == NS_USER || $ns == NS_USER_TALK ) { return; + } } $oldlink = $link; parent::findVariantLink( $link, $nt, $ignoreOtherCond ); - if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) + if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) { $link = $oldlink; + } } /** @@ -139,9 +141,11 @@ class SrConverter extends LanguageConverter { */ function autoConvert( $text, $toVariant = false ) { global $wgTitle; - if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) { + if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) { $imagename = $wgTitle->getNsText(); - if ( preg_match( "/^$imagename:/", $text ) ) return $text; + if ( preg_match( "/^$imagename:/", $text ) ) { + return $text; + } } return parent::autoConvert( $text, $toVariant ); } @@ -194,13 +198,13 @@ class SrConverter extends LanguageConverter { * @since 1.19 */ public function guessVariant( $text, $variant ) { - $numCyrillic = preg_match_all("/[шђчћжШЂЧЋЖ]/u", $text, $dummy); - $numLatin = preg_match_all("/[šđč枊ĐČĆŽ]/u", $text, $dummy); + $numCyrillic = preg_match_all( "/[шђчћжШЂЧЋЖ]/u", $text, $dummy ); + $numLatin = preg_match_all( "/[šđč枊ĐČĆŽ]/u", $text, $dummy ); - if( $variant == 'sr-ec' ) { - return (boolean) ($numCyrillic > $numLatin); - } elseif( $variant == 'sr-el' ) { - return (boolean) ($numLatin > $numCyrillic); + if ( $variant == 'sr-ec' ) { + return $numCyrillic > $numLatin; + } elseif ( $variant == 'sr-el' ) { + return $numLatin > $numCyrillic; } else { return false; } @@ -222,14 +226,14 @@ class LanguageSr extends LanguageSr_ec { $variants = array( 'sr', 'sr-ec', 'sr-el' ); $variantfallbacks = array( - 'sr' => 'sr-ec', + 'sr' => 'sr-ec', 'sr-ec' => 'sr', 'sr-el' => 'sr', ); $flags = array( 'S' => 'S', 'писмо' => 'S', 'pismo' => 'S', - 'W' => 'W', 'реч' => 'W', 'reč' => 'W', 'ријеч' => 'W', 'riječ' => 'W' + 'W' => 'W', 'реч' => 'W', 'reč' => 'W', 'ријеч' => 'W', 'riječ' => 'W' ); $this->mConverter = new SrConverter( $this, 'sr', $variants, $variantfallbacks, $flags ); $wgHooks['PageContentSaveComplete'][] = $this->mConverter; @@ -262,10 +266,10 @@ class LanguageSr extends LanguageSr_ec { return $forms[2]; } else { switch ( $count % 10 ) { - case 1: return $forms[0]; + case 1: return $forms[0]; case 2: case 3: - case 4: return $forms[1]; + case 4: return $forms[1]; default: return $forms[2]; } } diff --git a/languages/classes/LanguageSr_ec.php b/languages/classes/LanguageSr_ec.php index 352e2930..cb9e8191 100644 --- a/languages/classes/LanguageSr_ec.php +++ b/languages/classes/LanguageSr_ec.php @@ -34,17 +34,19 @@ class LanguageSr_ec extends Language { * @return string */ function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } + if ( !count( $forms ) ) { + return ''; + } $forms = $this->preConvertPlural( $forms, 3 ); if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) { return $forms[2]; } else { switch ( $count % 10 ) { - case 1: return $forms[0]; + case 1: return $forms[0]; case 2: case 3: - case 4: return $forms[1]; + case 4: return $forms[1]; default: return $forms[2]; } } diff --git a/languages/classes/LanguageSr_el.php b/languages/classes/LanguageSr_el.php index 0e36d6c3..99d12935 100644 --- a/languages/classes/LanguageSr_el.php +++ b/languages/classes/LanguageSr_el.php @@ -34,17 +34,19 @@ class LanguageSr_el extends Language { * @return string */ function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } + if ( !count( $forms ) ) { + return ''; + } $forms = $this->preConvertPlural( $forms, 3 ); if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) { return $forms[2]; } else { switch ( $count % 10 ) { - case 1: return $forms[0]; + case 1: return $forms[0]; case 2: case 3: - case 4: return $forms[1]; + case 4: return $forms[1]; default: return $forms[2]; } } diff --git a/languages/classes/LanguageTg.php b/languages/classes/LanguageTg.php index 3ec14763..10755b48 100644 --- a/languages/classes/LanguageTg.php +++ b/languages/classes/LanguageTg.php @@ -21,7 +21,7 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; /** * Converts Tajiki to latin orthography @@ -108,7 +108,7 @@ class TgConverter extends LanguageConverter { function loadDefaultTables() { $this->mTables = array( 'tg-latn' => new ReplacementArray( $this->table ), - 'tg' => new ReplacementArray() + 'tg' => new ReplacementArray() ); } diff --git a/languages/classes/LanguageTi.php b/languages/classes/LanguageTi.php deleted file mode 100644 index 27331cc9..00000000 --- a/languages/classes/LanguageTi.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Tigrinya (ትግርኛ) specific code. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Language - */ - -/** - * Tigrinya (ትግርኛ) - * - * @ingroup Language - */ -class LanguageTi extends Language { - /** - * Use singular form for zero - * - * @param $count int - * @param $forms array - * - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 2 ); - - return ( $count <= 1 ) ? $forms[0] : $forms[1]; - } -} diff --git a/languages/classes/LanguageTr.php b/languages/classes/LanguageTr.php index 6a015667..887f05c8 100644 --- a/languages/classes/LanguageTr.php +++ b/languages/classes/LanguageTr.php @@ -38,7 +38,7 @@ class LanguageTr extends Language { * @param $string string * @return string */ - function ucfirst ( $string ) { + function ucfirst( $string ) { if ( strlen( $string ) && $string[0] == 'i' ) { return 'İ' . substr( $string, 1 ); } else { @@ -50,7 +50,7 @@ class LanguageTr extends Language { * @param $string string * @return mixed|string */ - function lcfirst ( $string ) { + function lcfirst( $string ) { if ( strlen( $string ) && $string[0] == 'I' ) { return 'ı' . substr( $string, 1 ); } else { diff --git a/languages/classes/LanguageTyv.php b/languages/classes/LanguageTyv.php index 6d147c87..fc1e8a81 100644 --- a/languages/classes/LanguageTyv.php +++ b/languages/classes/LanguageTyv.php @@ -150,7 +150,7 @@ class LanguageTyv extends Language { $word = implode( "", $ar[0] ) . "ты"; } else { } - } elseif ( $wordEnding === "л" || $wordEnding === "l" ) { + } elseif ( $wordEnding === "л" || $wordEnding === "l" ) { if ( in_array( $wordLastVowel, $roundFrontVowels ) ) { $word = implode( "", $ar[0] ) . "дү"; } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) { diff --git a/languages/classes/LanguageUk.php b/languages/classes/LanguageUk.php index ce9ed33c..4ad272ba 100644 --- a/languages/classes/LanguageUk.php +++ b/languages/classes/LanguageUk.php @@ -48,32 +48,32 @@ class LanguageUk extends Language { # join and array_slice instead mb_substr $ar = array(); preg_match_all( '/./us', $word, $ar ); - if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) + if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) { switch ( $case ) { case 'genitive': # родовий відмінок - if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вікі' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вікі' ) ) - { } - elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ь' ) + if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вікі' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вікі' ) ) { + } elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ь' ) { $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'я'; - elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ія' ) + } elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ія' ) { $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ії'; - elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ка' ) + } elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ка' ) { $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ки'; - elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ти' ) + } elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ти' ) { $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'тей'; - elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ди' ) + } elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ди' ) { $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'дів'; - elseif ( join( '', array_slice( $ar[0], -3 ) ) == 'ник' ) + } elseif ( join( '', array_slice( $ar[0], -3 ) ) == 'ник' ) { $word = join( '', array_slice( $ar[0], 0, -3 ) ) . 'ника'; + } break; case 'dative': # давальний відмінок # stub break; case 'accusative': # знахідний відмінок - if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вікі' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вікі' ) ) - { } - elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ія' ) + if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вікі' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вікі' ) ) { + } elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ія' ) { $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ію'; + } break; case 'instrumental': # орудний відмінок # stub @@ -82,6 +82,7 @@ class LanguageUk extends Language { # stub break; } + } return $word; } @@ -91,13 +92,17 @@ class LanguageUk extends Language { * @return string */ function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } + if ( !count( $forms ) ) { + return ''; + } // If the actual number is not mentioned in the expression, then just two forms are enough: // singular for $count == 1 // plural for $count != 1 // For example, "This user belongs to {{PLURAL:$1|one group|several groups}}." - if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1]; + if ( count( $forms ) === 2 ) { + return $count == 1 ? $forms[0] : $forms[1]; + } // @todo FIXME: CLDR defines 4 plural forms. Form for decimals is missing/ // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#uk @@ -107,10 +112,10 @@ class LanguageUk extends Language { return $forms[2]; } else { switch ( $count % 10 ) { - case 1: return $forms[0]; + case 1: return $forms[0]; case 2: case 3: - case 4: return $forms[1]; + case 4: return $forms[1]; default: return $forms[2]; } } diff --git a/languages/classes/LanguageUz.php b/languages/classes/LanguageUz.php index a2c917cd..aa3e4f24 100644 --- a/languages/classes/LanguageUz.php +++ b/languages/classes/LanguageUz.php @@ -21,7 +21,7 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; /** * @ingroup Language @@ -75,9 +75,9 @@ class UzConverter extends LanguageConverter { 'f' => 'ф', 'F' => 'Ф', 'g' => 'г', 'G' => 'Г', 'g‘' => 'ғ', 'G‘' => 'Ғ', 'gʻ' => 'ғ', 'Gʻ' => 'Ғ', - 'h' => 'ҳ', 'H' => 'Ҳ', + 'h' => 'ҳ', 'H' => 'Ҳ', 'i' => 'и', 'I' => 'И', - 'k' => 'к', 'K' => 'К', + 'k' => 'к', 'K' => 'К', 'l' => 'л', 'L' => 'Л', 'm' => 'м', 'M' => 'М', 'n' => 'н', 'N' => 'Н', @@ -108,7 +108,7 @@ class UzConverter extends LanguageConverter { $this->mTables = array( 'uz-cyrl' => new ReplacementArray( $this->toCyrillic ), 'uz-latn' => new ReplacementArray( $this->toLatin ), - 'uz' => new ReplacementArray() + 'uz' => new ReplacementArray() ); } @@ -126,7 +126,7 @@ class LanguageUz extends Language { $variants = array( 'uz', 'uz-latn', 'uz-cyrl' ); $variantfallbacks = array( - 'uz' => 'uz-latn', + 'uz' => 'uz-latn', 'uz-cyrl' => 'uz', 'uz-latn' => 'uz', ); diff --git a/languages/classes/LanguageWa.php b/languages/classes/LanguageWa.php index 9e90c7f4..e5f7438f 100644 --- a/languages/classes/LanguageWa.php +++ b/languages/classes/LanguageWa.php @@ -30,20 +30,6 @@ * @ingroup Language */ class LanguageWa extends Language { - /** - * Use singular form for zero - * - * @param $count int - * @param $forms array - * - * @return string - */ - function convertPlural( $count, $forms ) { - if ( !count( $forms ) ) { return ''; } - $forms = $this->preConvertPlural( $forms, 2 ); - - return ( $count <= 1 ) ? $forms[0] : $forms[1]; - } /** * Dates in Walloon are "1î d' <monthname>" for 1st of the month, @@ -67,14 +53,14 @@ class LanguageWa extends Language { # # we also output this format for YMD (eg: 2001 January 15) if ( $datePreference == 'ISO 8601' ) { - $d = substr( $ts, 0, 4 ) . '-' . substr( $ts, 4, 2 ) . '-' . substr( $ts, 6, 2 ); - return $d; + $d = substr( $ts, 0, 4 ) . '-' . substr( $ts, 4, 2 ) . '-' . substr( $ts, 6, 2 ); + return $d; } # dd/mm/YYYY format if ( $datePreference == 'walloon short' ) { - $d = substr( $ts, 6, 2 ) . '/' . substr( $ts, 4, 2 ) . '/' . substr( $ts, 0, 4 ); - return $d; + $d = substr( $ts, 6, 2 ) . '/' . substr( $ts, 4, 2 ) . '/' . substr( $ts, 0, 4 ); + return $d; } # Walloon format @@ -83,17 +69,17 @@ class LanguageWa extends Language { $m = substr( $ts, 4, 2 ); $n = substr( $ts, 6, 2 ); if ( $n == 1 ) { - $d = "1î d' " . $this->getMonthName( $m ) . - " " . substr( $ts, 0, 4 ); + $d = "1î d' " . $this->getMonthName( $m ) . + " " . substr( $ts, 0, 4 ); } elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) { - $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) . - " " . substr( $ts, 0, 4 ); + $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) . + " " . substr( $ts, 0, 4 ); } elseif ( $m == 4 || $m == 8 || $m == 10 ) { - $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) . - " " . substr( $ts, 0, 4 ); + $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) . + " " . substr( $ts, 0, 4 ); } else { - $d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) . - " " . substr( $ts, 0, 4 ); + $d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) . + " " . substr( $ts, 0, 4 ); } return $d; } @@ -106,7 +92,9 @@ class LanguageWa extends Language { * @return string */ function timeanddate( $ts, $adj = false, $format = true, $tc = false ) { - if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); } + if ( $adj ) { + $ts = $this->userAdjust( $ts, $tc ); + } $datePreference = $this->dateFormat( $format ); if ( $datePreference == 'ISO 8601' ) { return parent::timeanddate( $ts, $adj, $format, $tc ); diff --git a/languages/classes/LanguageZh.php b/languages/classes/LanguageZh.php index 04767f2d..d4130183 100644 --- a/languages/classes/LanguageZh.php +++ b/languages/classes/LanguageZh.php @@ -21,8 +21,8 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); -require_once( __DIR__ . '/LanguageZh_hans.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; +require_once __DIR__ . '/LanguageZh_hans.php'; /** * @ingroup Language @@ -50,31 +50,31 @@ class ZhConverter extends LanguageConverter { $flags, $manualLevel ); $names = array( - 'zh' => '原文', + 'zh' => '原文', 'zh-hans' => '简体', 'zh-hant' => '繁體', - 'zh-cn' => '大陆', - 'zh-tw' => '台灣', - 'zh-hk' => '香港', - 'zh-mo' => '澳門', - 'zh-sg' => '新加坡', - 'zh-my' => '大马', + 'zh-cn' => '大陆', + 'zh-tw' => '台灣', + 'zh-hk' => '香港', + 'zh-mo' => '澳門', + 'zh-sg' => '新加坡', + 'zh-my' => '大马', ); $this->mVariantNames = array_merge( $this->mVariantNames, $names ); } function loadDefaultTables() { - require( __DIR__ . "/../../includes/ZhConversion.php" ); + require __DIR__ . "/../../includes/ZhConversion.php"; $this->mTables = array( 'zh-hans' => new ReplacementArray( $zh2Hans ), 'zh-hant' => new ReplacementArray( $zh2Hant ), - 'zh-cn' => new ReplacementArray( array_merge( $zh2Hans, $zh2CN ) ), - 'zh-hk' => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ), - 'zh-mo' => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ), - 'zh-my' => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ), - 'zh-sg' => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ), - 'zh-tw' => new ReplacementArray( array_merge( $zh2Hant, $zh2TW ) ), - 'zh' => new ReplacementArray + 'zh-cn' => new ReplacementArray( array_merge( $zh2Hans, $zh2CN ) ), + 'zh-hk' => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ), + 'zh-mo' => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ), + 'zh-my' => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ), + 'zh-sg' => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ), + 'zh-tw' => new ReplacementArray( array_merge( $zh2Hant, $zh2TW ) ), + 'zh' => new ReplacementArray ); } @@ -111,18 +111,18 @@ class LanguageZh extends LanguageZh_hans { $variants = array( 'zh', 'zh-hans', 'zh-hant', 'zh-cn', 'zh-hk', 'zh-mo', 'zh-my', 'zh-sg', 'zh-tw' ); $variantfallbacks = array( - 'zh' => array( 'zh-hans', 'zh-hant', 'zh-cn', 'zh-tw', 'zh-hk', 'zh-sg', 'zh-mo', 'zh-my' ), + 'zh' => array( 'zh-hans', 'zh-hant', 'zh-cn', 'zh-tw', 'zh-hk', 'zh-sg', 'zh-mo', 'zh-my' ), 'zh-hans' => array( 'zh-cn', 'zh-sg', 'zh-my' ), 'zh-hant' => array( 'zh-tw', 'zh-hk', 'zh-mo' ), - 'zh-cn' => array( 'zh-hans', 'zh-sg', 'zh-my' ), - 'zh-sg' => array( 'zh-hans', 'zh-cn', 'zh-my' ), - 'zh-my' => array( 'zh-hans', 'zh-sg', 'zh-cn' ), - 'zh-tw' => array( 'zh-hant', 'zh-hk', 'zh-mo' ), - 'zh-hk' => array( 'zh-hant', 'zh-mo', 'zh-tw' ), - 'zh-mo' => array( 'zh-hant', 'zh-hk', 'zh-tw' ), + 'zh-cn' => array( 'zh-hans', 'zh-sg', 'zh-my' ), + 'zh-sg' => array( 'zh-hans', 'zh-cn', 'zh-my' ), + 'zh-my' => array( 'zh-hans', 'zh-sg', 'zh-cn' ), + 'zh-tw' => array( 'zh-hant', 'zh-hk', 'zh-mo' ), + 'zh-hk' => array( 'zh-hant', 'zh-mo', 'zh-tw' ), + 'zh-mo' => array( 'zh-hant', 'zh-hk', 'zh-tw' ), ); $ml = array( - 'zh' => 'disable', + 'zh' => 'disable', 'zh-hans' => 'unidirectional', 'zh-hant' => 'unidirectional', ); @@ -142,9 +142,7 @@ class LanguageZh extends LanguageZh_hans { * @return string */ function segmentForDiff( $text ) { - return preg_replace( - "/([\\xc0-\\xff][\\x80-\\xbf]*)/e", - "' ' .\"$1\"", $text ); + return preg_replace( '/[\xc0-\xff][\x80-\xbf]*/', ' $0', $text ); } /** @@ -152,9 +150,7 @@ class LanguageZh extends LanguageZh_hans { * @return string */ function unsegmentForDiff( $text ) { - return preg_replace( - "/ ([\\xc0-\\xff][\\x80-\\xbf]*)/e", - "\"$1\"", $text ); + return preg_replace( '/ ([\xc0-\xff][\x80-\xbf]*)/', '$1', $text ); } /** diff --git a/languages/classes/LanguageZh_hans.php b/languages/classes/LanguageZh_hans.php index 04b2e16a..3851c8fe 100644 --- a/languages/classes/LanguageZh_hans.php +++ b/languages/classes/LanguageZh_hans.php @@ -86,6 +86,8 @@ class LanguageZh_hans extends Language { $segments = array(); foreach ( $intervals as $intervalName => $intervalValue ) { + // Messages: duration-seconds, duration-minutes, duration-hours, duration-days, duration-weeks, + // duration-years, duration-decades, duration-centuries, duration-millennia $message = wfMessage( 'duration-' . $intervalName )->numParams( $intervalValue ); $segments[] = $message->inLanguage( $this )->escaped(); } |