Skip to content
This repository

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

Closed
jbescoyez opened this Issue · 7 comments

5 participants

Jean-Baptiste Escoyez Julien Palmas Benoit Bénézech Yu-Cheng Chuang Zolzaya Erdenebaatar
Jean-Baptiste Escoyez

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.

Julien Palmas

same here

Benoit Bénézech
Collaborator

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

Jean-Baptiste Escoyez

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'
Benoit Bénézech
Collaborator

Thx! I'll have a look.

Yu-Cheng Chuang

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 ?

Benoit Bénézech
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 Erdenebaatar

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.