Skip to content

Commit

Permalink
Fix symbol resolving with pluralization
Browse files Browse the repository at this point in the history
  • Loading branch information
movermeyer committed Aug 23, 2022
1 parent 32c957e commit 88c31c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/i18n/backend/simple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def lookup(locale, key, scope = [], options = EMPTY_HASH)
return nil unless result.has_key?(_key)
end
result = result[_key]
result = resolve_entry(locale, _key, result, options.merge(:scope => nil)) if result.is_a?(Symbol)
result = resolve_entry(locale, _key, result, Utils.except(options.merge(:scope => nil), :count)) if result.is_a?(Symbol)
result
end
end
Expand Down
10 changes: 10 additions & 0 deletions test/backend/pluralization_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,14 @@ def setup
test "Fallbacks can pick up rules from fallback locales, too" do
assert_equal @rule, I18n.backend.send(:pluralizer, :'xx-XX')
end

test "linked lookup works with pluralization backend" do
I18n.backend.store_translations(:xx, {
:automobiles => :autos,
:autos => :cars,
:cars => { :porsche => { :one => "I have %{count} Porsche πŸš—", :other => "I have %{count} Porsches πŸš—" } }
})
assert_equal "I have 1 Porsche πŸš—", I18n.t(:'automobiles.porsche', count: 1, :locale => :xx)
assert_equal "I have 20 Porsches πŸš—", I18n.t(:'automobiles.porsche', count: 20, :locale => :xx)
end
end

0 comments on commit 88c31c7

Please sign in to comment.