MediaWiki master
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
71 case 'accusative':
72 // only a few declensions, and even for those mostly the singular only
73 $in = [
74 '/u[ms]$/', # 2nd declension singular
75 '/a$/', # 1st declension singular
76 '/ommuniam$/', # 3rd declension neuter plural (partly)
77 '/libri$/', '/nuntii$/', '/datam$/', # 2nd declension plural (partly)
78 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
79 '/es$/' # 5th declension singular
80 ];
81 $out = [
82 'um',
83 'am',
84 'ommunia',
85 'libros', 'nuntios', 'data',
86 'tionem', 'ntem', 'atem',
87 'em'
88 ];
89 return preg_replace( $in, $out, $word );
90
91 case 'ablative':
92 // only a few declensions, and even for those mostly the singular only
93 $in = [
94 '/u[ms]$/', # 2nd declension singular
95 '/ommunia$/', # 3rd declension neuter plural (partly)
96 '/a$/', # 1st declension singular
97 '/libri$/', '/nuntii$/', '/data$/', # 2nd declension plural (partly)
98 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
99 '/es$/' # 5th declension singular
100 ];
101 $out = [
102 'o',
103 'ommunibus',
104 'a',
105 'libris', 'nuntiis', 'datis',
106 'tione', 'nte', 'ate',
107 'e'
108 ];
109 return preg_replace( $in, $out, $word );
110
111 default:
112 return $word;
113 }
114 }
115}
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:63
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.