summaryrefslogtreecommitdiff
path: root/languages/classes
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-01-11 19:06:07 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-01-11 19:06:07 +0000
commita58285fd06c8113c45377c655dd43cef6337e815 (patch)
treedfe31d3d12652352fe44890b4811eda0728faefb /languages/classes
parent20194986f6638233732ba1fc3e838f117d3cc9ea (diff)
Aktualisierung auf MediaWiki 1.9.0
Diffstat (limited to 'languages/classes')
-rw-r--r--languages/classes/LanguageBe.php2
-rw-r--r--languages/classes/LanguageBs.php2
-rw-r--r--languages/classes/LanguageCs.php2
-rw-r--r--languages/classes/LanguageCu.php50
-rw-r--r--languages/classes/LanguageFi.php53
-rw-r--r--languages/classes/LanguageFr.php2
-rw-r--r--languages/classes/LanguageHe.php6
-rw-r--r--languages/classes/LanguageHr.php2
-rw-r--r--languages/classes/LanguageHsb.php117
-rw-r--r--languages/classes/LanguageKk.deps.php12
-rw-r--r--languages/classes/LanguageKk.php210
-rw-r--r--languages/classes/LanguageKk_kz.php269
-rw-r--r--languages/classes/LanguageKsh.php5
-rw-r--r--languages/classes/LanguageLt.php10
-rw-r--r--languages/classes/LanguageLv.php2
-rw-r--r--languages/classes/LanguagePt_br.php2
-rw-r--r--languages/classes/LanguageRu.php2
-rw-r--r--languages/classes/LanguageSk.php4
-rw-r--r--languages/classes/LanguageSr.php71
-rw-r--r--languages/classes/LanguageSr_ec.php2
-rw-r--r--languages/classes/LanguageSr_el.php2
-rw-r--r--languages/classes/LanguageZh.php22
22 files changed, 749 insertions, 100 deletions
diff --git a/languages/classes/LanguageBe.php b/languages/classes/LanguageBe.php
index f2a52cca..553d2ad3 100644
--- a/languages/classes/LanguageBe.php
+++ b/languages/classes/LanguageBe.php
@@ -12,7 +12,7 @@
*/
class LanguageBe extends Language {
- function convertPlural( $count, $wordform1, $wordform2, $wordform3) {
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
$count = str_replace ('.', '', $count);
if ($count > 10 && floor(($count % 100) / 10) == 1) {
return $wordform3;
diff --git a/languages/classes/LanguageBs.php b/languages/classes/LanguageBs.php
index 4734fdc1..92d00090 100644
--- a/languages/classes/LanguageBs.php
+++ b/languages/classes/LanguageBs.php
@@ -7,7 +7,7 @@
class LanguageBs extends Language {
- function convertPlural( $count, $wordform1, $wordform2, $wordform3) {
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
$count = str_replace ('.', '', $count);
if ($count > 10 && floor(($count % 100) / 10) == 1) {
return $wordform3;
diff --git a/languages/classes/LanguageCs.php b/languages/classes/LanguageCs.php
index 6b8d3d61..bd2f33a3 100644
--- a/languages/classes/LanguageCs.php
+++ b/languages/classes/LanguageCs.php
@@ -67,7 +67,7 @@ class LanguageCs extends Language {
# Plural form transformations, needed for some languages.
# Invoked by {{plural:count|wordform1|wordform2|wordform3}}
- function convertPlural( $count, $wordform1, $wordform2, $wordform3) {
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
$count = str_replace( '\xc2\xa0', '', $count );
switch ( $count ) {
case 1:
diff --git a/languages/classes/LanguageCu.php b/languages/classes/LanguageCu.php
new file mode 100644
index 00000000..f30bd253
--- /dev/null
+++ b/languages/classes/LanguageCu.php
@@ -0,0 +1,50 @@
+<?php
+/** Old Church Slavonic (Ѩзыкъ словѣньскъ)
+ *
+ * @package MediaWiki
+ * @subpackage Language
+ */
+
+/* Please, see Language.php for general function comments */
+class LanguageCu extends Language {
+ # Convert from the nominative form of a noun to some other case
+ # Invoked with {{grammar:case|word}}
+ function convertGrammar( $word, $case ) {
+ global $wgGrammarForms;
+ if ( isset($wgGrammarForms['сu'][$case][$word]) ) {
+ return $wgGrammarForms['сu'][$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.
+
+ #join and array_slice instead mb_substr
+ $ar = array();
+ preg_match_all( '/./us', $word, $ar );
+ 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))=='ї')
+ $word = join('',array_slice($ar[0],0,-2)).'їѩ';
+ break;
+ case 'accusative': #винительный падеж
+ #stub
+ break;
+ }
+ return $word;
+ }
+
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $wordform4, $w5) {
+ switch ($count % 10) {
+ case 1: return $wordform1;
+ case 2: return $wordform2;
+ case 3: return $wordform3;
+ case 4: return $wordform3;
+ default: return $wordform4;
+ }
+ }
+
+}
+?>
diff --git a/languages/classes/LanguageFi.php b/languages/classes/LanguageFi.php
index 47dd0e65..8fc25499 100644
--- a/languages/classes/LanguageFi.php
+++ b/languages/classes/LanguageFi.php
@@ -28,57 +28,32 @@ class LanguageFi extends Language {
# 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.
+
+ # wovel harmony flag
+ $aou = preg_match( '/[aou][^äöy]*$/i', $word );
+
+ # append i after final consonant
+ if ( preg_match( '/[bcdfghjklmnpqrstvwxz]$/i', $word ) )
+ $word .= 'i';
+
switch ( $case ) {
case 'genitive':
- if ( $word == 'Wikisitaatit' ) {
- $word = 'Wikisitaattien';
- } else {
- $word .= 'n';
- }
- break;
+ $word .= 'n';
+ break;
case 'elative':
- if ( $word == 'Wikisitaatit' ) {
- $word = 'Wikisitaateista';
- } else {
- if ( mb_substr($word, -1) == 'y' ) {
- $word .= 'stä';
- } else {
- $word .= 'sta';
- }
- }
+ $word .= ($aou ? 'sta' : 'stä');
break;
case 'partitive':
- if ( $word == 'Wikisitaatit' ) {
- $word = 'Wikisitaatteja';
- } else {
- if ( mb_substr($word, -1) == 'y' ) {
- $word .= 'ä';
- } else {
- $word .= 'a';
- }
- }
+ $word .= ($aou ? 'a' : 'ä');
break;
case 'illative':
# Double the last letter and add 'n'
# mb_substr has a compatibility function in GlobalFunctions.php
- if ( $word == 'Wikisitaatit' ) {
- $word = 'Wikisitaatteihin';
- } else {
- $word = $word . mb_substr($word,-1) . 'n';
- }
+ $word = $word . mb_substr($word, -1) . 'n';
break;
case 'inessive':
- if ( $word == 'Wikisitaatit' ) {
- $word = 'Wikisitaateissa';
- } else {
- if ( mb_substr($word, -1) == 'y' ) {
- $word .= 'ssä';
- } else {
- $word .= 'ssa';
- }
- }
+ $word .= ($aou ? 'ssa' : 'ssä');
break;
-
}
return $word;
}
diff --git a/languages/classes/LanguageFr.php b/languages/classes/LanguageFr.php
index 61cd91c6..b150ceff 100644
--- a/languages/classes/LanguageFr.php
+++ b/languages/classes/LanguageFr.php
@@ -10,7 +10,7 @@ class LanguageFr extends Language {
/**
* Use singular form for zero (see bug 7309)
*/
- function convertPlural( $count, $w1, $w2, $w3) {
+ function convertPlural( $count, $w1, $w2, $w3, $w4, $w5) {
return $count <= '1' ? $w1 : $w2;
}
}
diff --git a/languages/classes/LanguageHe.php b/languages/classes/LanguageHe.php
index 70de3115..e84d45d8 100644
--- a/languages/classes/LanguageHe.php
+++ b/languages/classes/LanguageHe.php
@@ -52,11 +52,13 @@ class LanguageHe extends Language {
* @param integer the number of items
* @param string the first form (singular)
* @param string the second form (plural)
- * @param string the third form (2 items, plural is used if not applicable and not specified)
+ * @param string the third form (2 items, plural is used if not applicable and not specified
+ * @param not used (for compatibility with ancestor)
+ * @param not used (for compatibility with ancestor)
*
* @return string of the suited form of word
*/
- public function convertPlural( $count, $w1, $w2, $w3) {
+ public function convertPlural( $count, $w1, $w2, $w3, $w4, $w5) {
if ( $count == '1' ) {
return $w1;
} elseif ( $count == '2' && $w3 ) {
diff --git a/languages/classes/LanguageHr.php b/languages/classes/LanguageHr.php
index b1f6b0fc..537c142d 100644
--- a/languages/classes/LanguageHr.php
+++ b/languages/classes/LanguageHr.php
@@ -6,7 +6,7 @@
*/
class LanguageHr extends Language {
- function convertPlural( $count, $wordform1, $wordform2, $wordform3) {
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
$count = str_replace ('.', '', $count);
if ($count > 10 && floor(($count % 100) / 10) == 1) {
return $wordform3;
diff --git a/languages/classes/LanguageHsb.php b/languages/classes/LanguageHsb.php
new file mode 100644
index 00000000..08163b72
--- /dev/null
+++ b/languages/classes/LanguageHsb.php
@@ -0,0 +1,117 @@
+<?php
+/** Upper Sorbian (Hornjoserbsce)
+ *
+ * @package MediaWiki
+ * @subpackage Language
+ */
+
+class LanguageHsb extends Language {
+
+ # Convert from the nominative form of a noun to some other case
+ # Invoked with {{GRAMMAR:case|word}}
+
+ function convertGrammar( $word, $case ) {
+ global $wgGrammarForms;
+ if ( isset( $wgGrammarForms['hsb'][$case][$word] ) ) {
+ return $wgGrammarForms['hsb'][$case][$word];
+ }
+
+ switch ( $case ) {
+ case 'genitiw': # genitive
+ if ( $word == 'Wikipedija' ) {
+ $word = 'Wikipedije';
+ } elseif ( $word == 'Wikiknihi' ) {
+ $word = 'Wikiknih';
+ } elseif ( $word == 'Wikinowiny' ) {
+ $word = 'Wikinowin';
+ } elseif ( $word == 'Wikižórło' ) {
+ $word = 'Wikižórła';
+ } elseif ( $word == 'Wikicitaty' ) {
+ $word = 'Wikicitatow';
+ } elseif ( $word == 'Wikisłownik' ) {
+ $word = 'Wikisłownika';
+ }
+ break;
+ case 'datiw': # dativ
+ if ( $word == 'Wikipedija' ) {
+ $word = 'Wikipediji';
+ } elseif ( $word == 'Wikiknihi' ) {
+ $word = 'Wikikniham';
+ } elseif ( $word == 'Wikinowiny' ) {
+ $word = 'Wikinowinam';
+ } elseif ( $word == 'Wikižórło' ) {
+ $word = 'Wikižórłu';
+ } elseif ( $word == 'Wikicitaty' ) {
+ $word = 'Wikicitatam';
+ } elseif ( $word == 'Wikisłownik' ) {
+ $word = 'Wikisłownikej';
+ }
+ break;
+ case 'akuzativ': # akuzativ
+ if ( $word == 'Wikipedija' ) {
+ $word = 'Wikipediju';
+ } elseif ( $word == 'Wikiknihi' ) {
+ $word = 'Wikiknknihi';
+ } elseif ( $word == 'Wikinowiny' ) {
+ $word = 'Wikinowiny';
+ } elseif ( $word == 'Wikižórło' ) {
+ $word = 'Wikižórło';
+ } elseif ( $word == 'Wikicitaty' ) {
+ $word = 'Wikicitaty';
+ } elseif ( $word == 'Wikisłownik' ) {
+ $word = 'Wikisłownik';
+ }
+ break;
+ case 'instrumental': # instrumental
+ if ( $word == 'Wikipedija' ) {
+ $word = 'Wikipediju';
+ } elseif ( $word == 'Wikiknihi' ) {
+ $word = 'Wikiknihami';
+ } elseif ( $word == 'Wikinowiny' ) {
+ $word = 'Wikinowinami';
+ } elseif ( $word == 'Wikižórło' ) {
+ $word = 'Wikižórłom';
+ } elseif ( $word == 'Wikicitaty' ) {
+ $word = 'Wikicitatami';
+ } elseif ( $word == 'Wikisłownik' ) {
+ $word = 'Wikisłownikom';
+ } else {
+ $word = 'z ' . $word;
+ }
+ break;
+ case 'lokatiw': # lokatiw
+ if ( $word == 'Wikipedija' ) {
+ $word = 'Wikipediji';
+ } elseif ( $word == 'Wikiknihi' ) {
+ $word = 'Wikiknihach';
+ } elseif ( $word == 'Wikinowiny' ) {
+ $word = 'Wikinowinach';
+ } elseif ( $word == 'Wikižórło' ) {
+ $word = 'Wikižórłu';
+ } elseif ( $word == 'Wikicitaty' ) {
+ $word = 'Wikicitatach';
+ } elseif ( $word == 'Wikisłownik' ) {
+ $word = 'Wikisłowniku';
+ } else {
+ $word = 'wo ' . $word;
+ }
+ break;
+ }
+
+ return $word; # this will return the original value for 'nominatiw' (nominativ) and all undefined case values
+ }
+
+ function convertPlural( $count, $singular, $dual, $plural, $pluralgen, $w5 ) {
+ switch ( abs( $count ) % 100 ) {
+ case 1:
+ return $singular;
+ case 2:
+ return $dual;
+ case 3:
+ case 4:
+ return $plural;
+ default:
+ return $pluralgen;
+ }
+ }
+}
diff --git a/languages/classes/LanguageKk.deps.php b/languages/classes/LanguageKk.deps.php
new file mode 100644
index 00000000..22ad7ad5
--- /dev/null
+++ b/languages/classes/LanguageKk.deps.php
@@ -0,0 +1,12 @@
+<?php
+// This file exists to ensure that base classes are preloaded before
+// LanguageKk.php is compiled, working around a bug in the APC opcode
+// cache on PHP 5, where cached code can break if the include order
+// changed on a subsequent page view.
+// see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html
+
+
+require_once( dirname(__FILE__).'/../LanguageConverter.php' );
+require_once( dirname(__FILE__).'/LanguageKk_kz.php' );
+
+?>
diff --git a/languages/classes/LanguageKk.php b/languages/classes/LanguageKk.php
new file mode 100644
index 00000000..46162e01
--- /dev/null
+++ b/languages/classes/LanguageKk.php
@@ -0,0 +1,210 @@
+<?php
+/** Kazakh (Қазақша)
+ * converter routines
+ *
+ * @package MediaWiki
+ * @subpackage Language
+ */
+
+require_once( dirname(__FILE__).'/../LanguageConverter.php' );
+require_once( dirname(__FILE__).'/LanguageKk_kz.php' );
+
+class KkConverter extends LanguageConverter {
+ var $mLatinToCyrillic = array(
+ 'YA' => 'Я', 'Ya' => 'Я', 'ya' => 'я', 'YE' => 'Е', 'Ye' => 'У', 'ye' => 'е',
+ 'YO' => 'Ё', 'Yo' => 'Ё', 'yo' => 'ё', 'YU' => 'Ю', 'Yu' => 'Ю', 'yu' => 'ю',
+ 'YW' => 'Ю', 'Yw' => 'Ю', 'yw' => 'ю',
+
+ 'bʺ' => 'бъ', 'dʺ' => 'дъ', 'fʺ' => 'фъ', 'gʺ' => 'гъ', 'kʺ' => 'къ', 'lʺ' => 'лъ',
+ 'mʺ' => 'мъ', 'nʺ' => 'нъ', 'pʺ' => 'пъ', 'rʺ' => 'ръ', 'sʺ' => 'съ', 'tʺ' => 'тъ',
+ 'vʺ' => 'въ', 'zʺ' => 'зъ',
+ /* 'jʺ' => 'жъ', 'cʺ' => 'цъ', 'çʺ' => 'чъ', 'şʺ' => 'шъ', */
+
+ 'ŞÇʹ'=> 'ЩЬ', 'Şçʹ'=> 'Щь', 'Bʺ' => 'БЪ', 'Dʺ' => 'ДЪ', 'Fʺ' => 'ФЪ', 'Gʺ' => 'ГЪ', 'Kʺ' => 'КЪ', 'Lʺ' => 'ЛЪ',
+ 'Mʺ' => 'МЪ', 'Nʺ' => 'НЪ', 'Pʺ' => 'ПЪ', 'Rʺ' => 'РЪ', 'Sʺ' => 'СЪ', 'Tʺ' => 'ТЪ',
+ 'Vʺ' => 'ВЪ', 'Zʺ' => 'ЗЪ',
+ /* 'Jʺ' => 'ЖЪ', 'Cʺ' => 'ЦЪ', 'Çʺ' => 'ЧЪ', 'Şʺ' => 'ШЪ', */
+
+ 'şçʹ'=> 'щь', 'bʹ' => 'бь', 'dʹ' => 'дь', 'fʹ' => 'фь', 'gʹ' => 'гь', 'kʹ' => 'кь', 'lʹ' => 'ль',
+ 'mʹ' => 'мь', 'nʹ' => 'нь', 'pʹ' => 'пь', 'rʹ' => 'рь', 'sʹ' => 'сь', 'tʹ' => 'ть',
+ 'vʹ' => 'вь', 'zʹ' => 'зь', 'jʹ' => 'жь', 'cʹ' => 'ць', 'çʹ' => 'чь', 'şʹ' => 'шь',
+
+ 'Bʹ' => 'БЬ', 'Dʹ' => 'ДЬ', 'Fʹ' => 'ФЬ', 'Gʹ' => 'ГЬ', 'Kʹ' => 'КЬ', 'Lʹ' => 'ЛЬ',
+ 'Mʹ' => 'МЬ', 'Nʹ' => 'НЬ', 'Pʹ' => 'ПЬ', 'Rʹ' => 'РЬ', 'Sʹ' => 'СЬ', 'Tʹ' => 'ТЬ',
+ 'Vʹ' => 'ВЬ', 'Zʹ' => 'ЗЬ', 'Jʹ' => 'ЖЬ', 'Cʹ' => 'ЦЬ', 'Çʹ' => 'ЧЬ', 'Şʹ' => 'ШЬ',
+
+ 'ŞÇ' => 'Щ', 'Şç' => 'Щ', 'şç' => 'щ',
+
+ 'a' => 'а', 'ä' => 'ә', 'b' => 'б', 'c' => 'ц', 'ç' => 'ч', 'd' => 'д', 'e' => 'е',
+ 'é' => 'э', 'f' => 'ф', 'g' => 'г', 'ğ' => 'ғ', 'h' => 'һ', 'i' => 'і', 'ı' => 'ы',
+ 'ï' => 'и', 'j' => 'ж', 'k' => 'к', 'l' => 'л', 'm' => 'м', 'n' => 'н', 'ñ' => 'ң',
+ 'o' => 'о', 'ö' => 'ө', 'p' => 'п', 'q' => 'қ', 'r' => 'р', 's' => 'с', 'ş' => 'ш',
+ 't' => 'т', 'u' => 'ұ', 'ü' => 'ү', 'v' => 'в', 'w' => 'у', 'x' => 'х', 'ý' => 'й',
+ 'z' => 'з',
+
+ 'A' => 'А', 'Ä' => 'Ә', 'B' => 'Б', 'C' => 'Ц', 'Ç' => 'Ч', 'D' => 'Д', 'E' => 'Е',
+ 'É' => 'Э', 'F' => 'Ф', 'G' => 'Г', 'Ğ' => 'Ғ', 'H' => 'Һ', 'İ' => 'І', 'I' => 'Ы',
+ 'Ï' => 'И', 'J' => 'Ж', 'K' => 'К', 'L' => 'Л', 'M' => 'М', 'N' => 'Н', 'Ñ' => 'Ң',
+ 'O' => 'О', 'Ö' => 'Ө', 'P' => 'П', 'Q' => 'Қ', 'R' => 'Р', 'S' => 'С', 'Ş' => 'Ш',
+ 'T' => 'Т', 'U' => 'Ұ', 'Ü' => 'Ү', 'V' => 'В', 'W' => 'У', 'Ý' => 'Й', 'X' => 'Х',
+ 'Z' => 'З'
+ );
+
+ var $mCyrillicToLatin = array(
+ 'а' => 'a', 'ә' => 'ä', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'ғ' => 'ğ',
+ 'д' => 'd', 'е' => 'e', 'ё' => 'yo', 'ж' => 'j', 'з' => 'z', 'и' => 'ï',
+ 'й' => 'ý', 'к' => 'k', 'қ' => 'q', 'л' => 'l', 'м' => 'm', 'н' => 'n',
+ 'ң' => 'ñ', 'о' => 'o', 'ө' => 'ö', 'п' => 'p', 'р' => 'r', 'с' => 's',
+ 'т' => 't', 'у' => 'w', 'ұ' => 'u', 'ү' => 'ü', 'ф' => 'f', 'х' => 'x',
+ 'һ' => 'h', 'ц' => 'c', 'ч' => 'ç', 'ш' => 'ş', 'щ' => 'şç', 'ъ' => 'ʺ',
+ 'ы' => 'ı', 'ь' => 'ʹ', 'і' => 'i', 'э' => 'é', 'ю' => 'yw', 'я' => 'ya',
+
+ 'А' => 'A', 'Ә' => 'Ä', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Ғ' => 'Ğ',
+ 'Д' => 'D', 'Е' => 'E', 'Ё' => 'Yo', 'Ж' => 'J', 'З' => 'Z', 'И' => 'Ï',
+ 'Й' => 'Ý', 'К' => 'K', 'Қ' => 'Q', 'Л' => 'L', 'М' => 'M', 'Н' => 'N',
+ 'Ң' => 'Ñ', 'О' => 'O', 'Ө' => 'Ö', 'П' => 'P', 'Р' => 'R', 'С' => 'S',
+ 'Т' => 'T', 'У' => 'W', 'Ұ' => 'U', 'Ү' => 'Ü', 'Ф' => 'F', 'Х' => 'X',
+ 'Һ' => 'H', 'Ц' => 'C', 'Ч' => 'Ç', 'Ш' => 'Ş', 'Щ' => 'Şç', 'Ъ' => 'ʺ',
+ 'Ы' => 'I', 'Ь' => 'ʹ', 'І' => 'İ', 'Э' => 'É', 'Ю' => 'Yw', 'Я' => 'Ya'
+ );
+
+ var $mCyrillicToArabic = array(
+ 'ла' => 'لا', 'ЛА' => 'لا', 'Ла' => 'لا',
+
+ 'а' => 'ا', 'ә' => 'ٴا', 'б' => 'ب', 'в' => 'ۆ', 'г' => 'گ', 'ғ' => 'ع',
+ 'д' => 'د', 'е' => 'ە', 'ё' => 'يو', 'ж' => 'ج', 'з' => 'ز', 'и' => 'ي',
+ 'й' => 'ي', 'к' => 'ك', 'қ' => 'ق', 'л' => 'ل', 'м' => 'م', 'н' => 'ن',
+ 'ң' => 'ڭ', 'о' => 'و', 'ө' => 'ٴو', 'п' => 'پ', 'р' => 'ر', 'с' => 'س',
+ 'т' => 'ت', 'у' => 'ۋ', 'ұ' => 'ۇ', 'ү' => 'ٴۇ', 'ф' => 'ف', 'х' => 'ح',
+ 'һ' => 'ھ', 'ц' => 'تس', 'ч' => 'چ', 'ш' => 'ش', 'щ' => 'شش', 'ъ' => 'ي',
+ 'ы' => 'ى', 'ь' => 'ي', 'і' => 'ٴى', 'э' => 'ە', 'ю' => 'يۋ', 'я' => 'يا',
+
+ 'А' => 'ا', 'Ә' => 'ٴا', 'Б' => 'ب', 'В' => 'ۆ', 'Г' => 'گ', 'Ғ' => 'ع',
+ 'Д' => 'د', 'Е' => 'ە', 'Ё' => 'يو', 'Ж' => 'ج', 'З' => 'ز', 'И' => 'ي',
+ 'Й' => 'ي', 'К' => 'ك', 'Қ' => 'ق', 'Л' => 'ل', 'М' => 'م', 'Н' => 'ن',
+ 'Ң' => 'ڭ', 'О' => 'و', 'Ө' => 'ٴو', 'П' => 'پ', 'Р' => 'ر', 'С' => 'س',
+ 'Т' => 'ت', 'У' => 'ۋ', 'Ұ' => 'ۇ', 'Ү' => 'ٴۇ', 'Ф' => 'ف', 'Х' => 'ح',
+ 'Һ' => 'ھ', 'Ц' => 'تس', 'Ч' => 'چ', 'Ш' => 'ش', 'Щ' => 'شش', 'Ъ' => 'ي',
+ 'Ы' => 'ى', 'Ь' => 'ي', 'І' => 'ٴى', 'Э' => 'ە', 'Ю' => 'يۋ', 'Я' => 'يا',
+ );
+
+ function loadDefaultTables() {
+ $this->mTables = array(
+ 'kk-kz' => new ReplacementArray( $this->mLatinToCyrillic ),
+ 'kk-tr' => new ReplacementArray( $this->mCyrillicToLatin ),
+ 'kk-cn' => new ReplacementArray( $this->mCyrillicToArabic ),
+ 'kk' => new ReplacementArray()
+ );
+ }
+
+
+ // Do not convert content on talk pages
+ function parserConvert( $text, &$parser ){
+ if(is_object($parser->mTitle) && $parser->mTitle->isTalkPage())
+ $this->mDoContentConvert=false;
+ else
+ $this->mDoContentConvert=true;
+
+ return parent::parserConvert($text, $parser );
+ }
+
+ /*
+ * A function wrapper, if there is no selected variant,
+ * leave the link names as they were
+ */
+ function findVariantLink( &$link, &$nt ) {
+ $oldlink=$link;
+ parent::findVariantLink($link,$nt);
+ 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
+ */
+ 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)
+ */
+ function autoConvert($text, $toVariant=false) {
+ global $wgTitle;
+ if($wgTitle->getNameSpace()==NS_IMAGE){
+ $imagename = $wgTitle->getNsText();
+ if(preg_match("/^$imagename:/",$text)) return $text;
+ }
+ return parent::autoConvert($text,$toVariant);
+ }
+
+ /**
+ * It translates text into variant, specials:
+ * - ommiting roman numbers
+ */
+ function translate($text, $toVariant){
+ $breaks = '[^\w\x80-\xff]';
+
+ // 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.'/';
+
+ $matches = preg_split($reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE);
+
+ $m = array_shift($matches);
+ $ret = $this->mTables[$toVariant]->replace( $m[0] );
+ $mstart = $m[1]+strlen($m[0]);
+ foreach($matches as $m) {
+ $ret .= substr($text, $mstart, $m[1]-$mstart);
+ $ret .= parent::translate($m[0], $toVariant);
+ $mstart = $m[1] + strlen($m[0]);
+ }
+
+ return $ret;
+ }
+
+}
+
+class LanguageKk extends LanguageKk_kz {
+
+ function __construct() {
+ global $wgHooks;
+ parent::__construct();
+
+ $variants = array( 'kk', 'kk-kz', 'kk-tr', 'kk-cn' );
+ $variantfallbacks = array(
+ 'kk' => 'kk-kz',
+ 'kk-kz' => 'kk-kz',
+ 'kk-tr' => 'kk-tr',
+ 'kk-cn' => 'kk-cn'
+ );
+
+ $this->mConverter = new KkConverter( $this, 'kk', $variants, $variantfallbacks );
+ $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
+ }
+
+ function convertGrammar( $word, $case ) {
+ $fname="LanguageKk::convertGrammar";
+ wfProfileIn( $fname );
+
+ //always convert to kk-kz before convertGrammar
+ $w1 = $word;
+ $word = $this->mConverter->autoConvert( $word, 'kk-kz' );
+ $w2 = $word;
+ $word = parent::convertGrammar( $word, $case );
+ //restore encoding
+ if( $w1 != $w2 ) {
+ $word = $this->mConverter->translate( $word, 'kk-tr' );
+ }
+ wfProfileOut( $fname );
+ return $word;
+ }
+
+}
+
+?>
diff --git a/languages/classes/LanguageKk_kz.php b/languages/classes/LanguageKk_kz.php
new file mode 100644
index 00000000..f01251c0
--- /dev/null
+++ b/languages/classes/LanguageKk_kz.php
@@ -0,0 +1,269 @@
+<?php
+/** Kazakh (Қазақша)
+ *
+ *
+ * @package MediaWiki
+ * @subpackage Language
+ */
+
+
+class LanguageKk_kz extends Language {
+
+ # Convert from the nominative form of a noun to some other case
+ # Invoked with {{GRAMMAR:case|word}}
+ /**
+ * Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms
+ */
+ function convertGrammar( $word, $case ) {
+ global $wgGrammarForms;
+ if ( isset( $wgGrammarForms['kk'][$case][$word] ) ) {
+ return $wgGrammarForms['kk'][$case][$word];
+ }
+ // Set up some constants...
+ // Vowels in last syllable
+ $frontVowels = array( "е", "ө", "ү", "і", "ә", "э" );
+ $backVowels = array( "а", "о", "ұ", "ы", "я", "ё" );
+ $allVowels = array( "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё" );
+ // Preceding letters
+ $preVowels = $allVowels;
+ $preNasals = array( "м", "н", "ң" );
+ $preSonants = array( "и", "й", "л", "р", "у", "ю");
+ # $preVoiceds = array( "б", "в", "г", "ғ", "д", "ж", "з", "һ" );
+ # $preVoicelesses = array( "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ" );
+ $preConsonants = array( "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" );
+ $preEzhZet = array( "ж", "з" );
+ $preSonorants = array( "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з");
+
+ // Possessives
+ $firsts = array( "м", "ң" ); // 1st singular, 2nd unformal
+ $seconds = array( "з" ); // 1st plural, 2nd formal
+ $thirds = array( "ы", "і" ); // 3rd
+
+ // Put the word in a form we can play with since we're using UTF-8
+ $ar = array();
+ $ar = preg_split('//u', $word, -1, PREG_SPLIT_NO_EMPTY);
+ $wordEnding = $ar[count( $ar ) - 1]; //Here's the last letter in the word
+ $wordReversed = array_reverse( $ar ); //Here's an array with the order of the letters in the word reversed so we can find a match quicker *shrug*
+
+ // Find the last vowel in the word
+ $wordLastVowel = NULL;
+ foreach ( $wordReversed as $xvalue ) {
+ foreach ( $allVowels as $yvalue ) {
+ if ( strcmp( $xvalue, $yvalue ) == 0 ) {
+ $wordLastVowel = $xvalue;
+ break;
+ } else {
+ continue;
+ }
+ }
+ if ( $wordLastVowel !== NULL ) {
+ break;
+ } else {
+ continue;
+ }
+ }
+
+ // Now convert the word
+ switch ( $case ) {
+ case "dc1":
+ case "genitive": #ilik
+ if ( in_array( $wordEnding, $preConsonants ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "тің";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "тың";
+ }
+ } elseif ( in_array( $wordEnding, $preVowels ) || in_array( $wordEnding, $preNasals ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "нің";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "ның";
+ }
+ } elseif ( in_array( $wordEnding, $preSonants ) || in_array( $wordEnding, $preEzhZet )) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "дің";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "дың";
+ }
+ }
+ break;
+ case "dc2":
+ case "dative": #barıs
+ if ( in_array( $wordEnding, $preConsonants ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "ке";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "қа";
+ }
+ } elseif ( in_array( $wordEnding, $preVowels ) || in_array( $wordEnding, $preSonorants ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "ге";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "ға";
+ }
+ }
+ break;
+ case "dc21":
+ case "possessive dative": #täweldık + barıs
+ if ( in_array( $wordEnding, $firsts ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "е";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "а";
+ }
+ } elseif ( in_array( $wordEnding, $seconds ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "ге";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "ға";
+ }
+ } elseif ( in_array( $wordEnding, $thirds ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "не";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "на";
+ }
+ }
+ break;
+ case "dc3":
+ case "accusative": #tabıs
+ if ( in_array( $wordEnding, $preConsonants ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "ті";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "ты";
+ }
+ } elseif ( in_array( $wordEnding, $preVowels ) ) {
+ if ( in_array($wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "ні";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "ны";
+ }
+ } elseif ( in_array( $wordEnding, $preSonorants) ) {
+ if ( in_array( $wordLastVowel, $frontVowels) ) {
+ $word = implode( "", $ar ) . "ді";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "ды";
+ }
+ }
+ break;
+ case "dc31":
+ case "possessive accusative": #täweldık + tabıs
+ if ( in_array( $wordEnding, $firsts ) || in_array( $wordEnding, $seconds ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "ді";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "ды";
+ }
+ } elseif ( in_array( $wordEnding, $thirds ) ) {
+ $word = implode( "", $ar ) . "н";
+ }
+ break;
+ case "dc4":
+ case "locative": #jatıs
+ if ( in_array( $wordEnding, $preConsonants ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "те";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "та";
+ }
+ } elseif ( in_array( $wordEnding, $preVowels ) || in_array( $wordEnding, $preSonorants ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels) ) {
+ $word = implode( "", $ar ) . "де";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "",$ar ) . "да";
+ }
+ }
+ break;
+ case "dc41":
+ case "possessive locative": #täweldık + jatıs
+ if ( in_array( $wordEnding, $firsts ) || in_array( $wordEnding, $seconds ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "де";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "да";
+ }
+ } elseif ( in_array( $wordEnding, $thirds ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels) ) {
+ $word = implode( "", $ar ) . "нде";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "",$ar ) . "нда";
+ }
+ }
+ break;
+ case "dc5":
+ case "ablative": #şığıs
+ if ( in_array( $wordEnding, $preConsonants ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "тен";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "тан";
+ }
+ } elseif ( in_array($wordEnding, $preVowels ) || in_array($wordEnding, $preSonants ) || in_array($wordEnding, $preEzhZet ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "ден";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "дан";
+ }
+ } elseif ( in_array($wordEnding, $preNasals ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "нен";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "нан";
+ }
+ }
+ break;
+ case "dc51":
+ case "possessive ablative": #täweldık + şığıs
+ if ( in_array( $wordEnding, $firsts ) || in_array( $wordEnding, $thirds ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "нен";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "нан";
+ }
+ } elseif ( in_array($wordEnding, $seconds ) ) {
+ if ( in_array( $wordLastVowel, $frontVowels ) ) {
+ $word = implode( "", $ar ) . "ден";
+ } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+ $word = implode( "", $ar ) . "дан";
+ }
+ }
+ break;
+ case "dc6":
+ case "comitative": #kömektes
+ if ( in_array( $wordEnding, $preConsonants ) ) {
+ $word = implode( "", $ar ) . "пен";
+ } elseif ( in_array( $wordEnding, $preVowels ) || in_array( $wordEnding, $preNasals ) || in_array( $wordEnding, $preSonants ) ) {
+ $word = implode( "", $ar ) . "мен";
+ } elseif ( in_array( $wordEnding, $preEzhZet ) ) {
+ $word = implode( "", $ar ) . "бен";
+ }
+ break;
+ case "dc61":
+ case "possessive comitative": #täweldık + kömektes
+ if ( in_array( $wordEnding, $preConsonants ) ) {
+ $word = implode( "", $ar ) . "пенен";
+ } elseif ( in_array( $wordEnding, $preVowels ) || in_array( $wordEnding, $preNasals ) || in_array( $wordEnding, $preSonants ) ) {
+ $word = implode( "", $ar ) . "менен";
+ } elseif ( in_array( $wordEnding, $preEzhZet ) ) {
+ $word = implode( "", $ar ) . "бенен";
+ }
+ break;
+ default: #dc0 #nominative #ataw
+ }
+ return $word;
+ }
+
+ /**
+ * Avoid grouping whole numbers between 0 to 9999
+ */
+ function commafy( $_ ) {
+ if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
+ return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev($_) ) );
+ } else {
+ return $_;
+ }
+ }
+}
+
+?>
diff --git a/languages/classes/LanguageKsh.php b/languages/classes/LanguageKsh.php
index 412a00f4..5b8c10d9 100644
--- a/languages/classes/LanguageKsh.php
+++ b/languages/classes/LanguageKsh.php
@@ -13,15 +13,16 @@ class LanguageKsh extends Language {
*/
public function commafy( $_ ) {
if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
- return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1&nbsp;', strrev( $_ ) ) );
+ return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
} else {
return $_;
}
}
+
/**
* Handle cases of (1, other, 0) or (1, other)
*/
- public function convertPlural( $count, $w1, $w2, $w3 ) {
+ public function convertPlural( $count, $w1, $w2, $w3, $w4, $w5 ) {
$count = str_replace (' ', '', $count);
if ( $count == '1' ) {
return $w1;
diff --git a/languages/classes/LanguageLt.php b/languages/classes/LanguageLt.php
index 53729006..14031feb 100644
--- a/languages/classes/LanguageLt.php
+++ b/languages/classes/LanguageLt.php
@@ -8,15 +8,15 @@
class LanguageLt extends Language {
/* Word forms (with examples):
- 1 - vienas (1) lapas
+ 1 - vienas (1) lapas, dvidešimt vienas (21) lapas
2 - trys (3) lapai
3 - penkiolika (15) lapų
- */
- function convertPlural( $count, $wordform1, $wordform2, $wordform3) {
- $count = str_replace (' ', '', $count);
+ */
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
if ($count%10==1 && $count%100!=11) return $wordform1;
if ($count%10>=2 && ($count%100<10 || $count%100>=20)) return $wordform2;
- return $wordform3;
+ //if third form not specified, then use second form
+ return empty($wordform3)?$wordform2:$wordform3;
}
}
?>
diff --git a/languages/classes/LanguageLv.php b/languages/classes/LanguageLv.php
index 54cae487..c45d96e4 100644
--- a/languages/classes/LanguageLv.php
+++ b/languages/classes/LanguageLv.php
@@ -22,7 +22,7 @@ class LanguageLv extends Language {
* @param string $wordform3 (not used)
* @return string
*/
- function convertPlural( $count, $wordform1, $wordform2, $wordform3 ) {
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5 ) {
return ( ( $count % 10 == 1 ) && ( $count % 100 != 11 ) ) ? $wordform1 : $wordform2;
}
diff --git a/languages/classes/LanguagePt_br.php b/languages/classes/LanguagePt_br.php
index 6132aaa2..06dc4d9c 100644
--- a/languages/classes/LanguagePt_br.php
+++ b/languages/classes/LanguagePt_br.php
@@ -10,7 +10,7 @@ class LanguagePt_br extends Language {
/**
* Use singular form for zero (see bug 7309)
*/
- function convertPlural( $count, $w1, $w2, $w3) {
+ function convertPlural( $count, $w1, $w2, $w3, $w4, $w5) {
return $count <= '1' ? $w1 : $w2;
}
}
diff --git a/languages/classes/LanguageRu.php b/languages/classes/LanguageRu.php
index b64a4144..a251aa52 100644
--- a/languages/classes/LanguageRu.php
+++ b/languages/classes/LanguageRu.php
@@ -57,7 +57,7 @@ class LanguageRu extends Language {
return $word;
}
- function convertPlural( $count, $wordform1, $wordform2, $wordform3) {
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
$count = str_replace (' ', '', $count);
if ($count > 10 && floor(($count % 100) / 10) == 1) {
return $wordform3;
diff --git a/languages/classes/LanguageSk.php b/languages/classes/LanguageSk.php
index 2fa8df0f..5b71c6aa 100644
--- a/languages/classes/LanguageSk.php
+++ b/languages/classes/LanguageSk.php
@@ -76,8 +76,8 @@ class LanguageSk extends Language {
}
return $word;
}
-
- function convertPlural( $count, $w1, $w2, $w3) {
+
+ function convertPlural( $count, $w1, $w2, $w3, $w4, $w5) {
$count = str_replace ('.', '', $count);
$forms = array( $w1, $w2, $w3);
if ( $count == 1 ) {
diff --git a/languages/classes/LanguageSr.php b/languages/classes/LanguageSr.php
index 412463f8..59d31cab 100644
--- a/languages/classes/LanguageSr.php
+++ b/languages/classes/LanguageSr.php
@@ -53,12 +53,13 @@ class SrConverter extends LanguageConverter {
);
function loadDefaultTables() {
- $this->mTables = array();
- $this->mTables['sr-ec'] = $this->mToCyrillics;
- $this->mTables['sr-jc'] = $this->mToCyrillics;
- $this->mTables['sr-el'] = $this->mToLatin;
- $this->mTables['sr-jl'] = $this->mToLatin;
- $this->mTables['sr'] = array();
+ $this->mTables = array(
+ 'sr-ec' => new ReplacementArray( $this->mToCyrillics ),
+ 'sr-jc' => new ReplacementArray( $this->mToCyrillics),
+ 'sr-el' => new ReplacementArray( $this->mToLatin),
+ 'sr-jl' => new ReplacementArray( $this->mToLatin),
+ 'sr' => new ReplacementArray()
+ );
}
/* rules should be defined as -{ekavian | iyekavian-} -or-
@@ -67,40 +68,48 @@ class SrConverter extends LanguageConverter {
currently, and just produces a couple of bugs
*/
function parseManualRule($rule, $flags=array()) {
- // ignore all formatting
- foreach($this->mVariants as $v) {
- $carray[$v] = $rule;
- }
+ if(in_array('T',$flags)){
+ return parent::parseManualRule($rule, $flags);
+ }
+ // otherwise ignore all formatting
+ foreach($this->mVariants as $v) {
+ $carray[$v] = $rule;
+ }
+
return $carray;
}
- /*
- * Override function from LanguageConvertor
- * Additional checks:
- * - There should be no conversion for Talk pages
- */
- function getPreferredVariant(){
- global $wgTitle;
- if($wgTitle!=NULL && $wgTitle->isTalkPage()){
- return $this->mMainLanguageCode;
- }
- return parent::getPreferredVariant();
- }
+ // Do not convert content on talk pages
+ function parserConvert( $text, &$parser ){
+ if(is_object($parser->mTitle) && $parser->mTitle->isTalkPage())
+ $this->mDoContentConvert=false;
+ else
+ $this->mDoContentConvert=true;
+ return parent::parserConvert($text, $parser );
+ }
/*
- * A function wrapper, if there is no selected variant,
- * leave the link names as they were
+ * A function wrapper:
+ * - if there is no selected variant, leave the link
+ * names as they were
+ * - do not try to find variants for usernames
*/
function findVariantLink( &$link, &$nt ) {
+ // check for user namespace
+ if(is_object($nt)){
+ $ns = $nt->getNamespace();
+ if($ns==NS_USER || $ns==NS_USER_TALK)
+ return;
+ }
+
$oldlink=$link;
parent::findVariantLink($link,$nt);
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
@@ -117,7 +126,7 @@ class SrConverter extends LanguageConverter {
*/
function autoConvert($text, $toVariant=false) {
global $wgTitle;
- if($wgTitle->getNameSpace()==NS_IMAGE){
+ if(is_object($wgTitle) && $wgTitle->getNameSpace()==NS_IMAGE){
$imagename = $wgTitle->getNsText();
if(preg_match("/^$imagename:/",$text)) return $text;
}
@@ -139,7 +148,10 @@ class SrConverter extends LanguageConverter {
$matches = preg_split($reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE);
$m = array_shift($matches);
- $ret = strtr($m[0], $this->mTables[$toVariant]);
+ if( !isset( $this->mTables[$toVariant] ) ) {
+ throw new MWException( "Broken variant table: " . implode( ',', array_keys( $this->mTables ) ) );
+ }
+ $ret = $this->mTables[$toVariant]->replace( $m[0] );
$mstart = $m[1]+strlen($m[0]);
foreach($matches as $m) {
$ret .= substr($text, $mstart, $m[1]-$mstart);
@@ -150,7 +162,6 @@ class SrConverter extends LanguageConverter {
return $ret;
}
-
}
class LanguageSr extends LanguageSr_ec {
@@ -164,8 +175,8 @@ class LanguageSr extends LanguageSr_ec {
$variants = array('sr', 'sr-ec', 'sr-el');
$variantfallbacks = array(
'sr' => 'sr-ec',
- 'sr-ec' => 'sr-ec',
- 'sr-el' => 'sr-el',
+ 'sr-ec' => 'sr',
+ 'sr-el' => 'sr',
);
diff --git a/languages/classes/LanguageSr_ec.php b/languages/classes/LanguageSr_ec.php
index f84ebd06..72f56b8c 100644
--- a/languages/classes/LanguageSr_ec.php
+++ b/languages/classes/LanguageSr_ec.php
@@ -9,7 +9,7 @@
#--------------------------------------------------------------------------
class LanguageSr_ec extends Language {
- function convertPlural( $count, $wordform1, $wordform2, $wordform3) {
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
$count = str_replace ('.', '', $count);
if ($count > 10 && floor(($count % 100) / 10) == 1) {
return $wordform3;
diff --git a/languages/classes/LanguageSr_el.php b/languages/classes/LanguageSr_el.php
index cba1b57e..1ecacc0e 100644
--- a/languages/classes/LanguageSr_el.php
+++ b/languages/classes/LanguageSr_el.php
@@ -9,7 +9,7 @@
#--------------------------------------------------------------------------
class LanguageSr_el extends Language {
- function convertPlural( $count, $wordform1, $wordform2, $wordform3) {
+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
$count = str_replace ('.', '', $count);
if ($count > 10 && floor(($count % 100) / 10) == 1) {
return $wordform3;
diff --git a/languages/classes/LanguageZh.php b/languages/classes/LanguageZh.php
index c34315ac..d4fbaf30 100644
--- a/languages/classes/LanguageZh.php
+++ b/languages/classes/LanguageZh.php
@@ -9,23 +9,25 @@ require_once( dirname(__FILE__).'/LanguageZh_cn.php' );
class ZhConverter extends LanguageConverter {
function loadDefaultTables() {
require( "includes/ZhConversion.php" );
- $this->mTables = array();
- $this->mTables['zh-cn'] = $zh2CN;
- $this->mTables['zh-tw'] = $zh2TW;
- $this->mTables['zh-sg'] = array_merge($zh2CN, $zh2SG);
- $this->mTables['zh-hk'] = array_merge($zh2TW, $zh2HK);
- $this->mTables['zh'] = array();
+ $this->mTables = array(
+ 'zh-cn' => new ReplacementArray( $zh2CN ),
+ 'zh-tw' => new ReplacementArray( $zh2TW ),
+ 'zh-sg' => new ReplacementArray( array_merge($zh2CN, $zh2SG) ),
+ 'zh-hk' => new ReplacementArray( array_merge($zh2TW, $zh2HK) ),
+ 'zh' => new ReplacementArray
+ );
}
function postLoadTables() {
- $this->mTables['zh-sg'] = array_merge($this->mTables['zh-cn'], $this->mTables['zh-sg']);
- $this->mTables['zh-hk'] = array_merge($this->mTables['zh-tw'], $this->mTables['zh-hk']);
+ $this->mTables['zh-sg']->merge( $this->mTables['zh-cn'] );
+ $this->mTables['zh-hk']->merge( $this->mTables['zh-tw'] );
}
/* there shouldn't be any latin text in Chinese conversion, so no need
- to mark anything
+ to mark anything.
+ $noParse is there for compatibility with LanguageConvert::markNoConversion
*/
- function markNoConversion($text) {
+ function markNoConversion($text, $noParse = false) {
return $text;
}