MediaWiki  REL1_20
LanguageLa.php
Go to the documentation of this file.
00001 <?php
00029 class LanguageLa extends Language {
00043         function convertGrammar( $word, $case ) {
00044                 global $wgGrammarForms;
00045                 if ( isset( $wgGrammarForms['la'][$case][$word] ) ) {
00046                         return $wgGrammarForms['la'][$case][$word];
00047                 }
00048 
00049                 switch ( $case ) {
00050                 case 'genitive':
00051                         // only a few declensions, and even for those mostly the singular only
00052                         $in  = array(   '/u[ms]$/',                     # 2nd declension singular
00053                                         '/ommunia$/',                   # 3rd declension neuter plural (partly)
00054                                         '/a$/',                         # 1st declension singular
00055                                         '/libri$/', '/nuntii$/',        # 2nd declension plural (partly)
00056                                         '/tio$/', '/ns$/', '/as$/',     # 3rd declension singular (partly)
00057                                         '/es$/'                         # 5th declension singular
00058                                         );
00059                         $out = array(   'i',
00060                                         'ommunium',
00061                                         'ae',
00062                                         'librorum', 'nuntiorum',
00063                                         'tionis', 'ntis', 'atis',
00064                                         'ei'
00065                                         );
00066                         return preg_replace( $in, $out, $word );
00067                 case 'accusative':
00068                         // only a few declensions, and even for those mostly the singular only
00069                         $in  = array(   '/u[ms]$/',                     # 2nd declension singular
00070                                         '/a$/',                         # 1st declension singular
00071                                         '/ommuniam$/',                  # 3rd declension neuter plural (partly)
00072                                         '/libri$/', '/nuntii$/',        # 2nd declension plural (partly)
00073                                         '/tio$/', '/ns$/', '/as$/',     # 3rd declension singular (partly)
00074                                         '/es$/'                         # 5th declension singular
00075                                         );
00076                         $out = array(   'um',
00077                                         'am',
00078                                         'ommunia',
00079                                         'libros', 'nuntios',
00080                                         'tionem', 'ntem', 'atem',
00081                                         'em'
00082                                         );
00083                         return preg_replace( $in, $out, $word );
00084                 case 'ablative':
00085                         // only a few declensions, and even for those mostly the singular only
00086                         $in  = array(   '/u[ms]$/',                     # 2nd declension singular
00087                                         '/ommunia$/',                   # 3rd declension neuter plural (partly)
00088                                         '/a$/',                         # 1st declension singular
00089                                         '/libri$/', '/nuntii$/',        # 2nd declension plural (partly)
00090                                         '/tio$/', '/ns$/', '/as$/',     # 3rd declension singular (partly)
00091                                         '/es$/'                         # 5th declension singular
00092                                         );
00093                         $out = array(   'o',
00094                                         'ommunibus',
00095                                         'a',
00096                                         'libris', 'nuntiis',
00097                                         'tione', 'nte', 'ate',
00098                                         'e'
00099                                         );
00100                         return preg_replace( $in, $out, $word );
00101                 default:
00102                         return $word;
00103                 }
00104         }
00105 }