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

The initializer if forcing the :en locale (reopen #187) #746

Closed
jbescoyez opened this issue Sep 28, 2011 · 8 comments
Closed

The initializer if forcing the :en locale (reopen #187) #746

jbescoyez opened this issue Sep 28, 2011 · 8 comments
Milestone

Comments

@jbescoyez
Copy link
Contributor

It seems the exact same issue as #187 has reappeared in edge.

The only workaround I found until now is to define config.i18n.locale = :fr # your locale in application.rb.

@bartocc
Copy link
Contributor

bartocc commented Sep 29, 2011

same here

@bbenezech
Copy link
Collaborator

Can you raise an error inside the I18n library to trace out where this is happening in RA?

@jbescoyez
Copy link
Contributor Author

The problem is actually happening since I18n.locale is called in the rails_admin initalizer before I18n.default_locale= in application.rb. Here is the stack trace:

/Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/gems/i18n-0.6.0/lib/i18n/config.rb:6:in `locale': unhandled exception
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/gems/i18n-0.6.0/lib/i18n.rb:147:in `translate'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/gems/activemodel-3.1.0/lib/active_model/translation.rb:55:in `human_attribute_name'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/fields/association.rb:46:in `block in <class:Association>'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/base.rb:88:in `instance_eval'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/base.rb:88:in `block in register_instance_option'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/sections/show.rb:38:in `block in initialize'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/sections/show.rb:36:in `each'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/sections/show.rb:36:in `initialize'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/sections.rb:27:in `new'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/sections.rb:27:in `block (2 levels) in included'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/model.rb:36:in `block in edit'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/model.rb:35:in `each'
    from /Users/jbescoyez/.rvm/gems/ruby-1.9.2-p290@test/bundler/gems/rails_admin-dc8cbf07ff97/lib/rails_admin/config/model.rb:35:in `edit'

@bbenezech
Copy link
Collaborator

Thx! I'll have a look.

@yorkxin
Copy link

yorkxin commented Oct 24, 2011

Same here.

For now I put I18n.locale = 'my_locale' in initializers/rails_admin.rb after the RailsAdmin.config block to resolve this problem temporarily.

Is it possible to read main application's default locale when RailsAdmin is initialized in engine.rb ?

@bbenezech
Copy link
Collaborator

Won't fix for now (design): we need to access default locale before Rails sets it in application.rb
Added a workaround for newcomers, can't do much more for now.

@zolzaya
Copy link

zolzaya commented Jan 18, 2013

This is not work for me :(. I'm using Rails 3.2.11. Any idea how to make it work?

@x-ji
Copy link

x-ji commented Mar 10, 2015

Also not working for me. Although /admin panel itself loads fine, still getting I18n::InvalidLocale - :en is not a valid locale error if I click on a specific model in the panel, even after adding that line

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

No branches or pull requests

6 participants