MediaWiki master
LanguageSh.php
Go to the documentation of this file.
1<?php
10
16class LanguageSh extends Language {
22 public function convertGrammar( $word, $case ) {
23 $grammarForms =
24 MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
25
26 if ( !isset( $grammarForms['sh'] ) ) {
27 return $word;
28 }
29
30 if ( isset( $grammarForms['sh'][$case][$word] ) ) {
31 return $grammarForms['sh'][$case][$word];
32 }
33
34 # if the word is not supported (i.e. there's no entry for any case),
35 # use a descriptive declension for it
36 $isWordSupported = false;
37 foreach ( $grammarForms['sh'] as $caseForms ) {
38 if ( isset( $caseForms[$word] ) ) {
39 $isWordSupported = true;
40 break;
41 }
42 }
43
44 # descriptive declension for unknown projects
45 if ( !$isWordSupported && isset( $grammarForms['sh'][$case]['projekt'] ) ) {
46 return $grammarForms['sh'][$case]['projekt'] . ' ' . $word;
47 }
48
49 # this will return the original value for 'nominativ' (nominative)
50 return $word;
51 }
52}
Serbo-Croatian (srpskohrvatski / српскохрватски)
convertGrammar( $word, $case)
Cases: genitiv, dativ, akuzativ, vokativ, instrumental, lokativ.
Base class for language-specific code.
Definition Language.php:70
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.