rails_param icon indicating copy to clipboard operation
rails_param copied to clipboard

Adds i18n support to error messages

Open gabrielresende opened this issue 8 years ago • 1 comments

This PR adds support to i18n of error messages.

In some cases, the exception message may be good enough to be dispatched to the final user (after handling the exception properly, of course). It is better to add i18n support to the gem than parsing each message and translating them to the user’s language.

The changes introduced by this PR should not affect the current behavior of the gem. It presents the translation if the respective files are included in the load path (e.g., config/locales), otherwise it falls back to the default message in English.

The file locales/en.yml was added only for testing purposes and to be used as a model for other languages, and it is not used outside the gem.

This behaviour was inspired by the gem jsonapi-resources.

gabrielresende avatar Jul 10 '17 14:07 gabrielresende

@gabrielres I like the idea but we're planning a refactoring of validations based on ActiveModel so I'll come back to this after we're done with that.

iMacTia avatar May 29 '18 07:05 iMacTia