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

Improve the localization concern, moving to around_action #241

Merged
merged 8 commits into from Oct 15, 2020

Conversation

andyduong1920
Copy link
Member

Closes #127

What happened

Insight

Switch the locale by using before_action isn't safe, the locale doesn't set return correctly on some request randomly (I faced with that issue on a project).

Here is a similar issue: ruby-i18n/i18n#381

And the official Rails guide also prefer to using around_action to switch the locale https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requests (rails/rails#34356)

I also add the configuration for the I18n as since from Rails I18n 1.1.0, the config config.i18n.fallbacks = true (was generated by Rails) isn't correct anymore https://github.com/ruby-i18n/i18n/releases/tag/v1.1.0

Proof Of Work

image

@andyduong1920 andyduong1920 marked this pull request as draft October 7, 2020 05:13
@andyduong1920 andyduong1920 self-assigned this Oct 7, 2020
@andyduong1920 andyduong1920 marked this pull request as ready for review October 7, 2020 05:40
@andyduong1920 andyduong1920 requested a review from a team October 7, 2020 05:40
@andyduong1920 andyduong1920 force-pushed the chore/improve-localization-2 branch 2 times, most recently from 7f791ca to 5233f9d Compare October 9, 2020 02:28
@andyduong1920
Copy link
Member Author

andyduong1920 commented Oct 14, 2020

@byhbt I adjust the PR base on your comment by adding the comment and change the split from , to just , for less confusing

@andyduong1920 andyduong1920 added this to the 4.2.0 milestone Oct 14, 2020
@andyduong1920 andyduong1920 changed the title Improve the localization concern, moving to around_action #133 Improve the localization concern, moving to around_action Oct 14, 2020
@ankitkalia1195 ankitkalia1195 merged commit 75b4a4c into develop Oct 15, 2020
@andyduong1920 andyduong1920 mentioned this pull request Oct 16, 2020
@andyduong1920 andyduong1920 removed this from the 4.3.0 milestone Jan 18, 2021
@malparty malparty deleted the chore/improve-localization-2 branch July 22, 2022 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using around_action to set the locale
6 participants