I wrote a validates_word_count plugin. I would like to store the error
messages in a YAML file so they can be easily translated.
Full source:
https://github.com/paulschreiber/validates_word_count/
My plugin's file layout looks like this:
validates_word_count/
init.rb
lib/
validates_word_count.rb
locale/
en.yml
My YAML file looks like this:
en:
validates_word_count:
errors:
messages:
too_few_words: "has too few words (minimum is %d words)"
too_many_words: "has too many words (maximum is %d words)"
However, if I call
I18n.translate('validates_word_count.errors.messages.too_few_words'),
I get this error:
translation missing: en, validates_word_count, errors, messages,
too_few_words
How can I set up my plugin / locale so I18n.translate() works?
Paul
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment