My locale is set, I can see € instead of $, but time still displays English months
I am doing a Rails app in French. I downloaded a fr.yml stored in config/locales and added config.i18n.default_locale = :fr
to my application.rb. The .yml contains days and month开发者_如何学运维s.
Messages in pages generated by scaffold are in French, € is displayed instead of $, but it keep using English names for months with strftime (a Time function).
Why?
<%= I18n.localize(Time.zone.now, :format => :short) %>
You can add more formats to your fr.yml
date:
formats:
default: "%d.%m.%Y"
numeric: "%d.%m.%Y"
short: "%e %b"
long: "%e %B %Y, %A"
only_day: "%e"
The strftime
function isn't hooked into Rails - it's just a member of the Ruby Time
class. Try using Rails localization instead - that should do what you're expecting.
Hope that helps!
精彩评论