MediaWiki REL1_40
LanguageLa.php
Go to the documentation of this file.
1<?php
23
29class LanguageLa extends Language {
43 public function convertGrammar( $word, $case ) {
44 $grammarForms =
45 MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
46 if ( isset( $grammarForms['la'][$case][$word] ) ) {
47 return $grammarForms['la'][$case][$word];
48 }
49
50 switch ( $case ) {
51 case 'genitive':
52 // only a few declensions, and even for those mostly the singular only
53 $in = [
54 '/u[ms]$/', # 2nd declension singular
55 '/ommunia$/', # 3rd declension neuter plural (partly)
56 '/a$/', # 1st declension singular
57 '/libri$/', '/nuntii$/', '/datae$/', # 2nd declension plural (partly)
58 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
59 '/es$/' # 5th declension singular
60 ];
61 $out = [
62 'i',
63 'ommunium',
64 'ae',
65 'librorum', 'nuntiorum', 'datorum',
66 'tionis', 'ntis', 'atis',
67 'ei'
68 ];
69 return preg_replace( $in, $out, $word );
70 case 'accusative':
71 // only a few declensions, and even for those mostly the singular only
72 $in = [
73 '/u[ms]$/', # 2nd declension singular
74 '/a$/', # 1st declension singular
75 '/ommuniam$/', # 3rd declension neuter plural (partly)
76 '/libri$/', '/nuntii$/', '/datam$/', # 2nd declension plural (partly)
77 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
78 '/es$/' # 5th declension singular
79 ];
80 $out = [
81 'um',
82 'am',
83 'ommunia',
84 'libros', 'nuntios', 'data',
85 'tionem', 'ntem', 'atem',
86 'em'
87 ];
88 return preg_replace( $in, $out, $word );
89 case 'ablative':
90 // only a few declensions, and even for those mostly the singular only
91 $in = [
92 '/u[ms]$/', # 2nd declension singular
93 '/ommunia$/', # 3rd declension neuter plural (partly)
94 '/a$/', # 1st declension singular
95 '/libri$/', '/nuntii$/', '/data$/', # 2nd declension plural (partly)
96 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
97 '/es$/' # 5th declension singular
98 ];
99 $out = [
100 'o',
101 'ommunibus',
102 'a',
103 'libris', 'nuntiis', 'datis',
104 'tione', 'nte', 'ate',
105 'e'
106 ];
107 return preg_replace( $in, $out, $word );
108 default:
109 return $word;
110 }
111 }
112}
Latin (lingua Latina)
convertGrammar( $word, $case)
Convert from the nominative form of a noun to some other case.
Base class for language-specific code.
Definition Language.php:56
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.