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
{{ message }}
This repository was archived by the owner on Sep 7, 2024. It is now read-only.
My own Form class, based on an earlier version of the one in phlex-rails now, has a label method that accepts label content but falls back to, tho really prefers, to use the i18n value for the field name within the scope of the view it's defined in.
# app/views/things/show.rb
class Views::Things::Show < Phlex::HTML
def template
render Form.new do |f|
f.label :a_field # I display the i18n content at views.things.show.a_field
f.input :a_field
f.label :another_field, "Field content" # I display the text provided
f.input :another_field
end
end
end
I do this by defining def t(...) = @_parent.translate(...) in my Form. I think this could be a useful feature to standardize in this library somehow. Maybe a class that inherits Phlex::Translation could call inherit_i18n_scope or something like that. Iunno.