MediaWiki master
LanguageSh.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Languages;
8
12
18class LanguageSh extends Language {
24 public function convertGrammar( $word, $case ) {
25 $grammarForms =
27
28 if ( !isset( $grammarForms['sh'] ) ) {
29 return $word;
30 }
31
32 if ( isset( $grammarForms['sh'][$case][$word] ) ) {
33 return $grammarForms['sh'][$case][$word];
34 }
35
36 # if the word is not supported (i.e. there's no entry for any case),
37 # use a descriptive declension for it
38 $isWordSupported = false;
39 foreach ( $grammarForms['sh'] as $caseForms ) {
40 if ( isset( $caseForms[$word] ) ) {
41 $isWordSupported = true;
42 break;
43 }
44 }
45
46 # descriptive declension for unknown projects
47 if ( !$isWordSupported && isset( $grammarForms['sh'][$case]['projekt'] ) ) {
48 return $grammarForms['sh'][$case]['projekt'] . ' ' . $word;
49 }
50
51 # this will return the original value for 'nominativ' (nominative)
52 return $word;
53 }
54}
55
57class_alias( LanguageSh::class, 'LanguageSh' );
Base class for language-specific code.
Definition Language.php:65
Serbo-Croatian (srpskohrvatski / српскохрватски)
convertGrammar( $word, $case)
Cases: genitiv, dativ, akuzativ, vokativ, instrumental, lokativ.
A class containing constants representing the names of configuration variables.
const GrammarForms
Name constant for the GrammarForms setting, for use with Config::get()
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.