r78562 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78561‎ | r78562 | r78563 >
Date:14:34, 18 December 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
New plural rules
Modified paths:
  • /trunk/phase3/languages/classes/LanguageGd.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/classes/LanguageGd.php
@@ -4,32 +4,39 @@
55 * @ingroup Language
66 *
77 * @author Raimond Spekking
 8+ * @author Niklas Laxström
89 */
910 class LanguageGd extends Language {
1011
1112 /**
1213 * Plural form transformations
13 - * Based on this discussion: http://translatewiki.net/w/i.php?title=Portal_talk:Gd&oldid=1094065#%C3%80ireamhan
 14+ * Based on this discussion: http://translatewiki.net/wiki/Thread:Support/New_plural_rules_for_Scots_Gaelic_(gd)
1415 *
15 - * $forms[0] - singular form (for 1)
16 - * $forms[1] - dual form (for 2)
17 - * $forms[2] - plural form 1 (for 3-10)
18 - * $forms[3] - plural form 2 (for >= 11)
 16+ * $forms[0] - 1
 17+ * $forms[1] - 2
 18+ * $forms[2] - 11
 19+ * $forms[3] - 12
 20+ * $forms[4] - 3-10, 13-19
 21+ * $forms[5] - 0, 20, rest
1922 *
2023 */
2124 function convertPlural( $count, $forms ) {
2225 if ( !count( $forms ) ) { return ''; }
23 - $forms = $this->preConvertPlural( $forms, 4 );
 26+ $forms = $this->preConvertPlural( $forms, 6 );
2427
2528 $count = abs( $count );
2629 if ( $count === 1 ) {
2730 return $forms[0];
2831 } elseif ( $count === 2 ) {
2932 return $forms[1];
30 - } elseif ( $count >= 3 && $count <= 10 ) {
 33+ } elseif ( $count === 11 ) {
3134 return $forms[2];
 35+ } elseif ( $count === 12 ) {
 36+ return $forms[3];
 37+ } elseif ( ($count >= 3 && $count <= 10) || ($count >= 13 && $count <= 19) ) {
 38+ return $forms[4];
3239 } else {
33 - return $forms[3];
 40+ return $forms[5];
3441 }
3542 }
3643 }

Status & tagging log