[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Latin (lingua Latina) specific code. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 * http://www.gnu.org/copyleft/gpl.html 19 * 20 * @file 21 * @ingroup Language 22 */ 23 24 /** 25 * Latin (lingua Latina) 26 * 27 * @ingroup Language 28 */ 29 class LanguageLa extends Language { 30 /** 31 * Convert from the nominative form of a noun to some other case 32 * 33 * Just used in a couple places for sitenames; special-case as necessary. 34 * Rules are far from complete. 35 * 36 * Cases: genitive, accusative, ablative 37 * 38 * @param string $word 39 * @param string $case 40 * 41 * @return string 42 */ 43 function convertGrammar( $word, $case ) { 44 global $wgGrammarForms; 45 if ( isset( $wgGrammarForms['la'][$case][$word] ) ) { 46 return $wgGrammarForms['la'][$case][$word]; 47 } 48 49 switch ( $case ) { 50 case 'genitive': 51 // only a few declensions, and even for those mostly the singular only 52 $in = array( 53 '/u[ms]$/', # 2nd declension singular 54 '/ommunia$/', # 3rd declension neuter plural (partly) 55 '/a$/', # 1st declension singular 56 '/libri$/', '/nuntii$/', # 2nd declension plural (partly) 57 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly) 58 '/es$/' # 5th declension singular 59 ); 60 $out = array( 61 'i', 62 'ommunium', 63 'ae', 64 'librorum', 'nuntiorum', 65 'tionis', 'ntis', 'atis', 66 'ei' 67 ); 68 return preg_replace( $in, $out, $word ); 69 case 'accusative': 70 // only a few declensions, and even for those mostly the singular only 71 $in = array( 72 '/u[ms]$/', # 2nd declension singular 73 '/a$/', # 1st declension singular 74 '/ommuniam$/', # 3rd declension neuter plural (partly) 75 '/libri$/', '/nuntii$/', # 2nd declension plural (partly) 76 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly) 77 '/es$/' # 5th declension singular 78 ); 79 $out = array( 80 'um', 81 'am', 82 'ommunia', 83 'libros', 'nuntios', 84 'tionem', 'ntem', 'atem', 85 'em' 86 ); 87 return preg_replace( $in, $out, $word ); 88 case 'ablative': 89 // only a few declensions, and even for those mostly the singular only 90 $in = array( 91 '/u[ms]$/', # 2nd declension singular 92 '/ommunia$/', # 3rd declension neuter plural (partly) 93 '/a$/', # 1st declension singular 94 '/libri$/', '/nuntii$/', # 2nd declension plural (partly) 95 '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly) 96 '/es$/' # 5th declension singular 97 ); 98 $out = array( 99 'o', 100 'ommunibus', 101 'a', 102 'libris', 'nuntiis', 103 'tione', 'nte', 'ate', 104 'e' 105 ); 106 return preg_replace( $in, $out, $word ); 107 default: 108 return $word; 109 } 110 } 111 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |