Use carmen to translate available_countries helper #2537
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WIP: will revisit and test properly next week
In solidusio/solidus_i18n#106 we are looking to remove a feature from
solidus_i18n
which provides translations for each country based on the translations in thei18n_data
gem.We don't want to support this odd magic feature as part of i18n, and we'd like to remove the dependency on i18n_data, but at the same time we still want countries to be localized properly.
Ideally this would also be faster than the existing implementation as
available_countries
is a little bit slow.This PR replaces the the existing behaviour of using
I18n.t("spree.country_names.#{iso_code}")
with using Carmen's data to perform translations.This is the first time we are actually requiring and using carmen outside of tests and seeds, so we should consider the effect this has on startup time and memory usage.
TODO
I18n
spree.country_names.*
Carmen.i18n_backend
with each request