/* Please, see Language.php for general function comments */
class LanguageRu extends LanguageUtf8 {
- function LanguageRu() {
+ function __construct() {
global $wgNamespaceNamesRu, $wgMetaNamespace;
- LanguageUtf8::LanguageUtf8();
+ parent::__construct();
$wgNamespaceNamesRu[NS_PROJECT_TALK] = 'Обсуждение_' . $this->convertGrammar( $wgMetaNamespace, 'genitive' );
}
# Convert from the nominative form of a noun to some other case
# Invoked with {{grammar:case|word}}
function convertGrammar( $word, $case ) {
+ global $wgGrammarForms;
+ if ( isset($wgGrammarForms['ru'][$case][$word]) ) {
+ return $wgGrammarForms['ru'][$case][$word];
+ }
+
# These rules are not perfect, but they are currently only used for site names so it doesn't
# matter if they are wrong sometimes. Just add a special case for your site name if necessary.
#join and array_slice instead mb_substr
-
+ $ar = array();
preg_match_all( '/./us', $word, $ar );
if (!preg_match("/[a-zA-Z_]/us", $word))
switch ( $case ) {
} else {
switch ($count % 10) {
case 1: return $wordform1;
- case 2:
- case 3:
+ case 2:
+ case 3:
case 4: return $wordform2;
default: return $wordform3;
}