2004-02-18 02:15:00 +00:00
|
|
|
|
<?php
|
2012-06-09 20:24:16 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Serbian (Српски / Srpski) 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
|
|
|
|
|
|
*/
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* There are two levels of conversion for Serbian: the script level
|
|
|
|
|
|
* (Cyrillics <-> Latin), and the variant level (ekavian
|
|
|
|
|
|
* <->iyekavian). The two are orthogonal. So we really only need two
|
|
|
|
|
|
* dictionaries: one for Cyrillics and Latin, and one for ekavian and
|
|
|
|
|
|
* iyekavian.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @ingroup Language
|
|
|
|
|
|
*/
|
2006-03-02 22:22:18 +00:00
|
|
|
|
class SrConverter extends LanguageConverter {
|
2016-02-17 09:09:32 +00:00
|
|
|
|
public $mToLatin = [
|
2013-12-15 19:56:09 +00:00
|
|
|
|
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd',
|
|
|
|
|
|
'ђ' => 'đ', 'е' => 'e', 'ж' => 'ž', 'з' => 'z', 'и' => 'i',
|
|
|
|
|
|
'ј' => 'j', 'к' => 'k', 'л' => 'l', 'љ' => 'lj', 'м' => 'm',
|
|
|
|
|
|
'н' => 'n', 'њ' => 'nj', 'о' => 'o', 'п' => 'p', 'р' => 'r',
|
|
|
|
|
|
'с' => 's', 'т' => 't', 'ћ' => 'ć', 'у' => 'u', 'ф' => 'f',
|
|
|
|
|
|
'х' => 'h', 'ц' => 'c', 'ч' => 'č', 'џ' => 'dž', 'ш' => 'š',
|
2006-03-02 22:22:18 +00:00
|
|
|
|
|
2013-12-15 19:56:09 +00:00
|
|
|
|
'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D',
|
|
|
|
|
|
'Ђ' => 'Đ', 'Е' => 'E', 'Ж' => 'Ž', 'З' => 'Z', 'И' => 'I',
|
|
|
|
|
|
'Ј' => 'J', 'К' => 'K', 'Л' => 'L', 'Љ' => 'Lj', 'М' => 'M',
|
|
|
|
|
|
'Н' => 'N', 'Њ' => 'Nj', 'О' => 'O', 'П' => 'P', 'Р' => 'R',
|
|
|
|
|
|
'С' => 'S', 'Т' => 'T', 'Ћ' => 'Ć', 'У' => 'U', 'Ф' => 'F',
|
|
|
|
|
|
'Х' => 'H', 'Ц' => 'C', 'Ч' => 'Č', 'Џ' => 'Dž', 'Ш' => 'Š',
|
2016-02-17 09:09:32 +00:00
|
|
|
|
];
|
2006-03-02 22:22:18 +00:00
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
|
public $mToCyrillics = [
|
2013-12-15 19:56:09 +00:00
|
|
|
|
'a' => 'а', 'b' => 'б', 'c' => 'ц', 'č' => 'ч', 'ć' => 'ћ',
|
|
|
|
|
|
'd' => 'д', 'dž' => 'џ', 'đ' => 'ђ', 'e' => 'е', 'f' => 'ф',
|
|
|
|
|
|
'g' => 'г', 'h' => 'х', 'i' => 'и', 'j' => 'ј', 'k' => 'к',
|
2006-03-02 22:22:18 +00:00
|
|
|
|
'l' => 'л', 'lj' => 'љ', 'm' => 'м', 'n' => 'н', 'nj' => 'њ',
|
2013-12-15 19:56:09 +00:00
|
|
|
|
'o' => 'о', 'p' => 'п', 'r' => 'р', 's' => 'с', 'š' => 'ш',
|
|
|
|
|
|
't' => 'т', 'u' => 'у', 'v' => 'в', 'z' => 'з', 'ž' => 'ж',
|
2006-03-02 22:22:18 +00:00
|
|
|
|
|
2013-12-15 19:56:09 +00:00
|
|
|
|
'A' => 'А', 'B' => 'Б', 'C' => 'Ц', 'Č' => 'Ч', 'Ć' => 'Ћ',
|
|
|
|
|
|
'D' => 'Д', 'Dž' => 'Џ', 'Đ' => 'Ђ', 'E' => 'Е', 'F' => 'Ф',
|
|
|
|
|
|
'G' => 'Г', 'H' => 'Х', 'I' => 'И', 'J' => 'Ј', 'K' => 'К',
|
2006-03-02 22:22:18 +00:00
|
|
|
|
'L' => 'Л', 'LJ' => 'Љ', 'M' => 'М', 'N' => 'Н', 'NJ' => 'Њ',
|
2013-12-15 19:56:09 +00:00
|
|
|
|
'O' => 'О', 'P' => 'П', 'R' => 'Р', 'S' => 'С', 'Š' => 'Ш',
|
|
|
|
|
|
'T' => 'Т', 'U' => 'У', 'V' => 'В', 'Z' => 'З', 'Ž' => 'Ж',
|
2006-03-02 22:22:18 +00:00
|
|
|
|
|
2010-07-29 09:43:18 +00:00
|
|
|
|
'DŽ' => 'Џ', 'd!ž' => 'дж', 'D!ž' => 'Дж', 'D!Ž' => 'ДЖ',
|
|
|
|
|
|
'Lj' => 'Љ', 'l!j' => 'лј', 'L!j' => 'Лј', 'L!J' => 'ЛЈ',
|
|
|
|
|
|
'Nj' => 'Њ', 'n!j' => 'нј', 'N!j' => 'Нј', 'N!J' => 'НЈ'
|
2016-02-17 09:09:32 +00:00
|
|
|
|
];
|
2006-03-02 22:22:18 +00:00
|
|
|
|
|
|
|
|
|
|
function loadDefaultTables() {
|
2016-02-17 09:09:32 +00:00
|
|
|
|
$this->mTables = [
|
2006-11-21 09:53:45 +00:00
|
|
|
|
'sr-ec' => new ReplacementArray( $this->mToCyrillics ),
|
2010-07-29 09:43:18 +00:00
|
|
|
|
'sr-el' => new ReplacementArray( $this->mToLatin ),
|
2013-04-17 19:10:02 +00:00
|
|
|
|
'sr' => new ReplacementArray()
|
2016-02-17 09:09:32 +00:00
|
|
|
|
];
|
2005-08-15 19:27:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2011-05-22 22:05:18 +00:00
|
|
|
|
/**
|
2006-12-26 12:19:45 +00:00
|
|
|
|
* A function wrapper:
|
2008-05-17 17:10:18 +00:00
|
|
|
|
* - if there is no selected variant, leave the link
|
2006-12-26 12:19:45 +00:00
|
|
|
|
* names as they were
|
|
|
|
|
|
* - do not try to find variants for usernames
|
2011-05-29 16:32:05 +00:00
|
|
|
|
*
|
2014-07-24 12:55:43 +00:00
|
|
|
|
* @param string &$link
|
|
|
|
|
|
* @param Title &$nt
|
2014-04-17 13:31:28 +00:00
|
|
|
|
* @param bool $ignoreOtherCond
|
2006-06-16 22:30:39 +00:00
|
|
|
|
*/
|
2009-02-02 07:54:43 +00:00
|
|
|
|
function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
|
2006-12-26 12:19:45 +00:00
|
|
|
|
// check for user namespace
|
2010-07-29 09:43:18 +00:00
|
|
|
|
if ( is_object( $nt ) ) {
|
2006-12-26 12:19:45 +00:00
|
|
|
|
$ns = $nt->getNamespace();
|
2013-04-17 19:10:02 +00:00
|
|
|
|
if ( $ns == NS_USER || $ns == NS_USER_TALK ) {
|
2006-12-26 12:19:45 +00:00
|
|
|
|
return;
|
2013-04-17 19:10:02 +00:00
|
|
|
|
}
|
2006-12-26 12:19:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$oldlink = $link;
|
2009-02-02 07:54:43 +00:00
|
|
|
|
parent::findVariantLink( $link, $nt, $ignoreOtherCond );
|
2013-04-17 19:10:02 +00:00
|
|
|
|
if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) {
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$link = $oldlink;
|
2013-04-17 19:10:02 +00:00
|
|
|
|
}
|
2006-06-16 22:30:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2006-09-20 10:22:12 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* It translates text into variant, specials:
|
|
|
|
|
|
* - ommiting roman numbers
|
2011-05-29 15:59:47 +00:00
|
|
|
|
*
|
2014-04-17 13:31:28 +00:00
|
|
|
|
* @param string $text
|
|
|
|
|
|
* @param string $toVariant
|
2011-05-29 16:32:05 +00:00
|
|
|
|
*
|
2012-03-05 19:17:55 +00:00
|
|
|
|
* @throws MWException
|
2011-05-29 15:59:47 +00:00
|
|
|
|
* @return string
|
2006-09-20 10:22:12 +00:00
|
|
|
|
*/
|
2010-07-29 09:43:18 +00:00
|
|
|
|
function translate( $text, $toVariant ) {
|
2006-09-20 10:22:12 +00:00
|
|
|
|
$breaks = '[^\w\x80-\xff]';
|
|
|
|
|
|
|
|
|
|
|
|
// regexp for roman numbers
|
2018-04-02 03:49:19 +00:00
|
|
|
|
// Lookahead assertion ensures $roman doesn't match the empty string
|
|
|
|
|
|
$roman = '(?=[MDCLXVI])M{0,4}(C[DM]|D?C{0,3})(X[LC]|L?X{0,3})(I[VX]|V?I{0,3})';
|
2006-09-20 10:22:12 +00:00
|
|
|
|
|
Update plural rules to CLDR 24
Updated plurals.xml with new data from CLDR 24.
This data is according to UTS #35 Rev 33.
Update the CLDRPluralRuleParser.js to version 1.1 from upstream
https://github.com/santhoshtr/CLDRPluralRuleParser
Changes to the plural rules:
* Hebrew override removed since CLDR 24 matches with MW plural rules.
* Updated the syntax of overridden rules to TR35 Rev 33 for
Lower Sorbian (dsb), Upper Sorbian (hsb), Belarusian in Taraskievica
orthography (be_tarask), Old Church Slavonic (cu), Bhojpuri (bho),
Samogitian (sgs).
* Removed Manx (gv) override. See I46ab3dadc7fe08c1e60bbd81a1ee841e166e9608.
* Removed the overriden convertPlural method for Serbian from LanguageSr.php,
since CLDR 24 matches with MW rules. Updated and added more tests.
Tests updated for Serbocroatian (sh), too. Old CLDR versions had 4 plural
rules and MW had only 3. In CLDR 24, the form 'many' was removed and it
became identical to the MW. Same for Bosnian (bs) and Croatian (hr).
Also for variants sr-ec and sr-el
* Macedonian (mk) used to count 11 as 'other' form.
CLDR 24 counts it as 'one'.
Not overriding, using CLDR 24 here.
Updated the tests. MW will not override this.
* Armenian (hy) used to count 0 as 'other'.
Now it is 'one' form.
Updated the tests. MW will not override this.
* Latvian (lv) used to count only 0 as 'zero' form, but CLDR 24, any number
satisifying the following formula is counted as zero:
n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19
Examples: 0, 10~20, 30, 40, 50, 60, 100.
Updated the tests accordingly. Not overriding it in MW.
Users will see different plural form for the above numbers.
* Removed Ukranian custom plural rule since it match with MW
* Russian (ru) plural rules have a major change.
The 'few' form is merged with the 'other' form.
The current forms are 'one', 'many', 'other'.
In MW ru plural rules were overridden using convertPlural methdod
in LanguagesRu.php with 3 forms.
Effectively forms[1] and forms[2] are swapped.
This will affect the messages, and such messages
must be reviewed and updated. This change is not included in this patch and
wil be done separately.
Russian is the only remaining language class with convertPlural method overridden.
Notable impact on the exising messages:
* For languages ru, uk, be_tarask, sr, For the special case
of two plural forms and first mapped to 1 and rest to the other form, syntax like
{{plural:$1|1=one|other}} should be used.
For further information regarding each of the above language changes, see
1. http://unicode.org/cldr/trac/ticket/3727
2. http://goo.gl/H2HEz
CLDR 24 can handle fractions. Ideally it should start working
in MW without any code changes, but MW language test suite
does not have enough tests to confirm.
Followup: e571717e06667228ec8d689be067e00bdd06d34d
Bug: 56931
Change-Id: I9930b290d004667a3bb09e5c1663ec2c9c27d8a6
2014-01-01 09:05:39 +00:00
|
|
|
|
$reg = '/^' . $roman . '$|^' . $roman . $breaks . '|' . $breaks
|
|
|
|
|
|
. $roman . '$|' . $breaks . $roman . $breaks . '/';
|
2006-09-20 10:22:12 +00:00
|
|
|
|
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$matches = preg_split( $reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
|
2008-05-17 17:10:18 +00:00
|
|
|
|
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$m = array_shift( $matches );
|
2013-02-07 21:59:42 +00:00
|
|
|
|
$this->loadTables();
|
2010-07-29 09:43:18 +00:00
|
|
|
|
if ( !isset( $this->mTables[$toVariant] ) ) {
|
Update plural rules to CLDR 24
Updated plurals.xml with new data from CLDR 24.
This data is according to UTS #35 Rev 33.
Update the CLDRPluralRuleParser.js to version 1.1 from upstream
https://github.com/santhoshtr/CLDRPluralRuleParser
Changes to the plural rules:
* Hebrew override removed since CLDR 24 matches with MW plural rules.
* Updated the syntax of overridden rules to TR35 Rev 33 for
Lower Sorbian (dsb), Upper Sorbian (hsb), Belarusian in Taraskievica
orthography (be_tarask), Old Church Slavonic (cu), Bhojpuri (bho),
Samogitian (sgs).
* Removed Manx (gv) override. See I46ab3dadc7fe08c1e60bbd81a1ee841e166e9608.
* Removed the overriden convertPlural method for Serbian from LanguageSr.php,
since CLDR 24 matches with MW rules. Updated and added more tests.
Tests updated for Serbocroatian (sh), too. Old CLDR versions had 4 plural
rules and MW had only 3. In CLDR 24, the form 'many' was removed and it
became identical to the MW. Same for Bosnian (bs) and Croatian (hr).
Also for variants sr-ec and sr-el
* Macedonian (mk) used to count 11 as 'other' form.
CLDR 24 counts it as 'one'.
Not overriding, using CLDR 24 here.
Updated the tests. MW will not override this.
* Armenian (hy) used to count 0 as 'other'.
Now it is 'one' form.
Updated the tests. MW will not override this.
* Latvian (lv) used to count only 0 as 'zero' form, but CLDR 24, any number
satisifying the following formula is counted as zero:
n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19
Examples: 0, 10~20, 30, 40, 50, 60, 100.
Updated the tests accordingly. Not overriding it in MW.
Users will see different plural form for the above numbers.
* Removed Ukranian custom plural rule since it match with MW
* Russian (ru) plural rules have a major change.
The 'few' form is merged with the 'other' form.
The current forms are 'one', 'many', 'other'.
In MW ru plural rules were overridden using convertPlural methdod
in LanguagesRu.php with 3 forms.
Effectively forms[1] and forms[2] are swapped.
This will affect the messages, and such messages
must be reviewed and updated. This change is not included in this patch and
wil be done separately.
Russian is the only remaining language class with convertPlural method overridden.
Notable impact on the exising messages:
* For languages ru, uk, be_tarask, sr, For the special case
of two plural forms and first mapped to 1 and rest to the other form, syntax like
{{plural:$1|1=one|other}} should be used.
For further information regarding each of the above language changes, see
1. http://unicode.org/cldr/trac/ticket/3727
2. http://goo.gl/H2HEz
CLDR 24 can handle fractions. Ideally it should start working
in MW without any code changes, but MW language test suite
does not have enough tests to confirm.
Followup: e571717e06667228ec8d689be067e00bdd06d34d
Bug: 56931
Change-Id: I9930b290d004667a3bb09e5c1663ec2c9c27d8a6
2014-01-01 09:05:39 +00:00
|
|
|
|
throw new MWException( "Broken variant table: "
|
|
|
|
|
|
. implode( ',', array_keys( $this->mTables ) ) );
|
2006-12-27 01:49:09 +00:00
|
|
|
|
}
|
2006-11-21 09:53:45 +00:00
|
|
|
|
$ret = $this->mTables[$toVariant]->replace( $m[0] );
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$mstart = $m[1] + strlen( $m[0] );
|
|
|
|
|
|
foreach ( $matches as $m ) {
|
2017-08-11 13:53:17 +00:00
|
|
|
|
$ret .= substr( $text, $mstart, $m[1] - $mstart );
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$ret .= parent::translate( $m[0], $toVariant );
|
|
|
|
|
|
$mstart = $m[1] + strlen( $m[0] );
|
2006-09-20 10:22:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $ret;
|
|
|
|
|
|
}
|
2011-11-16 15:12:00 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Guess if a text is written in Cyrillic or Latin.
|
|
|
|
|
|
* Overrides LanguageConverter::guessVariant()
|
|
|
|
|
|
*
|
2014-04-08 15:29:17 +00:00
|
|
|
|
* @param string $text The text to be checked
|
|
|
|
|
|
* @param string $variant Language code of the variant to be checked for
|
2014-04-17 13:31:28 +00:00
|
|
|
|
* @return bool True if $text appears to be written in $variant
|
2011-11-16 15:12:00 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @author Nikola Smolenski <smolensk@eunet.rs>
|
|
|
|
|
|
* @since 1.19
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function guessVariant( $text, $variant ) {
|
2013-04-17 19:10:02 +00:00
|
|
|
|
$numCyrillic = preg_match_all( "/[шђчћжШЂЧЋЖ]/u", $text, $dummy );
|
|
|
|
|
|
$numLatin = preg_match_all( "/[šđč枊ĐČĆŽ]/u", $text, $dummy );
|
2011-11-16 15:12:00 +00:00
|
|
|
|
|
2013-04-17 19:10:02 +00:00
|
|
|
|
if ( $variant == 'sr-ec' ) {
|
2013-08-31 16:36:02 +00:00
|
|
|
|
return $numCyrillic > $numLatin;
|
2013-04-17 19:10:02 +00:00
|
|
|
|
} elseif ( $variant == 'sr-el' ) {
|
2013-08-31 16:36:02 +00:00
|
|
|
|
return $numLatin > $numCyrillic;
|
2011-11-16 15:12:00 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2003-11-09 11:24:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
|
/**
|
2010-10-10 12:53:37 +00:00
|
|
|
|
* Serbian (Српски / Srpski)
|
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
|
* @ingroup Language
|
|
|
|
|
|
*/
|
Update plural rules to CLDR 24
Updated plurals.xml with new data from CLDR 24.
This data is according to UTS #35 Rev 33.
Update the CLDRPluralRuleParser.js to version 1.1 from upstream
https://github.com/santhoshtr/CLDRPluralRuleParser
Changes to the plural rules:
* Hebrew override removed since CLDR 24 matches with MW plural rules.
* Updated the syntax of overridden rules to TR35 Rev 33 for
Lower Sorbian (dsb), Upper Sorbian (hsb), Belarusian in Taraskievica
orthography (be_tarask), Old Church Slavonic (cu), Bhojpuri (bho),
Samogitian (sgs).
* Removed Manx (gv) override. See I46ab3dadc7fe08c1e60bbd81a1ee841e166e9608.
* Removed the overriden convertPlural method for Serbian from LanguageSr.php,
since CLDR 24 matches with MW rules. Updated and added more tests.
Tests updated for Serbocroatian (sh), too. Old CLDR versions had 4 plural
rules and MW had only 3. In CLDR 24, the form 'many' was removed and it
became identical to the MW. Same for Bosnian (bs) and Croatian (hr).
Also for variants sr-ec and sr-el
* Macedonian (mk) used to count 11 as 'other' form.
CLDR 24 counts it as 'one'.
Not overriding, using CLDR 24 here.
Updated the tests. MW will not override this.
* Armenian (hy) used to count 0 as 'other'.
Now it is 'one' form.
Updated the tests. MW will not override this.
* Latvian (lv) used to count only 0 as 'zero' form, but CLDR 24, any number
satisifying the following formula is counted as zero:
n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19
Examples: 0, 10~20, 30, 40, 50, 60, 100.
Updated the tests accordingly. Not overriding it in MW.
Users will see different plural form for the above numbers.
* Removed Ukranian custom plural rule since it match with MW
* Russian (ru) plural rules have a major change.
The 'few' form is merged with the 'other' form.
The current forms are 'one', 'many', 'other'.
In MW ru plural rules were overridden using convertPlural methdod
in LanguagesRu.php with 3 forms.
Effectively forms[1] and forms[2] are swapped.
This will affect the messages, and such messages
must be reviewed and updated. This change is not included in this patch and
wil be done separately.
Russian is the only remaining language class with convertPlural method overridden.
Notable impact on the exising messages:
* For languages ru, uk, be_tarask, sr, For the special case
of two plural forms and first mapped to 1 and rest to the other form, syntax like
{{plural:$1|1=one|other}} should be used.
For further information regarding each of the above language changes, see
1. http://unicode.org/cldr/trac/ticket/3727
2. http://goo.gl/H2HEz
CLDR 24 can handle fractions. Ideally it should start working
in MW without any code changes, but MW language test suite
does not have enough tests to confirm.
Followup: e571717e06667228ec8d689be067e00bdd06d34d
Bug: 56931
Change-Id: I9930b290d004667a3bb09e5c1663ec2c9c27d8a6
2014-01-01 09:05:39 +00:00
|
|
|
|
class LanguageSr extends Language {
|
2006-06-24 18:48:58 +00:00
|
|
|
|
function __construct() {
|
2006-07-26 07:15:39 +00:00
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
|
$variants = [ 'sr', 'sr-ec', 'sr-el' ];
|
|
|
|
|
|
$variantfallbacks = [
|
2013-04-17 19:10:02 +00:00
|
|
|
|
'sr' => 'sr-ec',
|
2007-01-01 17:20:19 +00:00
|
|
|
|
'sr-ec' => 'sr',
|
|
|
|
|
|
'sr-el' => 'sr',
|
2016-02-17 09:09:32 +00:00
|
|
|
|
];
|
2006-09-20 10:22:12 +00:00
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
|
$flags = [
|
2006-03-02 22:22:18 +00:00
|
|
|
|
'S' => 'S', 'писмо' => 'S', 'pismo' => 'S',
|
2013-04-17 19:10:02 +00:00
|
|
|
|
'W' => 'W', 'реч' => 'W', 'reč' => 'W', 'ријеч' => 'W', 'riječ' => 'W'
|
2016-02-17 09:09:32 +00:00
|
|
|
|
];
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$this->mConverter = new SrConverter( $this, 'sr', $variants, $variantfallbacks, $flags );
|
2006-03-02 22:22:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|