Stylize languages/*, languages/classes/*, but not languages/messages/*
[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 function convertGrammar( $word, $case ) {
17 global $wgGrammarForms;
18 if ( isset( $wgGrammarForms['la'][$case][$word] ) ) {
19 return $wgGrammarForms['la'][$case][$word];
20 }
21
22 switch ( $case ) {
23 case 'genitive':
24 // only a few declensions, and even for those mostly the singular only
25 $in = array( '/u[ms]$/', # 2nd declension singular
26 '/ommunia$/', # 3rd declension neuter plural (partly)
27 '/a$/', # 1st declension singular
28 '/libri$/', '/nuntii$/', # 2nd declension plural (partly)
29 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
30 '/es$/' # 5th declension singular
31 );
32 $out = array( 'i',
33 'ommunium',
34 'ae',
35 'librorum', 'nuntiorum',
36 'tionis', 'ntis', 'atis',
37 'ei'
38 );
39 return preg_replace( $in, $out, $word );
40 case 'accusative':
41 // only a few declensions, and even for those mostly the singular only
42 $in = array( '/u[ms]$/', # 2nd declension singular
43 '/a$/', # 1st declension singular
44 '/ommuniam$/', # 3rd declension neuter plural (partly)
45 '/libri$/', '/nuntii$/', # 2nd declension plural (partly)
46 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
47 '/es$/' # 5th declension singular
48 );
49 $out = array( 'um',
50 'am',
51 'ommunia',
52 'libros', 'nuntios',
53 'tionem', 'ntem', 'atem',
54 'em'
55 );
56 return preg_replace( $in, $out, $word );
57 case 'ablative':
58 // only a few declensions, and even for those mostly the singular only
59 $in = array( '/u[ms]$/', # 2nd declension singular
60 '/ommunia$/', # 3rd declension neuter plural (partly)
61 '/a$/', # 1st declension singular
62 '/libri$/', '/nuntii$/', # 2nd declension plural (partly)
63 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
64 '/es$/' # 5th declension singular
65 );
66 $out = array( 'o',
67 'ommunibus',
68 'a',
69 'libris', 'nuntiis',
70 'tione', 'nte', 'ate',
71 'e'
72 );
73 return preg_replace( $in, $out, $word );
74 default:
75 return $word;
76 }
77 }
78 }