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