summaryrefslogtreecommitdiff
path: root/languages/classes/LanguageGd.php
blob: 5fe3d058fc07ca038eb713512abfbbc421d5c4e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/** Scots Gaelic (Gàidhlig)
 *
 * @ingroup Language
 *
 * @author Raimond Spekking
 * @author Niklas Laxström
 */
class LanguageGd extends Language {

	/**
	 * Plural form transformations
	 * Based on this discussion: http://translatewiki.net/wiki/Thread:Support/New_plural_rules_for_Scots_Gaelic_(gd)
	 *
	 * $forms[0] - 1
	 * $forms[1] - 2
	 * $forms[2] - 11
	 * $forms[3] - 12
	 * $forms[4] - 3-10, 13-19
	 * $forms[5] - 0, 20, rest
	 *
	 * @param $count int
	 * @param $forms array
	 *
	 * @return string
	 */
	function convertPlural( $count, $forms ) {
		if ( !count( $forms ) ) { return ''; }
		$forms = $this->preConvertPlural( $forms, 6 );

		$count = abs( $count );
		if ( $count === 1 ) {
			return $forms[0];
		} elseif ( $count === 2 ) {
			return $forms[1];
		} elseif ( $count === 11 ) {
			return $forms[2];
		} elseif ( $count === 12 ) {
			return $forms[3];
		} elseif ( ($count >= 3 && $count <= 10) || ($count >= 13 && $count <= 19) ) {
			return $forms[4];
		} else {
			return $forms[5];
		}
	}
}