Caldera Forms Translation is a free add-on for Caldera Forms that allows you to offer the same form in multiple languages. Using a simple interface, you can add as many languages to a form as you want and translate each field.
For each field you can translate:
- The field label
- The field description (caption)
- The field default value
- The field’s options if it is a select field (coming soon)
This document will cover adding translations for a form, and switching form languages. Before you being make sure you have Caldera Forms 1.4.4 or later as well as the Caldera Forms Translation add-on which you can download from our site or install through WordPress.
Translating A Form
To begin, go to the Caldera Forms menu, and select the Translate submenu item. If you do not see that item, then you likely do not have the Translation add-on installed or your version of Caldera Forms is too old — Caldera Forms 1.4.4. or later is required.
On the translations page, the first thing you need to is choose a form. All of your forms should be available from the Choose Form selector. Select a form to translate, this will reveal the options for that form.
When you first translate a form, you will only see options for your site’s default language. That’s not useful, let’s add an additional language.
Once you chose a form, a tabbed interface should have appeared. The bottom tab is called Add Language. Enter that tab and you will see a selector called Add Language. You can use this to choose a language to add. Please keep the following in mind:
- Only use local dialects, IE Peruvians Spanish vs Spanish, if you intent to translate for multiple dialects of that language.
- Make sure the language code you chose matches those used by other translations add-ons that you might be using as well.
Once you’ve selected a language, click the Add Language To Form Translations button. to add the language to the translation set. When you have all of your languages added, you can use the Select Language selector to choose a language to translate.
Click the Load Language to load that language into the Translate Fields interface.
Once a language is loaded, you will see a selector under the Translate Fields heading called Select Field that you can use to load an individual field. Once a field is loaded, you can translate each of its fields.
By design, you can not change forms or languages without saving. When you are done translating, a language, click the Save button to save the translations and move on to other languages or forms.
There are many ways to change the language of a form when it is loaded in the front-end. You can use them together if needed.
The Caldera Forms Translate plugin adds a new field type that acts as a language switcher. This field will be populated with all of the languages you added to the form form the translations screen. When the translation picker field is changed, the form will refresh in the chosen language.
By default, whether the language picker field is selected or not, the form will load using the language WordPress is currently set as its default. You can override this using the cf_translate_get_current_language filter.
The other way to change the default language is to add the
cf_lang query var to the URL for your form. So, for example, if you wanted to provide a link tot the Tamil version of your form, and it was on the page
/contact-us you would use the link
Switching Languages Via WPML
In version 1.1.0 or later, the current language set by WPML will be used, if possible.
The value of the constant
ICL_LANGUAGE_CODE, which is set by WPML, takes precedence over WordPress’ local or the cf_lang query variable.