Each user of our application can have different format for Date and Time. I understand the date format is dependent on user’s language and possibly time zone.
I guess I can try to run something like Date::DATE_FORMATS[:default] = "%m/%d/%Y" in ApplicationController. In this case Date.today.to_s would return the property formatted date. Will it be thread safe?
Another option I am looking at is to store profiles into config/locales/en.yml with different keys like en_US, en_GB, en_... and store locale name into the user’s profile. In this case I will need to use I18n.localize to format the date. Is it possible to fall back to en if there is no key found in specific en_US?
In the case of
Date::DATE_FORMATSorTIME::DATE_FORMATS, you will need to take extra care to make their usage threadsafe, unfortunately. Shouldn’t be too difficult to do, however.AS for your second question, I believe you are concerned with locale fallbacks, and the i18n gem has support for locale fallbacks. This feature is easily enabled with: