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 #133

Closed
wants to merge 6 commits into from

Conversation

andyduong1920
Copy link
Member

@andyduong1920 andyduong1920 commented Nov 10, 2019

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

@olivierobert olivierobert added this to the 3.3.0 milestone Nov 11, 2019
@olivierobert olivierobert self-assigned this Nov 11, 2019
@olivierobert olivierobert requested a review from a team November 11, 2019 08:11
@olivierobert olivierobert changed the base branch from chore/upgrade-rails-6-0-1 to develop November 11, 2019 08:11
@olivierobert
Copy link
Member

@anduonghien rebase required

@olivierobert olivierobert changed the title Chore/ Improve the localization concern, moving to around_action Improve the localization concern, moving to around_action Nov 11, 2019
@andyduong1920 andyduong1920 force-pushed the chore/improve-localization branch 2 times, most recently from 45d76f4 to 6ff10f9 Compare November 11, 2019 14:07
@andyduong1920
Copy link
Member Author

Rebase @olivierobert

@olivierobert olivierobert removed this from the 3.3.0 milestone Mar 12, 2020
@andyduong1920
Copy link
Member Author

Open on another PR #241

@malparty malparty deleted the chore/improve-localization branch July 22, 2022 08:37
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