Hello,
Currently, the .inspect method of ActiveSupport::Duration handles the i18n-ization like this:
def inspect #:nodoc:
parts.
reduce(::Hash.new(0)) { |h,(l,r)| h[l] += r; h }.
sort_by {|unit, _ | [:years, :months, :days, :minutes, :seconds].index(unit)}.
map {|unit, val| "#{val} #{val == 1 ? unit.to_s.chop : unit.to_s}"}.
to_sentence(locale: ::I18n.default_locale)
end
``
Which can be frustrating if the user’s current locale is different from the default one.
In my case, a french user would read english versions of inspected durations instead of french ones (ie: “12 hours” instead of “12 heures”)
What I propose is to change this line of code:
to_sentence(locale: ::I18n.default_locale)
``
To this:
to_sentence(locale: ::I18n.locale)
``
Regards, Samy