Polylang

Download and Set Up

  1. Install the Polylang plugin.
  2. Download latest version of the Polylang add-on

    View the change log to see a complete list of changes made in each version.

  3. In your WordPress admin, go to "Plugins" → "Add New" and click the "Upload" link at the top of the page.
  4. Click the "Browse" button and select the zip file you just downloaded. Once the plugin is installed, click "Activate Plugin" or go to the "Plugins" page, find "Formidable Polylang" and click "Activate".
  5. Now that the plugin is activated, go into the form that you would like to translate. Click on the "Translate Form" button in your sidebar.
  6. Enter your translations and click the "Save Changes" button.
  7. Publish your form on a page and use Polylang to translate into any other languages you would like.

Sending Translated Emails

In order to send the email for the correct language, you'll set up multiple emails. Each of these emails will be sent conditionally, based on the language submitted.

  1. First, you'll need a shortcode to get the current language. Add this to your theme functions.php or inside the Code Snippets plugin.
    add_shortcode('get_current_language', 'polylang_get_lang');
    function polylang_get_lang() {
      return pll_current_language('slug');
    }
  2. Now add a hidden field to your form. Use [get_current_language] for the default value.
  3. Add one email action for each language on your Form Actions page. Set them up however you'd like.
  4. In order to prevent every email from sending, add conditional logic to each one. The logic will look like this:
    Polylang-translated-email

Translate a value for display

You may want to translate a value before display. If you have already translated field labels and options, there is no need to translate them again. In a view, you can use [translate_value value="[25]"] or [translate_value value="[25 show=field_label]"]. Be sure to add the following code to your site.

add_shortcode( 'translate_value', 'trans_val_func' );
function trans_val_func( $atts, $content = '' ) {
  $atts = shortcode_atts( array( 'value' => '' ), $atts );
  $value = pll__( $atts['value'] );
  return $value;
}