MediaWiki  REL1_22
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(
00053                 '/u[ms]$/',                 # 2nd declension singular
00054                 '/ommunia$/',               # 3rd declension neuter plural (partly)
00055                 '/a$/',                     # 1st declension singular
00056                 '/libri$/', '/nuntii$/',    # 2nd declension plural (partly)
00057                 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
00058                 '/es$/'                     # 5th declension singular
00059             );
00060             $out = array(
00061                 'i',
00062                 'ommunium',
00063                 'ae',
00064                 'librorum', 'nuntiorum',
00065                 'tionis', 'ntis', 'atis',
00066                 'ei'
00067             );
00068             return preg_replace( $in, $out, $word );
00069         case 'accusative':
00070             // only a few declensions, and even for those mostly the singular only
00071             $in = array(
00072                 '/u[ms]$/',                 # 2nd declension singular
00073                 '/a$/',                     # 1st declension singular
00074                 '/ommuniam$/',              # 3rd declension neuter plural (partly)
00075                 '/libri$/', '/nuntii$/',    # 2nd declension plural (partly)
00076                 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
00077                 '/es$/'                     # 5th declension singular
00078             );
00079             $out = array(
00080                 'um',
00081                 'am',
00082                 'ommunia',
00083                 'libros', 'nuntios',
00084                 'tionem', 'ntem', 'atem',
00085                 'em'
00086             );
00087             return preg_replace( $in, $out, $word );
00088         case 'ablative':
00089             // only a few declensions, and even for those mostly the singular only
00090             $in = array(
00091                 '/u[ms]$/',                 # 2nd declension singular
00092                 '/ommunia$/',               # 3rd declension neuter plural (partly)
00093                 '/a$/',                     # 1st declension singular
00094                 '/libri$/', '/nuntii$/',    # 2nd declension plural (partly)
00095                 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
00096                 '/es$/'                     # 5th declension singular
00097             );
00098             $out = array(
00099                 'o',
00100                 'ommunibus',
00101                 'a',
00102                 'libris', 'nuntiis',
00103                 'tione', 'nte', 'ate',
00104                 'e'
00105             );
00106             return preg_replace( $in, $out, $word );
00107         default:
00108             return $word;
00109         }
00110     }
00111 }