Forum: Rails I18n Fallback and ActiveRecord backends together

Posted by pietro ferrari (Guest)
on 2010-02-02 01:29
(Received via mailing list)
Hi all,

I'm trying to use the Fallback and ActiveRecord backends together. I
created a initializer that has:

I18n.backend = I18n::Backend::ActiveRecord.new
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Fallbacks)

but whenever a validation message needs to be translated i get this 
error:

translation data {:"translation missing: de, i18n, plural, keys"=>nil}
can not be used with :count => 1

has anyone been successful in combining both backends?

pietro.
Posted by Arndt Lehmann (Guest)
on 2010-02-27 15:49
(Received via mailing list)
Helo Pietro,

I suffered from the same problem and found the solution: extending the
backend instance instead of including into the class.
Here the deciding part of my initializer:

  I18n.backend = I18n::Backend::ActiveRecord.new
  I18n.backend.extend(I18n::Backend::Fallbacks)

(And I have no idea why that works and not the other.)

Best Regards,
  Arndt
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.