Merge "Remove convertPlural methods already served by CLDR plural system"

This commit is contained in:
jenkins-bot 2013-10-02 17:57:45 +00:00 committed by Gerrit Code Review
commit 543f0ea46e
10 changed files with 0 additions and 415 deletions

View file

@ -63,24 +63,4 @@ class LanguageCu extends Language {
}
return $word;
}
/**
* @param $count int
* @param $forms array
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
$forms = $this->preConvertPlural( $forms, 4 );
switch ( $count % 10 ) {
case 1: return $forms[0];
case 2: return $forms[1];
case 3:
case 4: return $forms[2];
default: return $forms[3];
}
}
}

View file

@ -1,46 +0,0 @@
<?php
/**
* Hindi (हिन्दी) specific code.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Language
*/
/**
* Hindi (हिन्दी)
*
* @ingroup Language
*/
class LanguageHi extends Language {
/**
* Use singular form for zero
*
* @param $count int
* @param $forms array
*
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
$forms = $this->preConvertPlural( $forms, 2 );
return ( $count <= 1 ) ? $forms[0] : $forms[1];
}
}

View file

@ -1,46 +0,0 @@
<?php
/**
* Malagasy (Malagasy) specific code.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Language
*/
/**
* Malagasy (Malagasy)
*
* @ingroup Language
*/
class LanguageMg extends Language {
/**
* Use singular form for zero
*
* @param $count int
* @param $forms array
*
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
$forms = $this->preConvertPlural( $forms, 2 );
return ( $count <= 1 ) ? $forms[0] : $forms[1];
}
}

View file

@ -1,55 +0,0 @@
<?php
/**
* Maltese (Malti) specific code.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @author Niklas Laxström
* @ingroup Language
*/
/**
* Maltese (Malti)
*
* @ingroup Language
*/
class LanguageMt extends Language {
/**
* @param $count int
* @param $forms array
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
$forms = $this->preConvertPlural( $forms, 4 );
if ( $count == 1 ) {
$index = 0;
} elseif ( $count == 0 || ( $count % 100 > 1 && $count % 100 < 11 ) ) {
$index = 1;
} elseif ( $count % 100 > 10 && $count % 100 < 20 ) {
$index = 2;
} else {
$index = 3;
}
return $forms[$index];
}
}

View file

@ -27,33 +27,6 @@
* @ingroup Language
*/
class LanguagePl extends Language {
/**
* @param $count string
* @param $forms array
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
$forms = $this->preConvertPlural( $forms, 3 );
$count = abs( $count );
if ( $count == 1 ) {
return $forms[0]; // singular
}
switch ( $count % 10 ) {
case 2:
case 3:
case 4:
if ( $count / 10 % 10 != 1 ) {
return $forms[1]; // plural
}
default:
return $forms[2]; // plural genitive
}
}
/**
* @param $_ string
* @return string

View file

@ -1,62 +0,0 @@
<?php
/**
* Serbo-Croatian (Srpskohrvatski / Српскохрватски) specific code.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Language
*/
/**
* Serbo-Croatian (Srpskohrvatski / Српскохрватски)
*
* @ingroup Language
*/
class LanguageSh extends Language {
/**
* @param $count string
* @param $forms array
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
// if no number with word, then use $form[0] for singular and $form[1] for plural or zero
if ( count( $forms ) === 2 ) {
return $count == 1 ? $forms[0] : $forms[1];
}
// @todo FIXME: CLDR defines 4 plural forms. Form with decimals missing.
// See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sh
$forms = $this->preConvertPlural( $forms, 3 );
if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
return $forms[2];
} else {
switch ( $count % 10 ) {
case 1: return $forms[0];
case 2:
case 3:
case 4: return $forms[1];
default: return $forms[2];
}
}
}
}

View file

@ -1,51 +0,0 @@
<?php
/**
* Slovak (Slovenčina) specific code.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Language
*/
/**
* Slovak (Slovenčina)
*
* @ingroup Language
*/
class LanguageSk extends Language {
/**
* @param $count int
* @param $forms array
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
$forms = $this->preConvertPlural( $forms, 3 );
if ( $count == 1 ) {
$index = 0;
} elseif ( $count == 2 || $count == 3 || $count == 4 ) {
$index = 1;
} else {
$index = 2;
}
return $forms[$index];
}
}

View file

@ -1,46 +0,0 @@
<?php
/**
* Tigrinya (ትግርኛ) specific code.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Language
*/
/**
* Tigrinya (ትግርኛ)
*
* @ingroup Language
*/
class LanguageTi extends Language {
/**
* Use singular form for zero
*
* @param $count int
* @param $forms array
*
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
$forms = $this->preConvertPlural( $forms, 2 );
return ( $count <= 1 ) ? $forms[0] : $forms[1];
}
}

View file

@ -1,46 +0,0 @@
<?php
/**
* Tagalog (Tagalog) 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
*/
/**
* Tagalog (Tagalog)
*
* @ingroup Language
*/
class LanguageTl extends Language {
/**
* Use singular form for zero
*
* @param $count int
* @param $forms array
*
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
$forms = $this->preConvertPlural( $forms, 2 );
return ( $count <= 1 ) ? $forms[0] : $forms[1];
}
}

View file

@ -30,22 +30,6 @@
* @ingroup Language
*/
class LanguageWa extends Language {
/**
* Use singular form for zero
*
* @param $count int
* @param $forms array
*
* @return string
*/
function convertPlural( $count, $forms ) {
if ( !count( $forms ) ) {
return '';
}
$forms = $this->preConvertPlural( $forms, 2 );
return ( $count <= 1 ) ? $forms[0] : $forms[1];
}
/**
* Dates in Walloon are "1î d' <monthname>" for 1st of the month,