Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

Translate form field label and placeholder

Started by Javi 8 years ago · 1 replies · 699 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 jean-louis67, 3 weeks ago
2 308 3 weeks ago
General · by Andy Miller, 3 weeks ago
0 310 3 weeks ago
General · by Veehem, 4 weeks ago
0 263 4 weeks ago
General · by milkboy, 4 weeks ago
0 264 4 weeks ago
General · by ian russell, 1 month ago
2 335 1 month ago