I'm pretty new with rails also with ruby.
I just want to get the I18n.l
of a day name or a month name, without a whole date or time. Because I don't have it.
For example, I simply want to internationalize for example
= l Date::DAYNAMES[0]
or
= l Date::MONTHNAME[0]
Is it possible?
I'm from brazil. In my rails applications I have a pt-BR.yml inside config/locales. It's like this:
"pt-BR":
date:
day_names:
- Domingo
- Segunda
- Terça
- Quarta
- Quinta
- Sexta
- Sábado
It's the same for month names, etc... In my application.rb I have
config.i18n.default_locale = 'pt-BR'
That gives me translated names. Read the I18N guide for more.
You can access the day names with:
I18n.t(:"date.day_names")
#=> ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
and the month names with:
I18n.t(:"date.month_names")
#=> [nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
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