i'm try tutorial calendar from railscasts episode #213. i have add es.yml but not worked. i try localize month names with replace word on en.yml such as
en:
date:
month_names: [~, Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Septiembre, Octubre, Noviembre, Diciembre]
abbr_month_names: [~, Ene, Feb, Mar, Abr, May, Jun, Jul, Ago, Sep, Oct, Nov, Dic]
not working too
on html.erb
<h2 id="month"><%= @date.strftime("%B %Y") %></h2>
i want change this
anyone help me?
thank's
You should use the localize
method of I18n (shortened as l
):
<h2 id="month"><%= l(@date) %></h2>
Then you can set different formats on your own: http://guides.rubyonrails.org/i18n.html#adding-date-time-formats
# config/locales/es.yml
es:
date:
formats:
short: "%B %Y"
default: "%D %m, %Y"
And use it like this:
<h2 id="month"><%= l(@date, format: :short) %></h2>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With