Formidable Forms

Formidable Forms

  • Features
  • Pricing
  • Resources
    • Docs & Support
    • Blog
    • Community
  • Solutions
    • Web Applications
    • Calculators
    • Surveys
    • Directories
    • Payments
    • Contact forms
  • Login
  • Get Formidable Forms

Polylang

Last Updated: January 20, 2022

Knowledge Base → Add-Ons → Multilingual → Polylang

Translate your forms into multiple languages using Polylang and the Formidable Polylang add-on.

Formidable Forms is the best WordPress Form Builder plugin. Get it for free!
Subscribe on YouTube

Download and Install

  1. Install the Polylang plugin.
  2. If you haven't already done so, install and activate Formidable Forms Pro.
  3. In your WordPress admin, go to Formidable → Add-Ons and click the Install button for the Formidable Polylang add-on.

Translate a Form

After the Polylang plugin and the Formidable Polylang add-on are activated, you may follow the steps below to translate your forms.

  1. Go into the form that you would like to translate.
  2. For best results, add separate saved values that are different than your option labels for any checkbox, radio or dropdown fields.
  3. Click on the Translate Form button under your form Settings → General page.
    Polylang Translate Form Button
  4. Enter your translations and click the Save Changes button.
    Polylang Enter Translation
  5. Publish your form on a page and use Polylang to translate into any other languages you would like.
    Polylang Translate Form Publish Page

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;
}

Import and export translations

Formidable doesn't manage the translations when importing/exporting forms. You can import and export string translations directly in Polylang.

Additional customizations

Translate error message

Use this code example to translate the "The username field is empty" error message when Polylang is active and not set to English. It uses a custom function get_custom_login_message that returns a French translation.

add_filter('frmreg_login_error', 'translate_pll_login_error');
   function translate_pll_login_error( $message ) {
      if ( ! function_exists( 'pll_current_language' ) ) {
         return $message;
         }

         if ( 'The username field is empty.' === $message ) {
            $current_language = pll_current_language();
            if ( 'en' !== $current_language ) {
               $custom_message = get_custom_login_message( $current_language );
               if ( false !== $custom_message ) {
                  $message = $custom_message;
               }
            }
         }

         return $message;
   }

   function get_custom_login_message( $language ) {
      switch ( $language ) {
         case 'fr': return "Le champ du nom d'utilisateur est vide.";
      }
 
      return false;
   }

Troubleshooting

Many issues with translations can be resolved by making sure to set different saved values for option fields like checkboxes, radio buttons, and dropdowns. Learn more about adding separate saved values.

Related Articles

  • WPML vs Polylang translation plugins compared WordPress WPML vs Polylang: Translation Plugins Compared
    Read More
    how to create multilingual forms in WordPress How to Create Multilingual Forms in WordPress
    Read More
    Best Translation Plugins for WordPress 5 Best WordPress Translation Plugins [Compared]
    Read More
  • Download and Install
  • Translate a Form
  • Sending Translated Emails
  • Translate a value for display
  • Import and export translations
  • Additional customizations
    • Translate error message
  • Troubleshooting
  • Related Articles
Categories
×

Categories

  • Installation & Getting Started
  • Account Management
  • Forms
  • Entries
  • Views
  • Styles
  • Importing & Exporting
  • Add-Ons
  • Extend Formidable Forms

Using WordPress and want to get Formidable Forms for free?

Get Formidable Forms Lite Now

You do not have permission to view this form. Maybe you need to log in?

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

Take on bigger projects Right Now

Get the tools you need to revolutionize your workflow and architect a masterpiece. Build the most advanced WordPress forms and actually use the data you collect in meaningful ways.

Get the most advanced WordPress form plugin and the only form builder with integrated Views.

Get Formidable Forms Now

Resources

  • Community
  • Affiliates
  • Contact
  • Free Online Form Builder

Top Features

  • Application Builder
  • Calculator Forms
  • Surveys & Polls
  • Quiz Maker
  • Form Templates
  • Application Templates
  • Directories
  • Donation Plugin

Company

  • About Us
  • Giving Back
  • Careers
  • Newsletter
  • WP Tasty
  • Nutrifox

Copyright © 2023 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.
Privacy Policy | Terms of Service | Sitemap

Join 300,000+ using Formidable Forms to create form-focused solutions fast. Get Started See User Reviews