summaryrefslogtreecommitdiff
path: root/languages/classes
diff options
context:
space:
mode:
Diffstat (limited to 'languages/classes')
-rw-r--r--languages/classes/LanguageEo.php2
-rw-r--r--languages/classes/LanguageFi.php2
-rw-r--r--languages/classes/LanguageGan.php16
-rw-r--r--languages/classes/LanguageHe.php11
-rw-r--r--languages/classes/LanguageHy.php13
-rw-r--r--languages/classes/LanguageIu.php23
-rw-r--r--languages/classes/LanguageKk.php17
-rw-r--r--languages/classes/LanguageKu.php22
-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/LanguageMo.php53
-rw-r--r--languages/classes/LanguageQqx.php2
-rw-r--r--languages/classes/LanguageRo.php52
-rw-r--r--languages/classes/LanguageRu.php95
-rw-r--r--languages/classes/LanguageSe.php51
-rw-r--r--languages/classes/LanguageSgs.php52
-rw-r--r--languages/classes/LanguageShi.php23
-rw-r--r--languages/classes/LanguageSma.php51
-rw-r--r--languages/classes/LanguageSr.php22
-rw-r--r--languages/classes/LanguageUz.php6
-rw-r--r--languages/classes/LanguageZh.php16
-rw-r--r--languages/classes/LanguageZh_hans.php27
23 files changed, 117 insertions, 591 deletions
diff --git a/languages/classes/LanguageEo.php b/languages/classes/LanguageEo.php
index 3c162480..8f843224 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(
diff --git a/languages/classes/LanguageFi.php b/languages/classes/LanguageFi.php
index 1865cc5c..6a2820d1 100644
--- a/languages/classes/LanguageFi.php
+++ b/languages/classes/LanguageFi.php
@@ -102,7 +102,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/LanguageGan.php b/languages/classes/LanguageGan.php
index 14fe9282..0d652d43 100644
--- a/languages/classes/LanguageGan.php
+++ b/languages/classes/LanguageGan.php
@@ -67,20 +67,6 @@ class GanConverter 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
*/
@@ -116,7 +102,7 @@ class LanguageGan extends LanguageZh {
array(),
$ml );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
/**
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/LanguageHy.php b/languages/classes/LanguageHy.php
index 9c155951..50798131 100644
--- a/languages/classes/LanguageHy.php
+++ b/languages/classes/LanguageHy.php
@@ -78,19 +78,6 @@ class LanguageHy extends Language {
}
/**
- * @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..fe5cdf8d 100644
--- a/languages/classes/LanguageIu.php
+++ b/languages/classes/LanguageIu.php
@@ -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' => 'ᑖ',
@@ -158,21 +158,6 @@ class IuConverter 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 bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
- return parent::markNoConversion( $text );
- return $text;
- }
-
- /**
* An ugly function wrapper for parsing Image titles
* (to prevent image name conversion)
*
@@ -233,6 +218,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/LanguageKk.php b/languages/classes/LanguageKk.php
index d3d487fe..6dd6959f 100644
--- a/languages/classes/LanguageKk.php
+++ b/languages/classes/LanguageKk.php
@@ -391,21 +391,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
*/
@@ -440,7 +425,7 @@ class LanguageKk extends LanguageKk_cyrl {
$this->mConverter = new KkConverter( $this, 'kk', $variants, $variantfallbacks );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
/**
diff --git a/languages/classes/LanguageKu.php b/languages/classes/LanguageKu.php
index 02ec6482..56a52ccb 100644
--- a/languages/classes/LanguageKu.php
+++ b/languages/classes/LanguageKu.php
@@ -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', 'ش' => 'ş',
@@ -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' => 'س', 'ş' => 'ش',
@@ -178,21 +178,6 @@ class KuConverter 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 bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
- return parent::markNoConversion( $text );
- return $text;
- }
-
- /**
* An ugly function wrapper for parsing Image titles
* (to prevent image name conversion)
*
@@ -221,6 +206,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
@@ -273,6 +259,6 @@ class LanguageKu extends LanguageKu_ku {
);
$this->mConverter = new KuConverter( $this, 'ku', $variants, $variantfallbacks );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
}
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/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/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..11b42cf9 100644
--- a/languages/classes/LanguageRu.php
+++ b/languages/classes/LanguageRu.php
@@ -44,43 +44,61 @@ 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
+ # 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;
}
@@ -104,28 +122,35 @@ class LanguageRu extends Language {
* @return string
*/
function convertPlural( $count, $forms ) {
- if ( !count( $forms ) ) { return ''; }
+ if ( !count( $forms ) ) {
+ return '';
+ }
// If the actual number is not mentioned in the expression, then just two forms are enough:
- // singular for $count == 1
- // plural for $count != 1
+ // singular for $count === 1
+ // plural for $count !== 1
// For example, "This user belongs to {{PLURAL:$1|one group|several groups}}."
- if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
+ if ( count( $forms ) === 2 ) {
+ return $count === 1 ? $forms[0] : $forms[1];
+ }
// @todo FIXME: CLDR defines 4 plural forms. Form 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 ) {
+ if ( $count > 10 && (int)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];
- }
+ }
+
+ 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/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/LanguageShi.php b/languages/classes/LanguageShi.php
index 27c5d64f..5ddcfdef 100644
--- a/languages/classes/LanguageShi.php
+++ b/languages/classes/LanguageShi.php
@@ -39,7 +39,7 @@ 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',
@@ -48,7 +48,7 @@ class ShiConverter extends LanguageConverter {
'ⵥ' => 'ẓ', 'ⵯ' => 'ʷ', 'ⵖ' => 'ɣ', 'ⵠ' => 'v', 'ⵒ' => 'p',
);
- 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',
@@ -57,7 +57,7 @@ class ShiConverter extends LanguageConverter {
'Z' => 'z', 'Ɣ' => 'ɣ',
);
- var $mToTifinagh = array(
+ public $mToTifinagh = array(
'a' => 'ⴰ', 'b' => 'ⴱ', 'g' => 'ⴳ', 'd' => 'ⴷ', 'ḍ' => 'ⴹ', 'e' => 'ⴻ',
'f' => 'ⴼ', 'k' => 'ⴽ', 'h' => 'ⵀ', 'ḥ' => 'ⵃ', 'ε' => 'ⵄ', 'x' => 'ⵅ',
'q' => 'ⵇ', 'i' => 'ⵉ', 'j' => 'ⵊ', 'l' => 'ⵍ', 'm' => 'ⵎ', 'n' => 'ⵏ',
@@ -137,21 +137,6 @@ class ShiConverter 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 bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
- return parent::markNoConversion( $text );
- return $text;
- }
-
- /**
* An ugly function wrapper for parsing Image titles
* (to prevent image name conversion)
*
@@ -212,6 +197,6 @@ class LanguageShi extends Language {
$flags = array();
$this->mConverter = new ShiConverter( $this, 'shi', $variants, $variantfallbacks, $flags );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
}
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..55aec32e 100644
--- a/languages/classes/LanguageSr.php
+++ b/languages/classes/LanguageSr.php
@@ -35,7 +35,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 +51,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' => 'к',
@@ -129,21 +129,6 @@ class SrConverter 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 bool
- *
- * @return string
- */
- function markNoConversion( $text, $noParse = false ) {
- if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
- return parent::markNoConversion( $text );
- return $text;
- }
-
- /**
* An ugly function wrapper for parsing Image titles
* (to prevent image name conversion)
*
@@ -182,6 +167,7 @@ class SrConverter extends LanguageConverter {
$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 ) ) );
}
@@ -246,7 +232,7 @@ class LanguageSr extends LanguageSr_ec {
'W' => 'W', 'реч' => 'W', 'reč' => 'W', 'ријеч' => 'W', 'riječ' => 'W'
);
$this->mConverter = new SrConverter( $this, 'sr', $variants, $variantfallbacks, $flags );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
/**
diff --git a/languages/classes/LanguageUz.php b/languages/classes/LanguageUz.php
index bd69e307..a2c917cd 100644
--- a/languages/classes/LanguageUz.php
+++ b/languages/classes/LanguageUz.php
@@ -27,7 +27,7 @@ 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' => 'Д',
@@ -132,6 +132,6 @@ class LanguageUz extends Language {
);
$this->mConverter = new UzConverter( $this, 'uz', $variants, $variantfallbacks );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
}
diff --git a/languages/classes/LanguageZh.php b/languages/classes/LanguageZh.php
index 63f90fd9..04767f2d 100644
--- a/languages/classes/LanguageZh.php
+++ b/languages/classes/LanguageZh.php
@@ -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
*/
@@ -146,7 +132,7 @@ class LanguageZh extends LanguageZh_hans {
array(),
$ml );
- $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
}
/**
diff --git a/languages/classes/LanguageZh_hans.php b/languages/classes/LanguageZh_hans.php
index d95c42ea..04b2e16a 100644
--- a/languages/classes/LanguageZh_hans.php
+++ b/languages/classes/LanguageZh_hans.php
@@ -65,4 +65,31 @@ 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 ) {
+ $message = wfMessage( 'duration-' . $intervalName )->numParams( $intervalValue );
+ $segments[] = $message->inLanguage( $this )->escaped();
+ }
+
+ return implode( '', $segments );
+ }
}