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