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