Translating mongoid to german

2019-06-06 09:04发布

问题:

I got a problem to translate the default validation messages in mongoid.
I create a /config/initializers/mongoid.rb with

  • Mongoid.add_language("de")

http://mongoid.org/docs/installation/languages.html

But every call on a validated field i got translation errors:

  • translation missing: de.mongoid.errors.models.comment.attributes.body.too_short
  • translation missing: de.mongoid.errors.models.user.attributes.username.blank

I have

  • Ruy on Rails 3.2
  • Ruby 1.9.3
  • mongoid 2.4.7

回答1:

If you check on Mongoid source, the de.yml locale file you can see this two key are not translate :

https://github.com/mongoid/mongoid/blob/2.4.0-stable/lib/config/locales/de.yml

You can do some pull_request on Mongoid 2.4.0-stable branch to add it.