Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no way to uppercase abbreviated month name using localize method #463

Closed
mariusz-blaszczak opened this issue Jan 16, 2019 · 1 comment

Comments

@mariusz-blaszczak
Copy link

mariusz-blaszczak commented Jan 16, 2019

What I tried to do

I wanted to have formatted and localized date with month name uppercased and abbreviated.

# without uppercase works good
I18n.localize(Time.zone.local(2018, 5, 11), format: "%e %b %Y", locale: :de)
=> "11 Mai 2018"

# but with uppercase..
# formatting from https://apidock.com/ruby/DateTime/strftime
I18n.localize(Time.zone.local(2018, 5, 11), format: "%e %^b %Y", locale: :de)
=> "11 MAY 2018"

What actually happened

The %^bdirective is no supported in I18n and it returns always english version of the string.

What I expected to happen

When %^bdirective is used, the I18n maps use upcase method in abbreviated month name.

Versions of i18n, rails, and anything else you think is necessary

rails (5.2.2)
i18n (1.5.2)

The code where upcasing might take place:

https://github.com/ruby-i18n/i18n/blob/master/lib/i18n/backend/base.rb#L250-L261

@radar
Copy link
Collaborator

radar commented Jan 16, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants