f042b0277244941c5eae3be99377e65e9eb7c731
[lhc/web/wiklou.git] / languages / classes / LanguageGd.php
1 <?php
2 /**
3 * Scots Gaelic (Gàidhlig) specific code.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @author Raimond Spekking
22 * @author Niklas Laxström
23 * @ingroup Language
24 */
25
26 /**
27 * Scots Gaelic (Gàidhlig)
28 *
29 * @ingroup Language
30 */
31 class LanguageGd extends Language {
32
33 /**
34 * Plural form transformations
35 * Based on this discussion: http://translatewiki.net/wiki/Thread:Support/New_plural_rules_for_Scots_Gaelic_(gd)
36 *
37 * $forms[0] - 1
38 * $forms[1] - 2
39 * $forms[2] - 11
40 * $forms[3] - 12
41 * $forms[4] - 3-10, 13-19
42 * $forms[5] - 0, 20, rest
43 *
44 * @param $count int
45 * @param $forms array
46 *
47 * @return string
48 */
49 function convertPlural( $count, $forms ) {
50 if ( !count( $forms ) ) { return ''; }
51 $forms = $this->preConvertPlural( $forms, 6 );
52
53 $count = abs( $count );
54 if ( $count == 1 ) {
55 return $forms[0];
56 } elseif ( $count == 2 ) {
57 return $forms[1];
58 } elseif ( $count == 11 ) {
59 return $forms[2];
60 } elseif ( $count == 12 ) {
61 return $forms[3];
62 } elseif ( ($count >= 3 && $count <= 10) || ($count >= 13 && $count <= 19) ) {
63 return $forms[4];
64 } else {
65 return $forms[5];
66 }
67 }
68 }