2003-12-18 02:41:39 +00:00
|
|
|
<?php
|
2012-06-07 11:06:19 +00:00
|
|
|
/**
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
*/
|
2003-12-18 02:41:39 +00:00
|
|
|
|
2024-09-27 20:18:58 +00:00
|
|
|
use MediaWiki\Language\Language;
|
2022-04-13 15:28:26 +00:00
|
|
|
use MediaWiki\MainConfigNames;
|
2022-01-06 18:44:56 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
|
2012-06-07 11:06:19 +00:00
|
|
|
/**
|
|
|
|
|
* Latin (lingua Latina)
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
*
|
2022-06-22 22:37:31 +00:00
|
|
|
* @ingroup Languages
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
*/
|
2006-07-26 07:15:39 +00:00
|
|
|
class LanguageLa extends Language {
|
2005-05-06 02:38:42 +00:00
|
|
|
/**
|
|
|
|
|
* Convert from the nominative form of a noun to some other case
|
|
|
|
|
*
|
|
|
|
|
* Just used in a couple places for sitenames; special-case as necessary.
|
2023-10-02 12:55:39 +00:00
|
|
|
* The rules are far from complete.
|
2006-06-11 15:40:17 +00:00
|
|
|
*
|
2007-02-07 21:20:43 +00:00
|
|
|
* Cases: genitive, accusative, ablative
|
2011-05-29 15:53:18 +00:00
|
|
|
*
|
2014-04-17 13:31:28 +00:00
|
|
|
* @param string $word
|
|
|
|
|
* @param string $case
|
2011-05-29 15:53:18 +00:00
|
|
|
*
|
|
|
|
|
* @return string
|
2005-05-06 02:38:42 +00:00
|
|
|
*/
|
2019-10-11 18:44:16 +00:00
|
|
|
public function convertGrammar( $word, $case ) {
|
2022-04-13 15:28:26 +00:00
|
|
|
$grammarForms =
|
|
|
|
|
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
|
2022-01-06 18:44:56 +00:00
|
|
|
if ( isset( $grammarForms['la'][$case][$word] ) ) {
|
|
|
|
|
return $grammarForms['la'][$case][$word];
|
2006-05-25 14:31:28 +00:00
|
|
|
}
|
|
|
|
|
|
2005-05-06 02:38:42 +00:00
|
|
|
switch ( $case ) {
|
2017-12-11 03:07:50 +00:00
|
|
|
case 'genitive':
|
|
|
|
|
// only a few declensions, and even for those mostly the singular only
|
|
|
|
|
$in = [
|
2024-01-29 18:03:54 +00:00
|
|
|
'/u[ms]$/', # 2nd declension singular
|
|
|
|
|
'/ommunia$/', # 3rd declension neuter plural (partly)
|
|
|
|
|
'/a$/', # 1st declension singular
|
2017-12-11 03:07:50 +00:00
|
|
|
'/libri$/', '/nuntii$/', '/datae$/', # 2nd declension plural (partly)
|
2024-01-29 18:03:54 +00:00
|
|
|
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
|
2017-12-11 03:07:50 +00:00
|
|
|
'/es$/' # 5th declension singular
|
|
|
|
|
];
|
|
|
|
|
$out = [
|
|
|
|
|
'i',
|
|
|
|
|
'ommunium',
|
|
|
|
|
'ae',
|
|
|
|
|
'librorum', 'nuntiorum', 'datorum',
|
|
|
|
|
'tionis', 'ntis', 'atis',
|
|
|
|
|
'ei'
|
|
|
|
|
];
|
|
|
|
|
return preg_replace( $in, $out, $word );
|
2023-10-02 12:55:39 +00:00
|
|
|
|
2017-12-11 03:07:50 +00:00
|
|
|
case 'accusative':
|
|
|
|
|
// only a few declensions, and even for those mostly the singular only
|
|
|
|
|
$in = [
|
2024-01-29 18:03:54 +00:00
|
|
|
'/u[ms]$/', # 2nd declension singular
|
|
|
|
|
'/a$/', # 1st declension singular
|
|
|
|
|
'/ommuniam$/', # 3rd declension neuter plural (partly)
|
2017-12-11 03:07:50 +00:00
|
|
|
'/libri$/', '/nuntii$/', '/datam$/', # 2nd declension plural (partly)
|
2024-01-29 18:03:54 +00:00
|
|
|
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
|
2017-12-11 03:07:50 +00:00
|
|
|
'/es$/' # 5th declension singular
|
|
|
|
|
];
|
|
|
|
|
$out = [
|
|
|
|
|
'um',
|
|
|
|
|
'am',
|
|
|
|
|
'ommunia',
|
|
|
|
|
'libros', 'nuntios', 'data',
|
|
|
|
|
'tionem', 'ntem', 'atem',
|
|
|
|
|
'em'
|
|
|
|
|
];
|
|
|
|
|
return preg_replace( $in, $out, $word );
|
2023-10-02 12:55:39 +00:00
|
|
|
|
2017-12-11 03:07:50 +00:00
|
|
|
case 'ablative':
|
|
|
|
|
// only a few declensions, and even for those mostly the singular only
|
|
|
|
|
$in = [
|
2024-01-29 18:03:54 +00:00
|
|
|
'/u[ms]$/', # 2nd declension singular
|
|
|
|
|
'/ommunia$/', # 3rd declension neuter plural (partly)
|
|
|
|
|
'/a$/', # 1st declension singular
|
|
|
|
|
'/libri$/', '/nuntii$/', '/data$/', # 2nd declension plural (partly)
|
|
|
|
|
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
|
2017-12-11 03:07:50 +00:00
|
|
|
'/es$/' # 5th declension singular
|
|
|
|
|
];
|
|
|
|
|
$out = [
|
|
|
|
|
'o',
|
|
|
|
|
'ommunibus',
|
|
|
|
|
'a',
|
|
|
|
|
'libris', 'nuntiis', 'datis',
|
|
|
|
|
'tione', 'nte', 'ate',
|
|
|
|
|
'e'
|
|
|
|
|
];
|
|
|
|
|
return preg_replace( $in, $out, $word );
|
2023-10-02 12:55:39 +00:00
|
|
|
|
2017-12-11 03:07:50 +00:00
|
|
|
default:
|
|
|
|
|
return $word;
|
2005-05-06 02:38:42 +00:00
|
|
|
}
|
2004-02-28 07:23:04 +00:00
|
|
|
}
|
2003-12-18 02:41:39 +00:00
|
|
|
}
|