Makes convertPlural compatible (strict standards)
[lhc/web/wiklou.git] / languages / classes / LanguageLv.php
1 <?php
2 /** Latvian (Latviešu)
3 *
4 * @package MediaWiki
5 * @subpackage Language
6 *
7 * @author Niklas Laxström
8 *
9 * @copyright Copyright © 2006, Niklas Laxström
10 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
11 */
12
13 class LanguageLv extends Language {
14 /**
15 * 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.
16 *
17 * Example: {{plural:{{NUMBEROFARTICLES}}|article|articles}}
18 *
19 * @param integer $count
20 * @param string $wordform1
21 * @param string $wordform2
22 * @param string $wordform3 (not used)
23 * @return string
24 */
25 function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5 ) {
26 return ( ( $count % 10 == 1 ) && ( $count % 100 != 11 ) ) ? $wordform1 : $wordform2;
27 }
28
29 # Convert from the nominative form of a noun to some other case
30 # Invoked with {{GRAMMAR:case|word}}
31 # ģenitīvs - kā, datīvs - kam, akuzatīvs - ko, lokatīvs - kur.
32 /**
33 * Cases: ģenitīvs, datīvs, akuzatīvs, lokatīvs
34 */
35 function convertGrammar( $word, $case ) {
36 global $wgGrammarForms;
37
38 $wgGrammarForms['lv']['ģenitīvs' ]['Vikipēdija'] = 'Vikipēdijas';
39 $wgGrammarForms['lv']['ģenitīvs' ]['Vikivārdnīca'] = 'Vikivārdnīcas';
40 $wgGrammarForms['lv']['datīvs' ]['Vikipēdija'] = 'Vikipēdijai';
41 $wgGrammarForms['lv']['datīvs' ]['Vikivārdnīca'] = 'Vikivārdnīcai';
42 $wgGrammarForms['lv']['akuzatīvs']['Vikipēdija'] = 'Vikipēdiju';
43 $wgGrammarForms['lv']['akuzatīvs']['Vikivārdnīca'] = 'Vikivārdnīcu';
44 $wgGrammarForms['lv']['lokatīvs' ]['Vikipēdija'] = 'Vikipēdijā';
45 $wgGrammarForms['lv']['lokatīvs' ]['Vikivārdnīca'] = 'Vikivārdnīcā';
46
47 if ( isset($wgGrammarForms['lv'][$case][$word]) ) {
48 return $wgGrammarForms['lv'][$case][$word];
49 }
50
51 return $word;
52
53 }
54
55 }
56
57 ?>