forked from OblikStudio/php-pluralization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlovenianLanguage.php
48 lines (43 loc) · 1018 Bytes
/
SlovenianLanguage.php
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
47
48
<?php
namespace Oblik\Pluralization;
class SlovenianLanguage extends Language
{
static function cardinal(float $n, int $i, int $v)
{
$imod100 = $i % 100;
if ($v == 0 && $imod100 == 1) {
return ONE;
}
elseif ($v == 0 && $imod100 == 2)
{
return TWO;
}
elseif (($v == 0 && self::inRange($imod100, [3, 4])) || $v != 0)
{
return FEW;
}
return OTHER;
}
static function ordinal(int $n)
{
return OTHER;
}
const RANGE = [
ONE . ONE => FEW,
ONE . TWO => TWO,
ONE . FEW => FEW,
ONE . OTHER => OTHER,
TWO . ONE => FEW,
TWO . TWO => TWO,
TWO . FEW => FEW,
TWO . OTHER => OTHER,
FEW . ONE => FEW,
FEW . TWO => TWO,
FEW . FEW => FEW,
FEW . OTHER => OTHER,
OTHER . ONE => FEW,
OTHER . TWO => TWO,
OTHER . FEW => FEW,
OTHER . OTHER => OTHER
];
}