Added result properties to action=paraminfo
[lhc/web/wiklou.git] / languages / classes / LanguageLa.php
1 <?php
2
3 /** Latin (lingua Latina)
4 *
5 * @ingroup Language
6 */
7 class LanguageLa extends Language {
8 /**
9 * Convert from the nominative form of a noun to some other case
10 *
11 * Just used in a couple places for sitenames; special-case as necessary.
12 * Rules are far from complete.
13 *
14 * Cases: genitive, accusative, ablative
15 *
16 * @param $word string
17 * @param $case string
18 *
19 * @return string
20 */
21 function convertGrammar( $word, $case ) {
22 global $wgGrammarForms;
23 if ( isset( $wgGrammarForms['la'][$case][$word] ) ) {
24 return $wgGrammarForms['la'][$case][$word];
25 }
26
27 switch ( $case ) {
28 case 'genitive':
29 // only a few declensions, and even for those mostly the singular only
30 $in = array( '/u[ms]$/', # 2nd declension singular
31 '/ommunia$/', # 3rd declension neuter plural (partly)
32 '/a$/', # 1st declension singular
33 '/libri$/', '/nuntii$/', # 2nd declension plural (partly)
34 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
35 '/es$/' # 5th declension singular
36 );
37 $out = array( 'i',
38 'ommunium',
39 'ae',
40 'librorum', 'nuntiorum',
41 'tionis', 'ntis', 'atis',
42 'ei'
43 );
44 return preg_replace( $in, $out, $word );
45 case 'accusative':
46 // only a few declensions, and even for those mostly the singular only
47 $in = array( '/u[ms]$/', # 2nd declension singular
48 '/a$/', # 1st declension singular
49 '/ommuniam$/', # 3rd declension neuter plural (partly)
50 '/libri$/', '/nuntii$/', # 2nd declension plural (partly)
51 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
52 '/es$/' # 5th declension singular
53 );
54 $out = array( 'um',
55 'am',
56 'ommunia',
57 'libros', 'nuntios',
58 'tionem', 'ntem', 'atem',
59 'em'
60 );
61 return preg_replace( $in, $out, $word );
62 case 'ablative':
63 // only a few declensions, and even for those mostly the singular only
64 $in = array( '/u[ms]$/', # 2nd declension singular
65 '/ommunia$/', # 3rd declension neuter plural (partly)
66 '/a$/', # 1st declension singular
67 '/libri$/', '/nuntii$/', # 2nd declension plural (partly)
68 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
69 '/es$/' # 5th declension singular
70 );
71 $out = array( 'o',
72 'ommunibus',
73 'a',
74 'libris', 'nuntiis',
75 'tione', 'nte', 'ate',
76 'e'
77 );
78 return preg_replace( $in, $out, $word );
79 default:
80 return $word;
81 }
82 }
83 }