Using Gravity Forms with WPML
In this short tutorial we’ll show you how you can translate forms created by Gravity Forms using WPML.
Why translate forms
You can use any contact form plugin and simply create different forms, per language. So, what’s the benefit in translating the same form to different languages?
The reason is convenience.
Setting up a form may be a complex process. Often, you may want to include logic for notifications, validation and other “behind the scenes” settings. Additionally, it’s often easier to insert a single “contact us” form into your content, without having to worry about what form in which language you are inserting.
WPML lets you create one set of forms with Gravity Forms, in your language. Then, you only need to translate the texts that appear in the forms and WPML will display the form in the right language. It’s the same form and any changes you do on it will apply instantly to all languages.
Ready? Let’s get started!
Translating GravityForms forms
1. Creating a form
In order to translate a form, you need to have a Gravity Form set up in your site. For help, please look at the documentation on creating gravity forms. Here you can see the simple contact form I have created in the WordPress dashboard – English is the default language used (if you have a non-English default language please read the “When a non-English language is set to default” section below).
2. Sending to the Translation Basket
When we translate Gravity Forms, we actually translate only the texts. WPML will filter the displayed texts in your form and use the translation if they are available.
This goes through WPML’s Translation Management module and the “Gravity Forms Multilingual” addon. If this is your first encounter with it, we definitely recommend reading about WPML’s Translation Management.
a. Go to WPML > Translation Management .
b. Choose “Gravity form” from the Type filter, click on the blue “Display” button – your form/s are shown now on the list of documents to be translated.
c. Choose ‘Translate’ and click the “Add to translation basket” button.
d. Go to the “Translation Basket”, choose a translator and click on the “Send all item for translation” blue button.
3. Translating your form strings
We are assuming you’ve already created translator users. If not, learn about setting up translators.
Your translators should log into WPML. They will see a “Translators” menu. Go there to find the translation jobs that you’ve created for them.
a. Go to WPML > Translations – find your form, (we use here a form called WPML EN).
b. Click on “Take this and edit” button next to the form’s name to translate all strings (you can also use String Translation if you’d like).
c. Mark “This translation is finished.” when you are satisfied with the translation.
d. Click the blue “Save translation” button.
4. See the translated forms
WPML does not create new forms with the translated fields. Instead, it makes the existing forms appear translated. When you insert the form that you just translated into a page in the “translation language”, you will see the form in that language.
Here is how our example “contact” form appears when inserted into a Spanish page:
What’s included in the translation
GravityForms Multilingual will translate all the fields created in the Form for you – Standard Fields, Advanced Fields, Post Fields, Pricing Fields and Quiz Fields (Quiz Fields have got supported since Gravity Forms Multilingual 1.3.7).
You can also, of course, translate the Form’s Notifications and Confirmations messages – this is done by using the String Translation addon – WPML > String Translation, you can search for the desired string through the search box, using the “Select strings within context” select box choosing “gravity_form-{form_id}” context.
Changing the choices for form fields
Certain types of fields in Gravity Forms include multiple choices that users select. This includes the Drop Down, Multi Select, Radio Buttons, and Checkboxes fields.
Please note that adding new choices, or changing the choices’ position for already translated fields, can make those fields lose their translations. In this case, you need to translate the edited field again.
Content submitted into translated forms
Please note that the GravityForms plugin doesn’t have a sense of language. When you submit content into a translated form, that content will still be created in the default language. You can use GravityForms hooks and filters to write your own logic. There, you can set the language of the submitted content after GravityForms creates it.
Required Plugins
WPML Multilingual CMS 3.2.6 (or higher including String Translation and Translation Management addons)
GravityForms 1.9 (or higher)
GravityForms Multilingual 1.3.3 (or higher)a