intridea/grape — pull request #444 by aew (2013-07-20 23:26:36+00:00)
Title: Set :en as fallback locale for grape errors when translations are missin...

...g for the default locale

There is currently no mention of I18n in the Grape readme.

I found myself in the following situation:
- Embedded Grape API inside of Rails
- Rails app has a default locale of :pt-BR
- Did not add anything to locale file for Grape as I didn't think of it
- Did not have `config.i18n.fallbacks = [:en]` set in application.rb

As a result, for all validation errors, the error messages were simply blank.

We could just tell people to set a fallback locale or include translations, but I don't think the blank messages are user friendly - at least I found this very difficult to debug for such a simple issue. This pull request reflects my opinion that Grape should fallback to the English messages (provided in the en.yml that ships with Grape) in situations where the messages would otherwise be blank.

Of course if people explicitly want blank error messages...this pull request will be problematic for them. This situation seems unlikely to me. At the very least, documentation will help.