Plugin / Contact Form 7 Polylang Module

Aurovrata V.

Frequently Asked Questions (FAQ)

If you found that you installed the plugin correctly and are able to manage your forms using the polylang language columns, then it is likely that the language your have selected does not have a translation for the Contact Form 7. You can visit the following translation project page to see the status of the translation CF7 for your language.
If you have checked the above linked page and are able to find your language, then you can download your language translation pack manually. It is possible that there is mismatch between the local code used by Polylang and that assigned to your language pack. Open the translation page for your specific language (click on the language row in this table). This will open the locale specific page that you have selected, then click on the ‘Stable’ link in the table. You should now see a page with a table that show the different translations, scroll to the bottom of the page and selected the Export format from the 2nd dropdown to ‘Machine Object .mo’, then click the Export link. This will download a zip flie. Extract the content of this file in the wp-content/languages/plugins/contact-form-7/ folder (create it if it does not exists, this folder is never updated by plugin updates). Rename file name so that the locale of the file matches the locale of your language as defined by Polylang. When you create a new form in your language you will find the polylang locale code in the url attributes of your browser address bar. So if your locale is tk_TK, and you have dowloaded and extracted a file called contact-form-7-tk.mo, rename it to contact-form-7-tk_TK.mo. This will ensure the correct file is picked.
This is because the translation in your language have not be completed. You can help the community by completing the translation online. You will need to sign up for an account if you haven’t got one already and login. You can also complete the translation on your computer by following the above procedure to download the current status of your language translation. Instead of the ‘Machine Object .mo’ format, select the ‘Portable Object .po’ format. Extract the file from the zip archive your download and edit the file using the PoEdit(or). You can then save your translation in the ‘Machine Object format’ and follow the remaining instructions above to make sure your new translation file is picked up by the plugin.
In order to ensure the correct translation is shown in your template page, you need to make sure you get the translated id $trans_form_id in your do_shortcode function call, do_shortcode([contact_form_7 id="{$trans_form_id}"]); You have Polylang setup using a default language and a set of additional languages. When Polylang translates a custom post (such as the wpcf7 post), it keeps track of all translations using the post ID, by pairing the primary language post ID with its corresponding translated post IDs which is what the CF7 Polylang Extension does for you. So you need to search your translation using the primary language post ID, to do this you need to make use of the Polylang functions, $form_id = 252; //assuming this is your default language form ID $default_lang = pll_default_language('slug'); $current_lang = pll_current_language('slug); //the current language your page is being viewed as if($current_lang != $default_lang){ $form_id = pll_get_post($form_id, $current_lang); if(empty($form_id)){ //if a translation does not exists $form_id = 252; //show the default form } } //display your form echo do_shortcode('[contact-form-7 id=”'.$form_id.'″]');
Polylang only filters links and provides the current language function pll_current_language() for the front-end requests. Submissions are handled using admin hooks by the CF7 plugin and these do not have access to the pll functions. To overcome this limitation, v2.3 of this plugin introduced the _wpcf7_lang hidden variable which is automatically submitted. So you can find out the current language of the submission using the $_POST['_wpcf7_lang'] value.
The cf7 plugin provides a special mail tag [_site_url] which prints the site url. However, this is not one of the filtered polylang links. Therefore as of v2.3 this plugin now has the [_home_url] mail tag that you an use in your mail body and which will show the home url of site from which it was submitted from. Alternatively, you could also construct your own special mail tag, such as [_lang] using the follwoing code in your functions.php file, add_filter( 'wpcf7_special_mail_tags','my_cf7_mail_tag', 10,3); function my_cf7_mail_tag($output, $name, $html ) { if ( '_lang' == $name ) { $filter = $html ? 'display' : 'raw'; $output = $_POST['_wpcf7_lang']; } return $output; }

Ratings

4.1
10 reviews

Rating breakdown

Details Information

Version

2.3.2

First Released

06 May, 2016

Total Downloads

56,380

Wordpress Version

4.7 or higher

Tested up to:

5.3

Require PHP Version:

5.6 or higher

Tags

Contributors

Languages

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.