-
Notifications
You must be signed in to change notification settings - Fork 216
Expand file tree
/
Copy pathEs.php
More file actions
76 lines (71 loc) · 1.85 KB
/
Copy pathEs.php
File metadata and controls
76 lines (71 loc) · 1.85 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Stringy\Inflections;
/**
* Spanish inflection rules.
*/
class Es extends Inflector
{
/**
* Return an array of pluralization rules, from most to least specific, in the form $rule => $replacement
*
* @return array
*/
public function pluralRules()
{
return [
'/ú([sn])$/i' => 'u\1es',
'/ó([sn])$/i' => 'o\1es',
'/í([sn])$/i' => 'i\1es',
'/é([sn])$/i' => 'e\1es',
'/á([sn])$/i' => 'a\1es',
'/z$/i' => 'ces',
'/([aeiou]s)$/i' => '\1',
'/([^aeéiou])$/i' => '\1es',
'/$/' => 's',
];
}
/**
* Return an array of singularization rules, from most to least specific, in the form $rule => $replacement
*
*
* @return array
*/
public function singularRules()
{
return [
'/ereses$/' => 'erés',
'/iones$/' => 'ión',
'/ces$/' => 'z',
'/es$/' => '',
'/s$/' => '',
];
}
/**
* Return an array of irregular replacements, in the form singular => plural ('goose' => 'geese')
*
* @return array
*/
public function irregularRules()
{
return [
'el' => 'los',
'lunes' => 'lunes',
'rompecabezas' => 'rompecabezas',
'crisis' => 'crisis',
'papá' => 'papás',
'mamá' => 'mamás',
'sofá' => 'sofás',
// because 'mes' is considered already a plural
'mes' => 'meses',
];
}
/**
* Return an array of uncountable rules (sheep, police)
*
* @return array
*/
public function uncountableRules()
{
return [];
}
}