define('MAG_SERVERNAME', 42);
define('MAG_NUMBEROFFILES', 43);
define('MAG_IMG_MANUALTHUMB', 44);
+define('MAG_PLURALFORM', 45);
$wgVariableIDs = array(
MAG_CURRENTMONTH,
}
}
+ # PLURALFORM
+ if ( !$found && $argc >= 2 ) {
+ $mwPluralForm =& MagicWord::get( MAG_PLURALFORM );
+ if ( $mwPluralForm->matchStartAndRemove( $part1 ) ) {
+ if ($argc==2) {$args[2]=$args[1];}
+ $text = $linestart . $wgContLang->convertPluralForm( $part1, $args[0], $args[1], $args[2]);
+ $found = true;
+ }
+ }
+
# Template table test
# Did we encounter this template already? If yes, it is in the cache
return $word;
}
+ /**
+ * Plural form transformations, needed for some languages.
+ * For example, where are 3 form of plural in Russian and Polish,
+ * depending on "count mod 10". See [[w:Plural]]
+ * For English it is pretty simple.
+ *
+ * Invoked by putting {{pluralform:count|wordform1|wordform2}}
+ * or {{pluralform:count|wordform1|wordform2|wordform3}}
+ *
+ * Example: {{pluralform:{{NUMBEROFARTICLES}}|article|articles}}
+ *
+ * @param string $count
+ * @param string $wordform1
+ * @param string $wordform2
+ * @param string $wordform3 (optional)
+ * @return string
+ */
+ function convertPluralForm( $count, $wordform1, $wordform2, $wordform3) {
+ if ($count==1) {return $wordform1;}
+ else {return $wordform2;}
+ }
+
/**
* For translaing of expiry times
* @param string The validated block time in English
return $word;
}
+ function convertPluralForm( $count, $wordform1, $wordform2, $wordform3) {
+ if ($count > 10 && floor(($count % 100) / 10) == 1) {
+ return $wordform3;
+ }
+ else {
+ switch ($count % 10) {
+ case 1: return $wordform1;
+ case 2: return $wordform2;
+ case 3: return $wordform2;
+ case 4: return $wordform2;
+ default: return $wordform3;
+ }
+ }
+ }
+
function formatNum( $number ) {
global $wgTranslateNumerals;
return $wgTranslateNumerals ? strtr($number, '.,', ', ' ) : $number;