Skip to content

Commit 886ff67

Browse files
ssendevkuroda
authored andcommittedMay 10, 2016
use common pluralizations for he (svenfuchs#628)
it had a custom rule that is also defined in the common rules and keys which couldn't be reached with the rule
1 parent fc61b4b commit 886ff67

File tree

2 files changed

+2
-45
lines changed

2 files changed

+2
-45
lines changed
 

‎rails/pluralization/he.rb

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
module RailsI18n
2-
module Pluralization
3-
module Hebrew
4-
def self.rule
5-
lambda do |n|
6-
if n == 1
7-
:one
8-
else
9-
:other
10-
end
11-
end
12-
end
13-
end
14-
end
15-
end
1+
require 'rails_i18n/common_pluralizations/one_other'
162

17-
{ :he => {
18-
:i18n => {
19-
:plural => {
20-
:keys => [:one, :two, :many, :other],
21-
:rule => RailsI18n::Pluralization::Hebrew.rule }}}}
3+
::RailsI18n::Pluralization::OneOther.with_locale(:he)

‎spec/unit/pluralization_spec.rb

-25
Original file line numberDiff line numberDiff line change
@@ -248,31 +248,6 @@
248248

249249
describe 'Hebrew', :locale => :he do
250250
it_behaves_like 'an ordinary pluralization rule'
251-
252-
it 'has "one", "two", "many" and "other" plural keys' do
253-
plural_keys.size.should == 4
254-
plural_keys.should include(:one, :two, :many, :other)
255-
end
256-
257-
it "detects that 1 in category 'one'" do
258-
rule.call(1).should == :one
259-
end
260-
261-
it "detects that 2 in category 'two'" do
262-
rule.call(2).should == :other
263-
end
264-
265-
[10, 30, 70, 100, 130].each do |count|
266-
it "detects that #{count} in category 'many'" do
267-
rule.call(count).should == :other
268-
end
269-
end
270-
271-
[0, 1.2, 3.94, 8.2, 11, 12, 15, 19, 25, 27, 31, 52, 84, 99].each do |count|
272-
it "detects that #{count} in category 'other'" do
273-
rule.call(count).should == :other
274-
end
275-
end
276251
end
277252

278253
describe 'Hindi', :locale => :hi do

0 commit comments

Comments
 (0)
Please sign in to comment.