I have my default locale set in the environment.rb
as de
(German).
I also see all the error messages in German, so the locale is picked up by the server. But when I try to print date with strftime
like following:
some_date.strftime('%B, %y')
It prints in English (January, 11
), and not the expected German (Januar, 11
).
How can I print the date according to the default locale?
In es.yml put:
In index.html.erb put:
Use the
l
(alias forlocalize
) method instead of raw strftime, like this:See here for more information, hope that helps.
You can also define 'named' formats, a couple of them (
short
,long
) are already predefined.you can also make it shorter: