Merge "Added result properties to action=paraminfo"
[lhc/web/wiklou.git] / languages / classes / LanguageLv.php
1 <?php
2 /**
3 * Latvian (Latviešu) specific code.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @author Niklas Laxström
22 * @copyright Copyright © 2006, Niklas Laxström
23 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
24 * @ingroup Language
25 */
26
27 /**
28 * Latvian (Latviešu)
29 *
30 * @ingroup Language
31 */
32 class LanguageLv extends Language {
33 /**
34 * 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.
35 *
36 * Example: {{plural:{{NUMBEROFARTICLES}}|article|articles}}
37 *
38 * @param $count Integer
39 * @param $forms Array
40 * @return String
41 */
42 function convertPlural( $count, $forms ) {
43 if ( !count( $forms ) ) { return ''; }
44
45 // @todo FIXME: CLDR defines 3 plural forms instead of 2. Form for 0 is missing.
46 // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#lv
47 $forms = $this->preConvertPlural( $forms, 2 );
48
49 return ( ( $count % 10 == 1 ) && ( $count % 100 != 11 ) ) ? $forms[0] : $forms[1];
50 }
51 }