0

I have some migrations that import CSV into existing models (using create!(..)). Since I added some more validations, the migration breaks when executed:

Validation failed: Address translation missing: en.activerecord.errors.messages.is_invalid

We are using german as default language, so I'm a bit unsure why Rails looks for an english translation. We are using the rails-i18n gem.

# application.rb
config.i18n.default_locale = :de
config.i18n.available_locales = [:de, :en]

Anybody can tell me:

1) Why does Rails look for an english translation? 2) Why doesn't Rails find the english translation anyway?

Thanks.

1 Answer 1

1

To answer number 1, you need to set the locale first, setting the default locale does not do this :

config.i18n.locale = :de

Number 2 seems a bit stranger, but note that rails-i18n has only just recently included the base 'en' locale, previous it had 'en-US' and 'en-GB' and so on. It looks like you need to bump your rails-i18n version to 0.6.5 or higher.

1
  • Thank you, I did that in my application.rb, and now I'm getting proper german translations. Still, I already have v0.6.5, so why are the proper english translations missing? Is it because I have an empty en.yml file? Jul 11, 2012 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.