Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use carmen to translate available_countries helper #2537

Merged
merged 3 commits into from
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Continue to use I18n spree.country_names if defined
  • Loading branch information
jhawthorn committed Jan 31, 2018
commit c3534151af39bc6a0eb44050a8f396c785a35408
2 changes: 2 additions & 0 deletions core/app/helpers/spree/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def available_countries
[country.code, country.name]
end.to_h

country_names.update I18n.t('spree.country_names', default: {}).stringify_keys

countries.collect do |country|
country.name = country_names.fetch(country.iso, country.name)
country
Expand Down
4 changes: 4 additions & 0 deletions core/spec/helpers/base_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
it "return complete list of countries" do
expect(available_countries.count).to eq(Spree::Country.count)
end

it "uses locales for country names" do
expect(available_countries).to include(having_attributes(name: "United States of America"))
end
end

context "with a checkout zone defined" do
Expand Down