I want Rails to automatically translate placeholder text, as is done using form labels. How can i do this?
Form signs are automatically converted as follows:
= f.text_field :first_name
This helper uses the locale file:
en: active_model: models: user: attributes: first_name: Your name
What this HTML outputs
<label for="first_name">Your name</label>
How can I do this so that the placeholder is translated? Should I enter the full volume as follows:
= f.text_field :first_name, placeholder: t('.first_name', scope: 'active_model.models.user.attributes.first_name')
Is there an easier way?
source share