
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
You may use this gem with rails-i18n
(although, it's not required).
To install, add to your Gemfile
:
gem 'ruby-i18n-months'
This gem add directives %O
and %o
for month names that are useful in such formats:
Format | English | Russian |
---|---|---|
%O %Y | March 2022 | Март 2022 |
%d/%o/%Y | 23/Mar/2022 | 23/март/2022 |
Compare with these results (using existing directives %B
and %b
in Ruby and gem rails-i18n
):
Format | English | Russian |
---|---|---|
%B %Y | March 2022 | марта 2022 (this result is incorrect for native speakers) |
%d/%b/%Y | 23/Mar/2022 | 23/марта/2022 (sounds odd but is acceptable) |
The languages listed below use different words
for dates in long format(day, month, year
: %d %B %Y
)
and for month and year only (month, year
: %O %Y
):
This gem adds directives %O
and %o
in I18n::Backend::Base
(used internally in gem ruby-i18n
), and adds month names for all languages listed
above for these directives.
For Slavic languages these month names are in nominative case,
and gem rails-i18n
provides month names in genitive case
(for directives %B
and %b
).
Other languages & locales will fallback these directives to %B
and %b
respectively.
In this case you should have gem rails-i18n
installed.
You may use localize
method (shorted to l
), as usual:
I18n.l(Time.new(2022, 3, 1), locale: :ru, format: '%O %Y')
# => "Март 2022" (provided by this gem, `ruby-i18n-months`)
I18n.l(Time.new(2022, 3, 1), locale: :ru, format: '%-e %B %Y')
# => "1 марта 2022" (provided by gem `rails-i18n`)
I18n.l(Time.new(2022, 3, 1), locale: :en, format: '%O %Y')
# => "March 2022" (provided by this gem, `ruby-i18n-months`,
# with fallback to `%B`, so you need `rails-i18n` also)
I18n.l(Time.new(2022, 3, 1), locale: :en, format: '%-e %B %Y')
# => "1 March 2022" (provided by gem `rails-i18n`)
Using strftime
is not supported:
Time.new(2022, 3, 1).strftime('%O %Y')
# => "%O 2022"
To release a new version: bundle exec rake release
Bug reports and pull requests are welcome on GitHub at github.com/crosspath/ruby-i18n-months.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that ruby-i18n-months demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.