-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplurals.rb
87 lines (85 loc) · 3.96 KB
/
plurals.rb
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
77
78
79
80
81
82
83
84
85
86
87
# frozen_string_literal: true
{
# Azerbaijani
az: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Welsh
cy: { i18n: { plural: { keys: %i[zero one two few many other],
rule:
lambda do |n|
case n
when 0 then :zero
when 1 then :one
when 2 then :two
when 3 then :few
when 6 then :many
else :other
end
end } } },
# Dari - this isn't an iso code. Probably should be 'prs' as per ISO 639-3.
dr: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Latin America and Caribbean Spanish
"es-419": { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Persian
fa: { i18n: { plural: { keys: %i[one other], rule: ->(n) { [0, 1].include?(n) ? :one : :other } } } },
# Gujarati
gu: { i18n: { plural: { keys: %i[one other], rule: ->(n) { [0, 1].include?(n) ? :one : :other } } } },
# Scottish Gaelic
gd: { i18n: { plural: { keys: %i[one two few other],
rule: lambda do |n|
if [1, 11].include?(n)
:one
elsif [2, 12].include?(n)
:two
elsif [3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19].include?(n)
:few
else
:other
end
end } } },
# Armenian
hy: { i18n: { plural: { keys: %i[one other], rule: ->(n) { [0, 1].include?(n) ? :one : :other } } } },
# Kazakh
kk: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Maltese
mt: { i18n: { plural: { keys: %i[one few many other],
rule:
lambda do |n|
n ||= 0
mod100 = n % 100
if n == 1
:one
elsif n.zero? || (2..10).to_a.include?(mod100)
:few
elsif (11..19).to_a.include?(mod100)
:many
else
:other
end
end } } },
# Punjabi Shahmukhi
"pa-pk": { i18n: { plural: { keys: %i[one other], rule: ->(n) { [0, 1].include?(n) ? :one : :other } } } },
# Pashto
ps: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Sinhalese
si: { i18n: { plural: { keys: %i[one other], rule: ->(n) { [0, 1].include?(n) ? :one : :other } } } },
# Somali
so: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Albanian
sq: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Norwegian
no: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Tamil
ta: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Turkmen
tk: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Uzbek
uz: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Yiddish
yi: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
# Chinese
zh: { i18n: { plural: { keys: %i[other], rule: proc { :other } } } },
# Chinese Hong Kong
"zh-hk": { i18n: { plural: { keys: %i[other], rule: proc { :other } } } },
# Chinese Taiwan
"zh-tw": { i18n: { plural: { keys: %i[other], rule: proc { :other } } } }
}