Kindly EditDocumentationTry the editor

Multilingual forms

Translate forms with Polylang, WPML, TranslatePress or Weglot, and see which emails go out in the visitor's language.

Kindly Forms works with the site's translation plugin. A form is built once, in the site's own language, and shown to each visitor in the language of the page they are on. Answers stay the same in every language, so entries, conditions, reports and connections don't need a copy per language.

Supported plugins#

Kindly picks the translation plugin it finds, in this order:

Plugin How a form is translated
Polylang The form's words are registered as Polylang strings. Translate them in Languages > Translations.
WPML The form's words are registered in WPML String Translation. Translate them in WPML > String Translation.
TranslatePress TranslatePress translates the page itself, form included.
Weglot Weglot translates the page itself, form included.

Polylang is checked before WPML because Polylang also answers WPML's hooks.

Polylang and WPML#

When a form is published, its words are registered with the plugin, in a group named "Kindly Forms: form title (form ID)". Translate them there, then the form shows the translation on pages in that language.

What is registered:

  • the form's title
  • every field's label, placeholder, help text, its own error messages, prefix and suffix, the "Other" label, stock messages, and button words
  • sub-field labels (name and address parts), choice labels, grid rows and columns, repeating-row columns, and payment plan labels
  • the send button and its busy words, the step buttons and the first step title
  • the form's own validation messages
  • confirmation messages and their redirect words
  • limit, schedule, sign-in, network, country and word messages
  • the save-and-finish-later message and email, the email confirmation messages and email, and the review message
  • the answers page content, the form page's heading and text
  • conversational texts, quiz grades and personalities
  • every email's subject and body

How it behaves:

  • String names stay the same across edits. They are made from the field's ID and the setting, such as field.f8Hk2.label, field.f8Hk2.choice.Red or email.n4Gq.subject. After changing a label, check its translation in the plugin.
  • Removed fields are cleaned up. On publish, WPML strings of fields that no longer exist are unregistered, and a changed title moves the strings to the new group name.
  • Choices keep their value. A translated choice shows the translated label but sends the original value, so conditions, calculations, reports and connections see the same answer in every language.
  • Forms published before the plugin was installed are registered the first time they are shown in another language.
  • Drafts aren't registered. Only the published form's words are.

TranslatePress and Weglot#

These plugins translate the page as visitors see it, so the form's labels and choices are translated with the rest of the page in their own editors.

Some words only appear after the page loads: validation messages, step labels, buttons and success messages. With TranslatePress or Weglot, Kindly also writes these words into the form's HTML in a hidden list, so the plugin's editor finds and translates them, and the form reads the translated words from there. Success messages that contain smartcodes are left out of that list, because their final text depends on the answers.

Which emails are translated#

The language of the page is sent with the answers and kept on the entry.

Email or message Language
The confirmation shown after sending The visitor's
The message shown after sending when confirming by email The visitor's
The confirmation email, when the form writes its own The visitor's
The confirmation email from site settings As written in Settings
The page shown after clicking the confirmation link The site's own language
The review message shown after sending The visitor's
Emails to The sender, or to an address that uses an {inputs.…} answer The visitor's, including later ones such as When approved
Emails to a fixed address (the office) The site's own language
The save-and-finish-later email The site's own language
The weekly summary The site's own language

When an email goes in the visitor's language, Kindly also switches WordPress to that language's locale while sending, so words that come from Kindly's own translation files follow it.

This applies with Polylang, WPML, or a kindly_forms_translate filter. With TranslatePress or Weglot alone, emails are sent as written, because those plugins translate pages, not the emails the server sends.

For developers: the filter#

Every lookup passes through one filter, so any other translation source can supply the words:

add_filter( 'kindly_forms_translate', function ( $text, $context, $name, $form_id, $lang ) {
	// $text: the plugin's translation or the original
	// $context: "Kindly Forms: Club sign-up (12)"
	// $name: a stable string name such as field.f8Hk2.label
	return $text;
}, 10, 5 );

Adding this filter turns translation on even without Polylang or WPML. With it, the site's own language is passed through the filter too.

Other filters:

Filter Use
kindly_forms_i18n_engine Force or turn off the plugin Kindly uses (polylang, wpml, translatepress, weglot or empty).
kindly_forms_lang_current, kindly_forms_lang_default, kindly_forms_lang_list The page's language, the site's language and the list of languages.
kindly_forms_lang_locale The WordPress locale for a language code, used while sending emails.
kindly_forms_i18n_field_keys Which field settings are translatable.
kindly_forms_i18n_strings Add or remove strings of a form.
kindly_forms_notification_to_visitor Decide whether an email counts as going to the sender.
kindly_forms_texts_in_page, kindly_forms_page_texts Whether, and which, runtime words are written into the page for page translators.

The action kindly_forms_i18n_registered runs after a form's strings are registered. A language code sent with answers is accepted only if it is one of the site's languages, when the plugin reports a list.

About this page

Documents Kindly Edit 0.9.16. Source: includes/forms/translate.php. Theme choices and account permissions can change which controls appear.

Type a word or phrase to search the full documentation.