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

undefined method `prepare_key' #72

Open
LaurensN opened this issue Oct 15, 2015 · 3 comments
Open

undefined method `prepare_key' #72

LaurensN opened this issue Oct 15, 2015 · 3 comments

Comments

@LaurensN
Copy link

After bundle install, migrations, when starting server or console I get the following error:

/translation_helpers.rb:60:in translate_with_adding': undefined methodprepare_key' for #I18n::Backend::Simple:0x007f8ba7554d50 (NoMethodError)

Rails 4.2.4

This happens with the following translation_center.yml settings:

development:
enabled: true # default false

Keys inspector allowed values:

"missing" to inspect only untranslated keys

"all" to enable inspector for translated and untranslated keys

"off" to turn off keys inspector

inspector: 'all' # default missing

I18n.translate source

i18n_source: 'yaml' # can be db or yaml; default is db

when a new key is added to db, the value of the key is added as the default translation in English

save_default_translation: false

<<: *common_atts

@LaurensN
Copy link
Author

This can be fixed by including it in I18n::Backend::Simple:

master...LaurensN:master

@scarroll32
Copy link

I'm having the same problem on branch hzbadr#2

rake translation_center:synch
rake aborted!
NoMethodError: undefined method `prepare_key' for #<I18n::Backend::Simple:0x007fbfc2ae0978>
/Users/sean/src/seanfcarroll/immersive/app/admin/dashboard.rb:1:in `<top (required)>'
/Users/sean/src/seanfcarroll/immersive/config/routes.rb:12:in `block (2 levels) in <top (required)>'
/Users/sean/src/seanfcarroll/immersive/config/routes.rb:9:in `block in <top (required)>'
/Users/sean/src/seanfcarroll/immersive/config/routes.rb:3:in `<top (required)>'
/Users/sean/src/seanfcarroll/immersive/config/environment.rb:6:in `<top (required)>'

@scarroll32
Copy link

Solved by adding this to an initializer

I18n::Backend::Simple.send(:include, TranslationCenter)

Don't really understand why this is necessary

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

2 participants