Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Translate form field label and placeholder

Started by Javi 8 years ago · 1 replies · 921 views
8 years ago

Hi

It's possible translate form fields labels and placeholders? I'm reading the doc but I don't find the solution.

Thanks

8 years ago

I found the solution, I create a languages.yaml in my theme and declare the languages:

es:
THEME_GDA:
FORMNAME: Nombre
en:
THEME_GDA:
FORMNAME: Name

And in the form.md I call the translations:


title: 'Contact form'
form:
name: contact-form
fields:

YAML
        name: name
        label: THEME_GDA.FORMNAME
        placeholder: 'Enter your name'
        autofocus: 'on'
        autocomplete: 'on'
        type: text
        validate:
            required: true

Thanks

👍 1

Suggested topics

Topic Participants Replies Views Activity
General · by Sergi, 2 days ago
1 74 2 days ago
General · by themetman, 5 days ago
2 95 4 days ago
General · by Hanns Mattes, 2 weeks ago
0 148 2 weeks ago
General · by Karmalakas, 2 weeks ago
2 221 2 weeks ago
General · by Hanns Mattes, 4 weeks ago
0 282 4 weeks ago