Fallback and ActiveRecord backends together

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.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs