Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Translate form field label and placeholder

Started by Javi 8 years ago · 1 replies · 779 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 lynbor, 3 weeks ago
3 353 3 days ago
General · by lynbor, 1 week ago
7 388 3 days ago
General · by Harry, 3 days ago
0 84 3 days ago
General · by Old Man Umby, 3 weeks ago
2 258 2 weeks ago
General · by jeremycherfas, 3 weeks ago
5 374 2 weeks ago