Add support for parentLocales#38
Merged
tigrish merged 1 commit intoruby-i18n:masterfrom Nov 28, 2016
Merged
Conversation
camertron
approved these changes
Nov 28, 2016
Collaborator
camertron
left a comment
There was a problem hiding this comment.
I don't really have approval rights here, but it looks good to me :)
|
|
||
| def locales(locale, component, options) | ||
| locale = locale.to_s.gsub('_', '-').to_sym | ||
| to_i18n = lambda {|l| l.to_s.gsub('_', '-').to_sym } |
Collaborator
There was a problem hiding this comment.
Why lambdas and not regular 'ol methods?
| I18n::Locale::Fallbacks.new([locale])[locale] | ||
| defined_parents = Cldr::Export::Data::ParentLocales.new | ||
|
|
||
| ancestory = [locale] |
Use the parentLocales section to figure out the correct fallback locales. Can not use customization feature of I18n::Locale::Fallbacks since it always places the default parent local before any customizations.
ebaeb9d to
6be5cb7
Compare
Contributor
|
It seems like there's some bug
def locale_based_data(component, locale, options = {})
data = locales(locale, component, options).inject({}) do |result, locale|
data = Data.const_get(component.to_s.camelize).new(locale)it calls |
Merged
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Use the parentLocales section to figure out the correct fallback
locales. Can not use customization feature of I18n::Locale::Fallbacks
since it always places the default parent local before any customizations.