You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use custom classes (value objects) to represent application-level locales:
# frozen_string_literal: trueclassLocaleattr_reader:codedelegate:to_sym,to: :codedefself.[](code)new(code: code)enddefinitialize(code:)@code=code.to_symend
...
end
And pass it to I18n: I18n.t(..., locale: Locale[:en]).
While this approach is quite handy (there are, actually, additional Locale attributes; it can be integrated to ActiveRecord and ActiveModel and what not), it's a bit flaky (it depends on MRI implementation details) -- it works on 2.7.4 and does not on 3.0.0.
We use custom classes (value objects) to represent application-level locales:
And pass it to I18n:
I18n.t(..., locale: Locale[:en])
.While this approach is quite handy (there are, actually, additional
Locale
attributes; it can be integrated toActiveRecord
andActiveModel
and what not), it's a bit flaky (it depends on MRI implementation details) -- it works on 2.7.4 and does not on 3.0.0.Seems like the only problem is method
which can be enhanced to be able to handle wrappers that respond to
#to_sym
, i.e.The text was updated successfully, but these errors were encountered: