I would like to use different case of month name in Polish. For example now it works like this:
>> I18n.l Time.n开发者_运维技巧ow, :format => "%e %B"
=> "14 styczeń"
but I would like to specify another format of month:
>> I18n.l Time.now, :format => "%e %Q"
=> "14 stycznia"
Translated month names are in my pl.yml file in pl.date.month_names
. And I don't want to change it. I can add pl.date.another_month_names
in the other case, but I don't know how to make I18n.l
method to use it.
So how can I achive that? Other solutions (helpers, custom methods etc.) are also welcome.
i had a similar problem with strange month names in german translation. I had to configure the month names in my locale.yml, now it works as expected:
de:
defaults: &defaults
month_names:
[~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
formats:
default: "%d. %B %Y"
short: "%d.%m.%Y"
date:
<<: *defaults
time:
<<: *defaults
Since nobody answered my question, I found one solution.
I just created another translation, for example alt_pl.yml
and I added my custom month names, then:
>> I18n.l Time.now, :format => "%e %Q", :locale => :alt_pl
=> "15 stycznia"
精彩评论