Skip to content

Commit

Permalink
Update plural rules with several bug fixes (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron committed Aug 22, 2016
1 parent d1b7d64 commit cb3aa9a
Show file tree
Hide file tree
Showing 44 changed files with 171 additions and 147 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -18,7 +18,7 @@ group :development do

gem 'ruby-cldr', github: 'svenfuchs/ruby-cldr'
gem 'i18n', '~> 0.6.11'
gem 'cldr-plurals', '~> 1.0.0'
gem 'cldr-plurals', '~> 1.0'

gem 'rest-client', '~> 1.8'
end
Expand Down
7 changes: 4 additions & 3 deletions resources/locales/ar/plurals.yml
Expand Up @@ -2,9 +2,10 @@
:ar:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((3..10).include?(n
% 100) ? :few : ((11..99).include?(n % 100) ? :many : (n == 1 ? :one : (n ==
2 ? :two : (n == 0 ? :zero : :other))))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((((n % 100).floor
== (n % 100)) && ((n % 100) >= 3) && ((n % 100) <= 10)) ? :few : ((((n % 100).floor
== (n % 100)) && ((n % 100) >= 11) && ((n % 100) <= 99)) ? :many : (n == 1 ?
:one : (n == 2 ? :two : (n == 0 ? :zero : :other))))) }'
:names:
- :few
- :many
Expand Down
10 changes: 6 additions & 4 deletions resources/locales/be/plurals.yml
Expand Up @@ -2,10 +2,12 @@
:be:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((2..4).include?(n
% 10) && !(12..14).include?(n % 100)) ? :few : (((n % 10 == 0 || (5..9).include?(n
% 10)) || (11..14).include?(n % 100)) ? :many : ((n % 10 == 1 && n % 100 !=
11) ? :one : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((((((n % 10).floor
== (n % 10)) && ((n % 10) >= 2) && ((n % 10) <= 4))) && (!(((n % 100).floor
== (n % 100)) && ((n % 100) >= 12) && ((n % 100) <= 14)))) ? :few : (((((n %
10 == 0) || ((((n % 10).floor == (n % 10)) && ((n % 10) >= 5) && ((n % 10) <=
9))))) || ((((n % 100).floor == (n % 100)) && ((n % 100) >= 11) && ((n % 100)
<= 14)))) ? :many : (((n % 10 == 1) && (n % 100 != 11)) ? :one : :other))) }'
:names:
- :few
- :many
Expand Down
4 changes: 2 additions & 2 deletions resources/locales/bn/plurals.yml
Expand Up @@ -2,8 +2,8 @@
:bn:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 0 || n ==
1) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 0) || (n
== 1)) ? :one : :other) }'
:names:
- :one
- :other
Expand Down
4 changes: 2 additions & 2 deletions resources/locales/ca/plurals.yml
Expand Up @@ -2,8 +2,8 @@
:ca:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
Expand Down
6 changes: 3 additions & 3 deletions resources/locales/cs/plurals.yml
Expand Up @@ -2,9 +2,9 @@
:cs:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((2..4).include?(i)
&& v == 0) ? :few : (v != 0 ? :many : ((i == 1 && v == 0) ? :one : :other)))
}'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((((((i).floor ==
(i)) && ((i) >= 2) && ((i) <= 4))) && (v == 0)) ? :few : (v != 0 ? :many : (((i
== 1) && (v == 0)) ? :one : :other))) }'
:names:
- :few
- :many
Expand Down
4 changes: 2 additions & 2 deletions resources/locales/da/plurals.yml
Expand Up @@ -2,8 +2,8 @@
:da:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((n == 1 || (t !=
0 && ((i == 0) || (i == 1)))) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((n == 1) || (((t
!= 0) && (((i == 0) || (i == 1)))))) ? :one : :other) }'
:names:
- :one
- :other
Expand Down
4 changes: 2 additions & 2 deletions resources/locales/de-CH/plurals.yml
Expand Up @@ -2,8 +2,8 @@
:de-CH:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
Expand Down
4 changes: 2 additions & 2 deletions resources/locales/de/plurals.yml
Expand Up @@ -2,8 +2,8 @@
:de:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
Expand Down
10 changes: 5 additions & 5 deletions resources/locales/en-150/plurals.yml
Expand Up @@ -2,16 +2,16 @@
:en-150:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
:ordinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((n % 10 == 3 &&
n % 100 != 13) ? :few : ((n % 10 == 1 && n % 100 != 11) ? :one : ((n % 10 ==
2 && n % 100 != 12) ? :two : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((n % 10 == 3)
&& (n % 100 != 13)) ? :few : (((n % 10 == 1) && (n % 100 != 11)) ? :one : (((n
% 10 == 2) && (n % 100 != 12)) ? :two : :other))) }'
:names:
- :few
- :one
Expand Down
10 changes: 5 additions & 5 deletions resources/locales/en-AU/plurals.yml
Expand Up @@ -2,16 +2,16 @@
:en-AU:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
:ordinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((n % 10 == 3 &&
n % 100 != 13) ? :few : ((n % 10 == 1 && n % 100 != 11) ? :one : ((n % 10 ==
2 && n % 100 != 12) ? :two : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((n % 10 == 3)
&& (n % 100 != 13)) ? :few : (((n % 10 == 1) && (n % 100 != 11)) ? :one : (((n
% 10 == 2) && (n % 100 != 12)) ? :two : :other))) }'
:names:
- :few
- :one
Expand Down
10 changes: 5 additions & 5 deletions resources/locales/en-CA/plurals.yml
Expand Up @@ -2,16 +2,16 @@
:en-CA:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
:ordinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((n % 10 == 3 &&
n % 100 != 13) ? :few : ((n % 10 == 1 && n % 100 != 11) ? :one : ((n % 10 ==
2 && n % 100 != 12) ? :two : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((n % 10 == 3)
&& (n % 100 != 13)) ? :few : (((n % 10 == 1) && (n % 100 != 11)) ? :one : (((n
% 10 == 2) && (n % 100 != 12)) ? :two : :other))) }'
:names:
- :few
- :one
Expand Down
10 changes: 5 additions & 5 deletions resources/locales/en-GB/plurals.yml
Expand Up @@ -2,16 +2,16 @@
:en-GB:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
:ordinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((n % 10 == 3 &&
n % 100 != 13) ? :few : ((n % 10 == 1 && n % 100 != 11) ? :one : ((n % 10 ==
2 && n % 100 != 12) ? :two : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((n % 10 == 3)
&& (n % 100 != 13)) ? :few : (((n % 10 == 1) && (n % 100 != 11)) ? :one : (((n
% 10 == 2) && (n % 100 != 12)) ? :two : :other))) }'
:names:
- :few
- :one
Expand Down
10 changes: 5 additions & 5 deletions resources/locales/en-IE/plurals.yml
Expand Up @@ -2,16 +2,16 @@
:en-IE:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
:ordinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((n % 10 == 3 &&
n % 100 != 13) ? :few : ((n % 10 == 1 && n % 100 != 11) ? :one : ((n % 10 ==
2 && n % 100 != 12) ? :two : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((n % 10 == 3)
&& (n % 100 != 13)) ? :few : (((n % 10 == 1) && (n % 100 != 11)) ? :one : (((n
% 10 == 2) && (n % 100 != 12)) ? :two : :other))) }'
:names:
- :few
- :one
Expand Down
10 changes: 5 additions & 5 deletions resources/locales/en-SG/plurals.yml
Expand Up @@ -2,16 +2,16 @@
:en-SG:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
:ordinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((n % 10 == 3 &&
n % 100 != 13) ? :few : ((n % 10 == 1 && n % 100 != 11) ? :one : ((n % 10 ==
2 && n % 100 != 12) ? :two : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((n % 10 == 3)
&& (n % 100 != 13)) ? :few : (((n % 10 == 1) && (n % 100 != 11)) ? :one : (((n
% 10 == 2) && (n % 100 != 12)) ? :two : :other))) }'
:names:
- :few
- :one
Expand Down
10 changes: 5 additions & 5 deletions resources/locales/en-ZA/plurals.yml
Expand Up @@ -2,16 +2,16 @@
:en-ZA:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
:ordinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((n % 10 == 3 &&
n % 100 != 13) ? :few : ((n % 10 == 1 && n % 100 != 11) ? :one : ((n % 10 ==
2 && n % 100 != 12) ? :two : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((n % 10 == 3)
&& (n % 100 != 13)) ? :few : (((n % 10 == 1) && (n % 100 != 11)) ? :one : (((n
% 10 == 2) && (n % 100 != 12)) ? :two : :other))) }'
:names:
- :few
- :one
Expand Down
10 changes: 5 additions & 5 deletions resources/locales/en/plurals.yml
Expand Up @@ -2,16 +2,16 @@
:en:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
:ordinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((n % 10 == 3 &&
n % 100 != 13) ? :few : ((n % 10 == 1 && n % 100 != 11) ? :one : ((n % 10 ==
2 && n % 100 != 12) ? :two : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((n % 10 == 3)
&& (n % 100 != 13)) ? :few : (((n % 10 == 1) && (n % 100 != 11)) ? :one : (((n
% 10 == 2) && (n % 100 != 12)) ? :two : :other))) }'
:names:
- :few
- :one
Expand Down
4 changes: 2 additions & 2 deletions resources/locales/fa/plurals.yml
Expand Up @@ -2,8 +2,8 @@
:fa:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 0 || n ==
1) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 0) || (n
== 1)) ? :one : :other) }'
:names:
- :one
- :other
Expand Down
4 changes: 2 additions & 2 deletions resources/locales/fi/plurals.yml
Expand Up @@ -2,8 +2,8 @@
:fi:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
Expand Down
8 changes: 4 additions & 4 deletions resources/locales/fil/plurals.yml
Expand Up @@ -2,10 +2,10 @@
:fil:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((((v == 0 && ((i
== 1) || (i == 2) || (i == 3))) || (v == 0 && ((i % 10 != 4) && (i % 10 != 6)
&& (i % 10 != 9)))) || (v != 0 && ((f % 10 != 4) && (f % 10 != 6) && (f % 10
!= 9)))) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((((((v == 0) &&
(((i == 1) || (i == 2) || (i == 3))))) || (((v == 0) && (((i % 10 != 4) && (i
% 10 != 6) && (i % 10 != 9))))))) || (((v != 0) && (((f % 10 != 4) && (f % 10
!= 6) && (f % 10 != 9)))))) ? :one : :other) }'
:names:
- :one
- :other
Expand Down
6 changes: 3 additions & 3 deletions resources/locales/ga/plurals.yml
Expand Up @@ -2,9 +2,9 @@
:ga:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((3..6).include?(n)
? :few : ((7..10).include?(n) ? :many : (n == 1 ? :one : (n == 2 ? :two : :other))))
}'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((((n).floor ==
(n)) && ((n) >= 3) && ((n) <= 6)) ? :few : ((((n).floor == (n)) && ((n) >= 7)
&& ((n) <= 10)) ? :many : (n == 1 ? :one : (n == 2 ? :two : :other)))) }'
:names:
- :few
- :many
Expand Down
4 changes: 2 additions & 2 deletions resources/locales/gl/plurals.yml
Expand Up @@ -2,8 +2,8 @@
:gl:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 1 && v ==
0) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 1) && (v
== 0)) ? :one : :other) }'
:names:
- :one
- :other
Expand Down
14 changes: 7 additions & 7 deletions resources/locales/gu/plurals.yml
@@ -1,17 +1,17 @@
---
:gu:
:cardinal:
:rule: ! 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v =
runtime.v(num); w = runtime.w(num); f = runtime.f(num); t = runtime.t(num);
((i == 0 || n == 1) ? :one : :other) }'
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 0) || (n
== 1)) ? :one : :other) }'
:names:
- :one
- :other
:ordinal:
:rule: ! 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v =
runtime.v(num); w = runtime.w(num); f = runtime.f(num); t = runtime.t(num);
(n == 4 ? :few : (n == 6 ? :many : (n == 1 ? :one : (((n == 2) || (n == 3))
? :two : :other)))) }'
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (n == 4 ? :few :
(n == 6 ? :many : (n == 1 ? :one : (((n == 2) || (n == 3)) ? :two : :other))))
}'
:names:
- :few
- :many
Expand Down
7 changes: 4 additions & 3 deletions resources/locales/he/plurals.yml
Expand Up @@ -2,9 +2,10 @@
:he:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((v == 0 && !(0..10).include?(n))
&& n % 10 == 0) ? :many : ((i == 1 && v == 0) ? :one : ((i == 2 && v == 0) ?
:two : :other))) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((((v == 0) &&
(!(((n).floor == (n)) && ((n) >= 0) && ((n) <= 10))))) && (n % 10 == 0)) ? :many
: (((i == 1) && (v == 0)) ? :one : (((i == 2) && (v == 0)) ? :two : :other)))
}'
:names:
- :many
- :one
Expand Down
4 changes: 2 additions & 2 deletions resources/locales/hi/plurals.yml
Expand Up @@ -2,8 +2,8 @@
:hi:
:cardinal:
:rule: 'lambda { |num, runtime| n = runtime.n(num); i = runtime.i(num); v = runtime.v(num);
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); ((i == 0 || n ==
1) ? :one : :other) }'
w = runtime.w(num); f = runtime.f(num); t = runtime.t(num); (((i == 0) || (n
== 1)) ? :one : :other) }'
:names:
- :one
- :other
Expand Down

0 comments on commit cb3aa9a

Please sign in to comment.