validates_timeliness icon indicating copy to clipboard operation
validates_timeliness copied to clipboard

Localize dates in error messages

Open florent opened this issue 7 years ago • 2 comments

Hi, Simple change to take advantage of I18n when displaying dates in error messages. I need months in French :)

florent avatar Feb 03 '17 17:02 florent

Thanks for this.

One issue is that most of the translations do not belong in this gem. Month names etc. are handled by Rails. Please look a the English i18n yml file, those are the only keys controlled by this gem.

If you can reduce the yml file to just those keys this will make a great addition.

adzap avatar Feb 04 '17 06:02 adzap

The keys in the existing English i18n yml file don't provide any translation for days/months names. Therefore it's impossible to localize dates using any other thing than numbers.

I understand that you want to be framework/lib agnostic but I still believe that the gem must provide a way to localize dates properly.

Most users will use it with Rails, so why not provide support for rails i18n translations and fallback to #strftime if the i18n keys are missing? Rails I18n keys for this are kind of a de-facto standard after all.

If you still don't want to do this, you could always add your own I18n keys for days/month names. You'd remain independent from other libs and allow dates localizations.

What do you think?

florent avatar Feb 06 '17 13:02 florent