-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
Unify/simplify the behavior of per-locale and non-per-locale files by moving per-locale generation to Segment class #320
Conversation
… moving per-locale generation to Segment class
@@ -263,6 +283,8 @@ | |||
end | |||
|
|||
context "I18n.available_locales" do | |||
# before { allow(I18n::JS).to receive(:fallbacks).and_return(false) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code o_0
All comments have been addressed. |
For your breaking changes:
|
To explain (1): Old format. Note that the %{locale} one doesn't begin with '*' - file: '/my_dir/not_per_locale.js'
only:
- '*.foo.*'
- '*.bar.*'
- file: '/my_dir/my_%{locale}.js'
only:
- 'foo.*'
- 'bar.*' New format: - file: '/my_dir/not_per_locale.js' # same
only:
- '*.foo.*'
- '*.bar.*'
- file: '/my_dir/my_%{locale}.js' # now has *
only:
- '*.foo.*'
- '*.bar.*' |
OK, I think that's more consistent and sensible. |
Updated README and CHANGELOG |
Common mistake: you have added the changelog entry for a released version o_0 |
Fixed |
Unify/simplify the behavior of per-locale and non-per-locale files by moving per-locale generation to Segment class
For the |
@michieldewit Please open another issue :) |
I created a pull request for this: #325 |
Will review it next week <3 |
This PR unifies/simplifies the behavior of per-locale and non-per-locale files.
Specifically, splitting files per-locale generation is done in the
Segment
class.save!
method, which is the final step before writing the file. (Previously, "per-locale" and "non-per-locale" files followed very different logic paths which diverged early in the processing chain.)One positive effect of this change is that the "fallbacks" feature now works for both per-locale and non-per-locale files.
Important: There are two breaking changes in this PR, hence I recommend a minor version bump.
only
/exclude
scopes which begin with '*', which is the same as non-per-locale files.Lastly, please note that I had to add
fallbacks: false
to many of the test fixtures to ensure behavior consistency.