<?php
/** Russian (русский язык)
*
- * Based on Language.php 1.772
- * and ru.wikipedia MediaWiki namespace (2006-01-06)
+ * You can contact Alexander Sigachov (alexander.sigachov at Googgle Mail)
*
* @package MediaWiki
* @subpackage Language
MAG_CURRENTMONTHNAMEGEN => array( 1, 'CURRENTMONTHNAMEGEN','НАЗВАНИЕТЕКУЩЕГОМЕСЯЦАРОД'),
MAG_CURRENTMONTHABBREV => array( 1, 'CURRENTMONTHABBREV', 'НАЗВАНИЕТЕКУЩЕГОМЕСЯЦААБР'),
MAG_CURRENTDAY => array( 1, 'CURRENTDAY','ТЕКУЩИЙДЕНЬ'),
+ MAG_CURRENTDAY2 => array( 1, 'CURRENTDAY2','ТЕКУЩИЙДЕНЬ2'),
MAG_CURRENTDAYNAME => array( 1, 'CURRENTDAYNAME','НАЗВАНИЕТЕКУЩЕГОДНЯ'),
MAG_CURRENTYEAR => array( 1, 'CURRENTYEAR','ТЕКУЩИЙГОД'),
MAG_CURRENTTIME => array( 1, 'CURRENTTIME','ТЕКУЩЕЕВРЕМЯ'),
/* 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 ) {
}
function convertPlural( $count, $wordform1, $wordform2, $wordform3) {
- $count = str_replace (' ', '', $count);
+ $count = str_replace (' ', '', $count);
if ($count > 10 && floor(($count % 100) / 10) == 1) {
return $wordform3;
} else {
switch ($count % 10) {
case 1: return $wordform1;
- case 2:
- case 3:
+ case 2:
+ case 3:
case 4: return $wordform2;
default: return $wordform3;
}
}
}
- /**
- * Russian numeric format is 123 456,78
+ /*
+ * Russian numeric format is "12 345,67" but "1234,56"
*/
- function formatNum( $number, $year = false ) {
- return $year ? $number : strtr($this->commafy($number), '.,', ', ' );
+
+ function commafy($_) {
+ if (!preg_match('/^\d{1,4}$/',$_)) {
+ return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
+ } else {
+ return $_;
+ }
}
-}
+ function separatorTransformTable() {
+ return array(
+ ',' => "\xc2\xa0",
+ '.' => ','
+ );
+ }
+}
?>