Using __construct for all the language constructors, and few minor fixes.
[lhc/web/wiklou.git] / languages / LanguageRu.php
index a094804..4b1b385 100644 (file)
@@ -116,9 +116,9 @@ if (!$wgCachedMessageArrays) {
 
 /* 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' );
        }
 
@@ -162,11 +162,16 @@ class LanguageRu extends LanguageUtf8 {
        # 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 ) {
@@ -209,8 +214,8 @@ class LanguageRu extends LanguageUtf8 {
                } else {
                        switch ($count % 10) {
                                case 1: return $wordform1;
-                               case 2: 
-                               case 3: 
+                               case 2:
+                               case 3:
                                case 4: return $wordform2;
                                default: return $wordform3;
                        }