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

Add config option to set locale #2805

Closed
wants to merge 1 commit into from
Closed

Add config option to set locale #2805

wants to merge 1 commit into from

Conversation

d-mato
Copy link

@d-mato d-mato commented Jan 8, 2017

I want to use locale ':ja' but my rails app's default_locale must be ':en'. So I tried to enable to set locale for active_admin by config file.

Usage

# config/initializers/rails_admin.rb
RailsAdmin.config do |config|
  config.locale = :ja # I18n.locale is assigned :ja only scoped for active_admin.
 ~~~
end

RailsAdmin.config.locale = :fr
controller.send(:_set_locale!)
expect(I18n.locale).to eq(:fr)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to clear RailsAdmin.config.locale, otherwise subsequent test cases fail.

@mshibuya
Copy link
Member

mshibuya commented May 1, 2019

This is application-specific, setting parent_controller to your custom class and changing locale there looks better.

@mshibuya mshibuya closed this May 1, 2019
@d-mato
Copy link
Author

d-mato commented May 6, 2019

Thanks for feedback! I'll try to edit parent_controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants