Set :en as fallback locale for grape errors when translations are missin... #444
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
...g for the default locale
There is currently no mention of I18n in the Grape readme.
I found myself in the following situation:
config.i18n.fallbacks = [:en]
set in application.rbAs 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.