summaryrefslogtreecommitdiff
path: root/languages/classes
diff options
context:
space:
mode:
Diffstat (limited to 'languages/classes')
-rw-r--r--languages/classes/LanguageAz.php2
-rw-r--r--languages/classes/LanguageBe_tarask.php40
-rw-r--r--languages/classes/LanguageCu.php27
-rw-r--r--languages/classes/LanguageEo.php72
-rw-r--r--languages/classes/LanguageEs.php (renamed from languages/classes/LanguageTl.php)24
-rw-r--r--languages/classes/LanguageFi.php8
-rw-r--r--languages/classes/LanguageGa.php21
-rw-r--r--languages/classes/LanguageGan.php63
-rw-r--r--languages/classes/LanguageGv.php53
-rw-r--r--languages/classes/LanguageHe.php11
-rw-r--r--languages/classes/LanguageHi.php44
-rw-r--r--languages/classes/LanguageHr.php54
-rw-r--r--languages/classes/LanguageHy.php25
-rw-r--r--languages/classes/LanguageIu.php43
-rw-r--r--languages/classes/LanguageKaa.php6
-rw-r--r--languages/classes/LanguageKk.php69
-rw-r--r--languages/classes/LanguageKk_cyrl.php62
-rw-r--r--languages/classes/LanguageKsh.php24
-rw-r--r--languages/classes/LanguageKu.php86
-rw-r--r--languages/classes/LanguageLa.php90
-rw-r--r--languages/classes/LanguageLn.php45
-rw-r--r--languages/classes/LanguageLt.php56
-rw-r--r--languages/classes/LanguageLv.php51
-rw-r--r--languages/classes/LanguageMg.php44
-rw-r--r--languages/classes/LanguageMk.php49
-rw-r--r--languages/classes/LanguageMo.php53
-rw-r--r--languages/classes/LanguageMt.php48
-rw-r--r--languages/classes/LanguageNso.php44
-rw-r--r--languages/classes/LanguageOs.php38
-rw-r--r--languages/classes/LanguagePl.php25
-rw-r--r--languages/classes/LanguageQqx.php2
-rw-r--r--languages/classes/LanguageRo.php52
-rw-r--r--languages/classes/LanguageRu.php110
-rw-r--r--languages/classes/LanguageSe.php51
-rw-r--r--languages/classes/LanguageSgs.php52
-rw-r--r--languages/classes/LanguageSh.php58
-rw-r--r--languages/classes/LanguageShi.php59
-rw-r--r--languages/classes/LanguageSk.php49
-rw-r--r--languages/classes/LanguageSl.php27
-rw-r--r--languages/classes/LanguageSma.php51
-rw-r--r--languages/classes/LanguageSr.php100
-rw-r--r--languages/classes/LanguageSr_ec.php52
-rw-r--r--languages/classes/LanguageSr_el.php52
-rw-r--r--languages/classes/LanguageTg.php4
-rw-r--r--languages/classes/LanguageTi.php44
-rw-r--r--languages/classes/LanguageTr.php4
-rw-r--r--languages/classes/LanguageTyv.php2
-rw-r--r--languages/classes/LanguageUk.php56
-rw-r--r--languages/classes/LanguageUz.php16
-rw-r--r--languages/classes/LanguageWa.php42
-rw-r--r--languages/classes/LanguageZh.php74
-rw-r--r--languages/classes/LanguageZh_hans.php29
52 files changed, 481 insertions, 1782 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..05b9550f 100644
--- a/languages/classes/LanguageBe_tarask.php
+++ b/languages/classes/LanguageBe_tarask.php
@@ -32,46 +32,6 @@
*/
class LanguageBe_tarask extends Language {
/**
- * Plural form transformations
- *
- * $wordform1 - singular form (for 1, 21, 31, 41...)
- * $wordform2 - plural form (for 2, 3, 4, 22, 23, 24, 32, 33, 34...)
- * $wordform3 - plural form (for 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26...)
- */
-
- /**
- * @param $count int
- * @param $forms array
- *
- * @return string
- */
- function convertPlural( $count, $forms ) {
- 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];
-
- // @todo FIXME: CLDR defines 4 plural forms instead of 3
- // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
- $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];
- }
- }
- }
-
- /**
* The Belarusian language uses apostrophe sign,
* but the characters used for this could be both U+0027 and U+2019.
* This function unifies apostrophe sign in search index values
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 3c162480..0e2d8b4a 100644
--- a/languages/classes/LanguageEo.php
+++ b/languages/classes/LanguageEo.php
@@ -63,7 +63,7 @@ class LanguageEo extends Language {
if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) {
return preg_replace_callback (
'/([cghjsu]x?)((?:xx)*)(?!x)/i',
- array( $this, 'strrtxuCallback' ), $string );
+ array( $this, 'strrtxuCallback' ), $string );
} elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) {
# Double Xs only if they follow cxapelutaj literoj.
return preg_replace_callback(
@@ -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 1865cc5c..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':
@@ -102,7 +104,7 @@ class LanguageFi extends Language {
'monday' => 'maanantai',
'tuesday' => 'tiistai',
'wednesday' => 'keskiviikko',
- 'thursay' => 'torstai',
+ 'thursday' => 'torstai',
'friday' => 'perjantai',
'saturday' => 'lauantai',
'sunday' => 'sunnuntai',
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 14fe9282..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,29 +58,15 @@ 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
);
}
/**
- * there shouldn't be any latin text in Chinese conversion, so no need
- * to mark anything.
- * $noParse is there for compatibility with LanguageConvert::markNoConversion
- *
- * @param $text string
- * @param $noParse bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- return $text;
- }
-
- /**
* @param $key string
* @return String
*/
@@ -103,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',
@@ -116,29 +102,7 @@ class LanguageGan extends LanguageZh {
array(),
$ml );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
- }
-
- /**
- * 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 );
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
/**
@@ -153,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
deleted file mode 100644
index 70b80ad6..00000000
--- a/languages/classes/LanguageGv.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Manx (Gaelg) 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
- */
-
-/**
- * Manx (Gaelg)
- *
- * @ingroup Language
- */
-class LanguageGv 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 > 0 && ( $count % 20 ) === 0 ) {
- return $forms[0];
- } else {
- switch ( $count % 10 ) {
- case 1: return $forms[1];
- case 2: return $forms[2];
- default: return $forms[3];
- }
- }
- }
-
-}
diff --git a/languages/classes/LanguageHe.php b/languages/classes/LanguageHe.php
index 48c0c057..03919886 100644
--- a/languages/classes/LanguageHe.php
+++ b/languages/classes/LanguageHe.php
@@ -49,17 +49,17 @@ class LanguageHe extends Language {
switch ( $case ) {
case 'prefixed':
case 'תחילית':
- # Duplicate the "Waw" if prefixed
- if ( substr( $word, 0, 2 ) == "ו" && substr( $word, 0, 4 ) != "וו" ) {
+ # Duplicate the "Waw" if prefixed, but not if it is already double.
+ if ( substr( $word, 0, 2 ) === "ו" && substr( $word, 0, 4 ) !== "וו" ) {
$word = "ו" . $word;
}
- # Remove the "He" if prefixed
- if ( substr( $word, 0, 2 ) == "ה" ) {
+ # Remove the "He" article if prefixed.
+ if ( substr( $word, 0, 2 ) === "ה" ) {
$word = substr( $word, 2 );
}
- # Add a hyphen (maqaf) if non-Hebrew letters
+ # Add a hyphen (maqaf) before non-Hebrew letters.
if ( substr( $word, 0, 2 ) < "א" || substr( $word, 0, 2 ) > "ת" ) {
$word = "־" . $word;
}
@@ -67,5 +67,4 @@ class LanguageHe extends Language {
return $word;
}
-
}
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
deleted file mode 100644
index a0e9a87a..00000000
--- a/languages/classes/LanguageHr.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * Croatian (hrvatski) 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
- */
-
-/**
- * Croatian (hrvatski)
- *
- * @ingroup Language
- */
-class LanguageHr extends Language {
-
- /**
- * @param $count int
- * @param $forms array
- * @return string
- */
- function convertPlural( $count, $forms ) {
- 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 );
-
- 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/LanguageHy.php b/languages/classes/LanguageHy.php
index 9c155951..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,23 +75,11 @@ class LanguageHy extends Language {
# stub
break;
}
+ }
return $word;
}
/**
- * @param $count int
- * @param $forms array
- *
- * @return string
- */
- function convertPlural( $count, $forms ) {
- if ( !count( $forms ) ) { return ''; }
- $forms = $this->preConvertPlural( $forms, 2 );
-
- return ( abs( $count ) <= 1 ) ? $forms[0] : $forms[1];
- }
-
- /**
* Armenian numeric format is "12 345,67" but "1234,56"
*
* @param $_ string
diff --git a/languages/classes/LanguageIu.php b/languages/classes/LanguageIu.php
index 9bac5d73..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.
@@ -38,7 +38,7 @@ require_once( __DIR__ . '/../LanguageConverter.php' );
class IuConverter extends LanguageConverter {
protected $mDoContentConvert;
- var $mToLatin = array(
+ public $mToLatin = array(
'ᐦ' => 'h', 'ᐃ' => 'i', 'ᐄ' => 'ii', 'ᐅ' => 'u', 'ᐆ' => 'uu', 'ᐊ' => 'a', 'ᐋ' => 'aa',
'ᑉ' => 'p', 'ᐱ' => 'pi', 'ᐲ' => 'pii', 'ᐳ' => 'pu', 'ᐴ' => 'puu', 'ᐸ' => 'pa', 'ᐹ' => 'paa',
'ᑦ' => 't', 'ᑎ' => 'ti', 'ᑏ' => 'tii', 'ᑐ' => 'tu', 'ᑑ' => 'tuu', 'ᑕ' => 'ta', 'ᑖ' => 'taa',
@@ -58,7 +58,7 @@ class IuConverter extends LanguageConverter {
'ᖦ' => 'ɫ', 'ᖠ' => 'ɫi', 'ᖡ' => 'ɫii', 'ᖢ' => 'ɫu', 'ᖣ' => 'ɫuu', 'ᖤ' => 'ɫa', 'ᖥ' => 'ɫaa',
);
- var $mUpperToLowerCaseLatin = array(
+ 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',
@@ -67,7 +67,7 @@ class IuConverter extends LanguageConverter {
'Z' => 'z',
);
- var $mToSyllabics = array(
+ public $mToSyllabics = array(
'h' => 'ᐦ', 'i' => 'ᐃ', 'ii' => 'ᐄ', 'u' => 'ᐅ', 'uu' => 'ᐆ', 'a' => 'ᐊ', 'aa' => 'ᐋ',
'p' => 'ᑉ', 'pi' => 'ᐱ', 'pii' => 'ᐲ', 'pu' => 'ᐳ', 'puu' => 'ᐴ', 'pa' => 'ᐸ', 'paa' => 'ᐹ',
't' => 'ᑦ', 'ti' => 'ᑎ', 'tii' => 'ᑏ', 'tu' => 'ᑐ', 'tuu' => 'ᑑ', 'ta' => 'ᑕ', 'taa' => 'ᑖ',
@@ -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,32 +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;
- }
-
- /**
- * We want our external link captions to be converted in variants,
- * so we return the original text instead -{$text}-, except for URLs
- *
- * @param $text string
- * @param $noParse bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
- return parent::markNoConversion( $text );
- return $text;
+ }
}
/**
@@ -183,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 );
}
@@ -204,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 );
@@ -233,6 +222,6 @@ class LanguageIu extends Language {
$flags = array();
$this->mConverter = new IuConverter( $this, 'iu', $variants, $variantfallbacks, $flags );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
}
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 d3d487fe..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' => '؀', # &#x0600;
'/\,/' => '،', # &#x060C;
- '/;/' => '؛', # &#x061B;
+ '/;/' => '؛', # &#x061B;
'/\?/' => '؟', # &#x061F;
- '/%/' => '٪', # &#x066A;
+ '/%/' => '٪', # &#x066A;
'/\*/' => '٭', # &#x066D;
# # Digits -> Arabic
'/0/' => '۰', # &#x06F0;
@@ -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*/;
@@ -391,21 +395,6 @@ class KkConverter extends LanguageConverter {
}
/**
- * We want our external link captions to be converted in variants,
- * so we return the original text instead -{$text}-, except for URLs
- *
- * @param $text string
- * @param $noParse string|bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
- return parent::markNoConversion( $text );
- return $text;
- }
-
- /**
* @param $key string
* @return String
*/
@@ -429,18 +418,18 @@ 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 );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
/**
@@ -450,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 );
@@ -467,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..d25ce714 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,13 @@ class LanguageKsh extends Language {
* @return string
*/
function convertPlural( $count, $forms ) {
- if ( !count( $forms ) ) { return ''; }
+ $forms = $this->handleExplicitPluralForms( $count, $forms );
+ if ( is_string( $forms ) ) {
+ return $forms;
+ }
+ 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 02ec6482..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
@@ -30,7 +30,7 @@ require_once( __DIR__ . '/LanguageKu_ku.php' );
* @ingroup Language
*/
class KuConverter extends LanguageConverter {
- var $mArabicToLatin = array(
+ public $mArabicToLatin = array(
'ب' => 'b', 'ج' => 'c', 'چ' => 'ç', 'د' => 'd', 'ف' => 'f', 'گ' => 'g', 'ھ' => 'h',
'ہ' => 'h', 'ه' => 'h', 'ح' => 'h', 'ژ' => 'j', 'ك' => 'k', 'ک' => 'k', 'ل' => 'l',
'م' => 'm', 'ن' => 'n', 'پ' => 'p', 'ق' => 'q', 'ر' => 'r', 'س' => 's', 'ش' => 'ş',
@@ -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', # &#x0660;
@@ -72,7 +72,7 @@ class KuConverter extends LanguageConverter {
'٩' => '9', # &#x0669;
);
- var $mLatinToArabic = array(
+ public $mLatinToArabic = array(
'b' => 'ب', 'c' => 'ج', 'ç' => 'چ', 'd' => 'د', 'f' => 'ف', 'g' => 'گ',
'h' => 'ه', 'j' => 'ژ', 'k' => 'ک', 'l' => 'ل',
'm' => 'م', 'n' => 'ن', 'p' => 'پ', 'q' => 'ق', 'r' => 'ر', 's' => 'س', 'ş' => 'ش',
@@ -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,29 +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;
- }
-
- /**
- * We want our external link captions to be converted in variants,
- * so we return the original text instead -{$text}-, except for URLs
- *
- * @param $text string
- * @param $noParse bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
- return parent::markNoConversion( $text );
- return $text;
+ }
}
/**
@@ -203,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 );
}
@@ -221,6 +210,7 @@ class KuConverter extends LanguageConverter {
* @return string
*/
function translate( $text, $toVariant ) {
+ $this->loadTables();
/* From Kazakh interface, maybe we need it later
$breaks = '[^\w\x80-\xff]';
// regexp for roman numbers
@@ -267,12 +257,12 @@ 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',
);
$this->mConverter = new KuConverter( $this, 'ku', $variants, $variantfallbacks );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
}
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/LanguageLn.php b/languages/classes/LanguageLn.php
deleted file mode 100644
index d7329d51..00000000
--- a/languages/classes/LanguageLn.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * Lingala (Lingála) 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
- */
-
-/**
- * Lingala (Lingála)
- *
- * @ingroup Language
- */
-class LanguageLn extends Language {
- /**
- * Use singular form for zero
- * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ln
- *
- * @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/LanguageLt.php b/languages/classes/LanguageLt.php
deleted file mode 100644
index ac4ebdad..00000000
--- a/languages/classes/LanguageLt.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * Lithuanian (Lietuvių) 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
- */
-
-/**
- * Lithuanian (Lietuvių)
- *
- * @ingroup Language
- */
-class LanguageLt extends Language {
- /* Word forms (with examples):
- 1 - vienas (1) lapas, dvidešimt vienas (21) lapas
- 2 - trys (3) lapai
- 3 - penkiolika (15) lapų
- */
-
- /**
- * Lithuanian plural forms as per http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#lt
- * @param $count int
- * @param $forms array
- *
- * @return string
- */
- function convertPlural( $count, $forms ) {
- if ( !count( $forms ) ) { return ''; }
-
- // if the number is not mentioned in message, then use $form[0] for singular and $form[1] for plural or zero
- if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
-
- $forms = $this->preConvertPlural( $forms, 3 );
- // Form[0] if n mod 10 is 1 and n mod 100 not in 11..19;
- if ( $count % 10 == 1 && $count % 100 != 11 ) return $forms[0];
- // Forms[1] if n mod 10 in 2..9 and n mod 100 not in 11..19;
- if ( $count % 10 >= 2 && ( $count % 100 < 10 || $count % 100 >= 20 ) ) return $forms[1];
- return $forms[2];
- }
-}
diff --git a/languages/classes/LanguageLv.php b/languages/classes/LanguageLv.php
deleted file mode 100644
index e76f6f93..00000000
--- a/languages/classes/LanguageLv.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * Latvian (Latviešu) 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
- * @copyright Copyright © 2006, Niklas Laxström
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
- * @ingroup Language
- */
-
-/**
- * Latvian (Latviešu)
- *
- * @ingroup Language
- */
-class LanguageLv extends Language {
- /**
- * Plural form transformations. Using the first form for words with the last digit 1, but not for words with the last digits 11, and the second form for all the others.
- *
- * Example: {{plural:{{NUMBEROFARTICLES}}|article|articles}}
- *
- * @param $count Integer
- * @param $forms Array
- * @return String
- */
- function convertPlural( $count, $forms ) {
- if ( !count( $forms ) ) { return ''; }
-
- // @todo FIXME: CLDR defines 3 plural forms instead of 2. Form for 0 is missing.
- // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#lv
- $forms = $this->preConvertPlural( $forms, 2 );
-
- return ( ( $count % 10 == 1 ) && ( $count % 100 != 11 ) ) ? $forms[0] : $forms[1];
- }
-}
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/LanguageMo.php b/languages/classes/LanguageMo.php
deleted file mode 100644
index bf8a10d0..00000000
--- a/languages/classes/LanguageMo.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Moldavian (Молдовеняскэ) 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
- */
-
-/**
- * Moldavian (Молдовеняскэ)
- *
- * @ingroup Language
- */
-class LanguageMo extends Language {
-
- /**
- * @param $count int
- * @param $forms array
- * @return string
- */
- function convertPlural( $count, $forms ) {
- // Plural rules per
- // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#mo
- // Identical to Romanian (ro).
- if ( !count( $forms ) ) { return ''; }
-
- $forms = $this->preConvertPlural( $forms, 3 );
-
- if ( $count == 1 ) {
- $index = 0;
- } elseif ( $count == 0 || ( $count % 100 > 0 && $count % 100 < 20 ) ) {
- $index = 1;
- } else {
- $index = 2;
- }
- return $forms[$index];
- }
-}
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/LanguageQqx.php b/languages/classes/LanguageQqx.php
index 8e2115c3..9d92834d 100644
--- a/languages/classes/LanguageQqx.php
+++ b/languages/classes/LanguageQqx.php
@@ -36,6 +36,6 @@ class LanguageQqx extends Language {
* @return string
*/
function getMessage( $key ) {
- return "($key)";
+ return "($key$*)";
}
}
diff --git a/languages/classes/LanguageRo.php b/languages/classes/LanguageRo.php
deleted file mode 100644
index 0db2ec00..00000000
--- a/languages/classes/LanguageRo.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * Romanian (Română) 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
- */
-
-/**
- * Romanian (Română)
- *
- * @ingroup Language
- */
-class LanguageRo extends Language {
-
- /**
- * @param $count int
- * @param $forms array
- * @return string
- */
- function convertPlural( $count, $forms ) {
- // Plural rules per
- // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ro
- if ( !count( $forms ) ) { return ''; }
-
- $forms = $this->preConvertPlural( $forms, 3 );
-
- if ( $count == 1 ) {
- $index = 0;
- } elseif ( $count == 0 || ( $count % 100 > 0 && $count % 100 < 20 ) ) {
- $index = 1;
- } else {
- $index = 2;
- }
- return $forms[$index];
- }
-}
diff --git a/languages/classes/LanguageRu.php b/languages/classes/LanguageRu.php
index 6407e156..d3ac1d22 100644
--- a/languages/classes/LanguageRu.php
+++ b/languages/classes/LanguageRu.php
@@ -44,89 +44,63 @@ class LanguageRu extends Language {
return $wgGrammarForms['ru'][$case][$word];
}
- # These rules are not perfect, but they are currently only used for site names so it doesn't
- # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
+ # These rules are not perfect, but they are currently only used for Wikimedia
+ # site names so it doesn't matter if they are wrong sometimes.
+ # Just add a special case for your site name if necessary.
- # join and array_slice instead mb_substr
- $ar = array();
- preg_match_all( '/./us', $word, $ar );
- if ( !preg_match( "/[a-zA-Z_]/us", $word ) )
+ # substr doesn't support Unicode and mb_substr has issues,
+ # so break it to characters using preg_match_all and then use array_slice and join
+ $chars = array();
+ preg_match_all( '/./us', $word, $chars );
+ 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 ) ) == 'ь' )
- $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'я';
- elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ия' )
- $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ии';
- elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ка' )
- $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ки';
- elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ти' )
- $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'тей';
- elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ды' )
- $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'дов';
- elseif ( join( '', array_slice( $ar[0], -3 ) ) == 'ник' )
- $word = join( '', array_slice( $ar[0], 0, -3 ) ) . 'ника';
+ if ( join( '', array_slice( $chars[0], -1 ) ) === 'ь' ) {
+ $word = join( '', array_slice( $chars[0], 0, -1 ) ) . 'я';
+ } elseif ( join( '', array_slice( $chars[0], -2 ) ) === 'ия' ) {
+ $word = join( '', array_slice( $chars[0], 0, -2 ) ) . 'ии';
+ } elseif ( join( '', array_slice( $chars[0], -2 ) ) === 'ка' ) {
+ $word = join( '', array_slice( $chars[0], 0, -2 ) ) . 'ки';
+ } elseif ( join( '', array_slice( $chars[0], -2 ) ) === 'ти' ) {
+ $word = join( '', array_slice( $chars[0], 0, -2 ) ) . 'тей';
+ } elseif ( join( '', array_slice( $chars[0], -2 ) ) === 'ды' ) {
+ $word = join( '', array_slice( $chars[0], 0, -2 ) ) . 'дов';
+ } elseif ( join( '', array_slice( $chars[0], -3 ) ) === 'ник' ) {
+ $word = join( '', array_slice( $chars[0], 0, -3 ) ) . 'ника';
+ } elseif ( join( '', array_slice( $chars[0], -3 ) ) === 'ные' ) {
+ $word = join( '', array_slice( $chars[0], 0, -3 ) ) . 'ных';
+ }
break;
- case 'dative': # дательный падеж
+ case 'dative': # дательный падеж
# stub
break;
case 'accusative': # винительный падеж
# stub
break;
- case 'instrumental': # творительный падеж
+ case 'instrumental': # творительный падеж
# stub
break;
case 'prepositional': # предложный падеж
- # stub
+ if ( join( '', array_slice( $chars[0], -1 ) ) === 'ь' ) {
+ $word = join( '', array_slice( $chars[0], 0, -1 ) ) . 'е';
+ } elseif ( join( '', array_slice( $chars[0], -2 ) ) === 'ия' ) {
+ $word = join( '', array_slice( $chars[0], 0, -2 ) ) . 'ии';
+ } elseif ( join( '', array_slice( $chars[0], -2 ) ) === 'ка' ) {
+ $word = join( '', array_slice( $chars[0], 0, -2 ) ) . 'ке';
+ } elseif ( join( '', array_slice( $chars[0], -2 ) ) === 'ти' ) {
+ $word = join( '', array_slice( $chars[0], 0, -2 ) ) . 'тях';
+ } elseif ( join( '', array_slice( $chars[0], -2 ) ) === 'ды' ) {
+ $word = join( '', array_slice( $chars[0], 0, -2 ) ) . 'дах';
+ } elseif ( join( '', array_slice( $chars[0], -3 ) ) === 'ник' ) {
+ $word = join( '', array_slice( $chars[0], 0, -3 ) ) . 'нике';
+ } elseif ( join( '', array_slice( $chars[0], -3 ) ) === 'ные' ) {
+ $word = join( '', array_slice( $chars[0], 0, -3 ) ) . 'ных';
+ }
break;
}
- return $word;
- }
-
- /**
- * Plural form transformations
- *
- * $forms[0] - singular form (for 1, 21, 31, 41...)
- * $forms[1] - paucal form (for 2, 3, 4, 22, 23, 24, 32, 33, 34...)
- * $forms[2] - plural form (for 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26...)
- *
- * Examples:
- * message with number
- * "Сделано $1 {{PLURAL:$1|изменение|изменения|изменений}}"
- * ("$1 change[s] were made)
- * message without number
- * "Действие не может быть выполнено по {{PLURAL:$1|следующей причине|следующим причинам}}:"
- * ("The action cannot be performed for the following reason[s]")
- * @param $count int
- * @param $forms array
- *
- * @return string
- */
- function convertPlural( $count, $forms ) {
- 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];
-
- // @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#ru
- $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];
- }
}
+
+ return $word;
}
/**
diff --git a/languages/classes/LanguageSe.php b/languages/classes/LanguageSe.php
deleted file mode 100644
index 25b61c30..00000000
--- a/languages/classes/LanguageSe.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * Northern Sami (Sámegiella) 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 Sami (Sámegiella)
- *
- * @ingroup Language
- */
-class LanguageSe extends Language {
-
- /**
- * @param $count int
- * @param $forms array
- * @return string
- */
- function convertPlural( $count, $forms ) {
- if ( !count( $forms ) ) { return ''; }
-
- // plural forms per http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#se
- $forms = $this->preConvertPlural( $forms, 3 );
-
- if ( $count == 1 ) {
- $index = 0;
- } elseif ( $count == 2 ) {
- $index = 1;
- } else {
- $index = 2;
- }
- return $forms[$index];
- }
-}
diff --git a/languages/classes/LanguageSgs.php b/languages/classes/LanguageSgs.php
deleted file mode 100644
index 0c74e450..00000000
--- a/languages/classes/LanguageSgs.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * Samogitian (Žemaitėška) 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
- */
-
-/**
- * Samogitian (Žemaitėška)
- *
- * @ingroup Language
- */
-class LanguageSgs extends Language {
-
- /**
- * @param $count int
- * @param $forms array
- * @return string
- */
- function convertPlural( $count, $forms ) {
- if ( !count( $forms ) ) { return ''; }
- $forms = $this->preConvertPlural( $forms, 4 );
-
- $count = abs( $count );
- if ( $count == 0 || ( $count % 100 === 0 || ( $count % 100 >= 10 && $count % 100 < 20 ) ) ) {
- return $forms[2];
- } elseif ( $count % 10 === 1 ) {
- return $forms[0];
- } elseif ( $count % 10 === 2 ) {
- return $forms[1];
- } else {
- return $forms[3];
- }
- }
-}
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 27c5d64f..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.
@@ -39,28 +39,28 @@ class ShiConverter extends LanguageConverter {
protected $mDoContentConvert;
- var $mToLatin = array(
+ 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',
);
- var $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',
+ 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',
'Z' => 'z', 'Ɣ' => 'ɣ',
);
- var $mToTifinagh = array(
+ 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,32 +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;
- }
-
- /**
- * We want our external link captions to be converted in variants,
- * so we return the original text instead -{$text}-, except for URLs
- *
- * @param $text string
- * @param $noParse bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
- return parent::markNoConversion( $text );
- return $text;
+ }
}
/**
@@ -162,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 );
}
@@ -183,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 );
@@ -205,13 +194,13 @@ 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',
);
$flags = array();
$this->mConverter = new ShiConverter( $this, 'shi', $variants, $variantfallbacks, $flags );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
}
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/LanguageSma.php b/languages/classes/LanguageSma.php
deleted file mode 100644
index 19618710..00000000
--- a/languages/classes/LanguageSma.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * Southern Sami (Åarjelsaemien) 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
- */
-
-/**
- * Southern Sami (Åarjelsaemien)
- *
- * @ingroup Language
- */
-class LanguageSma extends Language {
-
- /**
- * @param $count int
- * @param $forms array
- * @return string
- */
- function convertPlural( $count, $forms ) {
- if ( !count( $forms ) ) { return ''; }
-
- // plural forms per http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sma
- $forms = $this->preConvertPlural( $forms, 3 );
-
- if ( $count == 1 ) {
- $index = 0;
- } elseif ( $count == 2 ) {
- $index = 1;
- } else {
- $index = 2;
- }
- return $forms[$index];
- }
-}
diff --git a/languages/classes/LanguageSr.php b/languages/classes/LanguageSr.php
index 4b799f28..76cd8229 100644
--- a/languages/classes/LanguageSr.php
+++ b/languages/classes/LanguageSr.php
@@ -21,9 +21,7 @@
* @ingroup Language
*/
-require_once( __DIR__ . '/../LanguageConverter.php' );
-require_once( __DIR__ . '/LanguageSr_ec.php' );
-require_once( __DIR__ . '/LanguageSr_el.php' );
+require_once __DIR__ . '/../LanguageConverter.php';
/**
* There are two levels of conversion for Serbian: the script level
@@ -35,7 +33,7 @@ require_once( __DIR__ . '/LanguageSr_el.php' );
* @ingroup Language
*/
class SrConverter extends LanguageConverter {
- var $mToLatin = array(
+ public $mToLatin = array(
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd',
'ђ' => 'đ', 'е' => 'e', 'ж' => 'ž', 'з' => 'z', 'и' => 'i',
'ј' => 'j', 'к' => 'k', 'л' => 'l', 'љ' => 'lj', 'м' => 'm',
@@ -51,7 +49,7 @@ class SrConverter extends LanguageConverter {
'Х' => 'H', 'Ц' => 'C', 'Ч' => 'Č', 'Џ' => 'Dž', 'Ш' => 'Š',
);
- var $mToCyrillics = array(
+ public $mToCyrillics = array(
'a' => 'а', 'b' => 'б', 'c' => 'ц', 'č' => 'ч', 'ć' => 'ћ',
'd' => 'д', 'dž' => 'џ', 'đ' => 'ђ', 'e' => 'е', 'f' => 'ф',
'g' => 'г', 'h' => 'х', 'i' => 'и', 'j' => 'ј', 'k' => 'к',
@@ -75,7 +73,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,29 +116,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;
- }
-
- /**
- * We want our external link captions to be converted in variants,
- * so we return the original text instead -{$text}-, except for URLs
- *
- * @param $text string
- * @param $noParse bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
- return parent::markNoConversion( $text );
- return $text;
+ }
}
/**
@@ -154,9 +139,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 );
}
@@ -177,13 +164,16 @@ class SrConverter extends LanguageConverter {
// regexp for roman numbers
$roman = 'M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})';
- $reg = '/^' . $roman . '$|^' . $roman . $breaks . '|' . $breaks . $roman . '$|' . $breaks . $roman . $breaks . '/';
+ $reg = '/^' . $roman . '$|^' . $roman . $breaks . '|' . $breaks
+ . $roman . '$|' . $breaks . $roman . $breaks . '/';
$matches = preg_split( $reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
$m = array_shift( $matches );
+ $this->loadTables();
if ( !isset( $this->mTables[$toVariant] ) ) {
- throw new MWException( "Broken variant table: " . implode( ',', array_keys( $this->mTables ) ) );
+ throw new MWException( "Broken variant table: "
+ . implode( ',', array_keys( $this->mTables ) ) );
}
$ret = $this->mTables[$toVariant]->replace( $m[0] );
$mstart = $m[1] + strlen( $m[0] );
@@ -208,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;
}
@@ -228,7 +218,7 @@ class SrConverter extends LanguageConverter {
*
* @ingroup Language
*/
-class LanguageSr extends LanguageSr_ec {
+class LanguageSr extends Language {
function __construct() {
global $wgHooks;
@@ -236,52 +226,16 @@ 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['ArticleSaveComplete'][] = $this->mConverter;
- }
-
- /**
- * @param $count int
- * @param $forms array
- *
- * @return string
- */
- function convertPlural( $count, $forms ) {
- 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];
- }
-
- // @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#ru
- $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];
- }
- }
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
}
diff --git a/languages/classes/LanguageSr_ec.php b/languages/classes/LanguageSr_ec.php
deleted file mode 100644
index 352e2930..00000000
--- a/languages/classes/LanguageSr_ec.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * Serbian (cyrillic script) 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
- */
-
-/**
- * Serbian (cyrillic script)
- *
- * @ingroup Language
- */
-class LanguageSr_ec 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 > 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/LanguageSr_el.php b/languages/classes/LanguageSr_el.php
deleted file mode 100644
index 0e36d6c3..00000000
--- a/languages/classes/LanguageSr_el.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * Serbian (latin script) 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
- */
-
-/**
- * Serbian (latin script)
- *
- * @ingroup Language
- */
-class LanguageSr_el 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 > 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/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..08041a92 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,38 +82,8 @@ class LanguageUk extends Language {
# stub
break;
}
- return $word;
- }
-
- /**
- * @param $count int
- * @param $forms array
- * @return string
- */
- function convertPlural( $count, $forms ) {
- 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];
-
- // @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
- $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];
- }
}
+ return $word;
}
/**
diff --git a/languages/classes/LanguageUz.php b/languages/classes/LanguageUz.php
index bd69e307..aa3e4f24 100644
--- a/languages/classes/LanguageUz.php
+++ b/languages/classes/LanguageUz.php
@@ -21,13 +21,13 @@
* @ingroup Language
*/
-require_once( __DIR__ . '/../LanguageConverter.php' );
+require_once __DIR__ . '/../LanguageConverter.php';
/**
* @ingroup Language
*/
class UzConverter extends LanguageConverter {
- var $toLatin = array(
+ public $toLatin = array(
'а' => 'a', 'А' => 'A',
'б' => 'b', 'Б' => 'B',
'д' => 'd', 'Д' => 'D',
@@ -65,7 +65,7 @@ class UzConverter extends LanguageConverter {
'ъ' => 'ʼ',
);
- var $toCyrillic = array(
+ public $toCyrillic = array(
'a' => 'а', 'A' => 'А',
'b' => 'б', 'B' => 'Б',
'd' => 'д', 'D' => 'Д',
@@ -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,12 +126,12 @@ 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',
);
$this->mConverter = new UzConverter( $this, 'uz', $variants, $variantfallbacks );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
}
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 63f90fd9..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
);
}
@@ -88,20 +88,6 @@ class ZhConverter extends LanguageConverter {
}
/**
- * there shouldn't be any latin text in Chinese conversion, so no need
- * to mark anything.
- * $noParse is there for compatibility with LanguageConvert::markNoConversion
- *
- * @param $text string
- * @param $noParse bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- return $text;
- }
-
- /**
* @param $key string
* @return String
*/
@@ -125,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',
);
@@ -146,7 +132,7 @@ class LanguageZh extends LanguageZh_hans {
array(),
$ml );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
/**
@@ -156,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 );
}
/**
@@ -166,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 d95c42ea..3851c8fe 100644
--- a/languages/classes/LanguageZh_hans.php
+++ b/languages/classes/LanguageZh_hans.php
@@ -65,4 +65,33 @@ class LanguageZh_hans extends Language {
wfProfileOut( __METHOD__ );
return $s;
}
+
+ /**
+ * Takes a number of seconds and turns it into a text using values such as hours and minutes.
+ *
+ * @since 1.21
+ *
+ * @param integer $seconds The amount of seconds.
+ * @param array $chosenIntervals The intervals to enable.
+ *
+ * @return string
+ */
+ public function formatDuration( $seconds, array $chosenIntervals = array() ) {
+ if ( empty( $chosenIntervals ) ) {
+ $chosenIntervals = array( 'centuries', 'years', 'days', 'hours', 'minutes', 'seconds' );
+ }
+
+ $intervals = $this->getDurationIntervals( $seconds, $chosenIntervals );
+
+ $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();
+ }
+
+ return implode( '', $segments );
+ }
}