MediaWiki master
LanguageLa.php
Go to the documentation of this file.
1<?php
10
16class LanguageLa extends Language {
30 public function convertGrammar( $word, $case ) {
31 $grammarForms =
32 MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
33 if ( isset( $grammarForms['la'][$case][$word] ) ) {
34 return $grammarForms['la'][$case][$word];
35 }
36
37 switch ( $case ) {
38 case 'genitive':
39 // only a few declensions, and even for those mostly the singular only
40 $in = [
41 '/u[ms]$/', # 2nd declension singular
42 '/ommunia$/', # 3rd declension neuter plural (partly)
43 '/a$/', # 1st declension singular
44 '/libri$/', '/nuntii$/', '/datae$/', # 2nd declension plural (partly)
45 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
46 '/es$/' # 5th declension singular
47 ];
48 $out = [
49 'i',
50 'ommunium',
51 'ae',
52 'librorum', 'nuntiorum', 'datorum',
53 'tionis', 'ntis', 'atis',
54 'ei'
55 ];
56 return preg_replace( $in, $out, $word );
57
58 case 'accusative':
59 // only a few declensions, and even for those mostly the singular only
60 $in = [
61 '/u[ms]$/', # 2nd declension singular
62 '/a$/', # 1st declension singular
63 '/ommuniam$/', # 3rd declension neuter plural (partly)
64 '/libri$/', '/nuntii$/', '/datam$/', # 2nd declension plural (partly)
65 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
66 '/es$/' # 5th declension singular
67 ];
68 $out = [
69 'um',
70 'am',
71 'ommunia',
72 'libros', 'nuntios', 'data',
73 'tionem', 'ntem', 'atem',
74 'em'
75 ];
76 return preg_replace( $in, $out, $word );
77
78 case 'ablative':
79 // only a few declensions, and even for those mostly the singular only
80 $in = [
81 '/u[ms]$/', # 2nd declension singular
82 '/ommunia$/', # 3rd declension neuter plural (partly)
83 '/a$/', # 1st declension singular
84 '/libri$/', '/nuntii$/', '/data$/', # 2nd declension plural (partly)
85 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
86 '/es$/' # 5th declension singular
87 ];
88 $out = [
89 'o',
90 'ommunibus',
91 'a',
92 'libris', 'nuntiis', 'datis',
93 'tione', 'nte', 'ate',
94 'e'
95 ];
96 return preg_replace( $in, $out, $word );
97
98 default:
99 return $word;
100 }
101 }
102}
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:68
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.