LanguageLa.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /** Latin (lingua Latina)
  3. *
  4. * @ingroup Language
  5. */
  6. class LanguageLa extends Language {
  7. /**
  8. * Convert from the nominative form of a noun to some other case
  9. *
  10. * Just used in a couple places for sitenames; special-case as necessary.
  11. * Rules are far from complete.
  12. *
  13. * Cases: genitive, accusative, ablative
  14. */
  15. function convertGrammar( $word, $case ) {
  16. global $wgGrammarForms;
  17. if ( isset($wgGrammarForms['la'][$case][$word]) ) {
  18. return $wgGrammarForms['la'][$case][$word];
  19. }
  20. switch ( $case ) {
  21. case 'genitive':
  22. // only a few declensions, and even for those mostly the singular only
  23. $in = array( '/u[ms]$/', # 2nd declension singular
  24. '/ommunia$/', # 3rd declension neuter plural (partly)
  25. '/a$/', # 1st declension singular
  26. '/libri$/', '/nuntii$/', # 2nd declension plural (partly)
  27. '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
  28. '/es$/' # 5th declension singular
  29. );
  30. $out = array( 'i',
  31. 'ommunium',
  32. 'ae',
  33. 'librorum', 'nuntiorum',
  34. 'tionis', 'ntis', 'atis',
  35. 'ei'
  36. );
  37. return preg_replace( $in, $out, $word );
  38. case 'accusative':
  39. // only a few declensions, and even for those mostly the singular only
  40. $in = array( '/u[ms]$/', # 2nd declension singular
  41. '/a$/', # 1st declension singular
  42. '/ommuniam$/', # 3rd declension neuter plural (partly)
  43. '/libri$/', '/nuntii$/', # 2nd declension plural (partly)
  44. '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
  45. '/es$/' # 5th declension singular
  46. );
  47. $out = array( 'um',
  48. 'am',
  49. 'ommunia',
  50. 'libros', 'nuntios',
  51. 'tionem', 'ntem', 'atem',
  52. 'em'
  53. );
  54. return preg_replace( $in, $out, $word );
  55. case 'ablative':
  56. // only a few declensions, and even for those mostly the singular only
  57. $in = array( '/u[ms]$/', # 2nd declension singular
  58. '/ommunia$/', # 3rd declension neuter plural (partly)
  59. '/a$/', # 1st declension singular
  60. '/libri$/', '/nuntii$/', # 2nd declension plural (partly)
  61. '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
  62. '/es$/' # 5th declension singular
  63. );
  64. $out = array( 'o',
  65. 'ommunibus',
  66. 'a',
  67. 'libris', 'nuntiis',
  68. 'tione', 'nte', 'ate',
  69. 'e'
  70. );
  71. return preg_replace( $in, $out, $word );
  72. default:
  73. return $word;
  74. }
  75. }
  76. }