Contact Form 7 tool: Translate Forms and Check Them
Applies to: Baza Helper 1.1 and later, with Contact Form 7. Translating forms needs Polylang, WPML or another multilingual plugin.
The Contact Form 7 tool of Baza Helper translates your forms and adds what a site with forms keeps needing: scripts only where a form is, spam protection without a service, language mail tags, a list of mails that could not be sent and a check of every form.
The tool appears only when Contact Form 7 is active. Texts are translated with the languages of Polylang or WPML, and the empty cells can be filled by any translation service set up in the Translate tool.
Step 1: Write the form in your main language
Open Contact > Contact Forms, edit a form and write it as usual. You do not need any special marks. Baza Helper finds the texts by itself:
- text between the tags of the form and labels;
- placeholders and the text of the submit button;
- the choices of drop-down lists, radio buttons and checkboxes (for
Label|valueonly the label); - the consent text of
[acceptance]together with its link; - all messages of the form, and the subject and the lines of the mail sent to the visitor.
<label class="field-name">[text* your-name placeholder "Name"]</label>
<label class="field-email">[email* your-email placeholder "Email"]</label>
<label class="field-text">[textarea* your-text x3 placeholder "Message"]</label>
[acceptance acceptance-privacy]I agree to the <a href="/privacy-policy/">privacy policy</a> and consent to the processing of my personal data.[/acceptance]
[submit "Send"]Default values of text fields, class and id options and the mail sent to the site are left alone. The mail to the site stays in the language of the site.
Step 2: Open the tool
Go to Baza Helper > Contact Form 7. The card Translated forms shows a table: every text of your forms in a row, every language of the site in a column. Make sure Translate the forms and Find the texts without braces are on.
Step 3: Fill in the translations
- Press Translate the empty cells to get proposals from the Translate tool, or type the translations yourself.
- If you used Polylang strings before, press Import from Polylang strings to bring them in.
- Check the cells and press Save. The buttons above only fill empty cells and never overwrite what you wrote.
A translation can contain HTML. This lets the consent text have its own link in every language, for example /de/datenschutz/ for German.
Tip: the same text in several forms is translated once. Write the link of the consent text the same way in every form (for example /privacy-policy/), or you will get one row for each version.
Step 4: Check the result
Open the page with the form in each language. Every visitor sees the form in the language of the page, and the form that is sent keeps the language it was shown in. A text without a translation shows as written in your main language. The form in the editor is never changed.
Step 5: Translate texts the search does not see
For a text in a place the search skips, for example the mail to the site, put it between braces: {Message from the site}. Such a text is translated the same way and shown without braces. To use only braces, turn off Find the texts without braces.
The key of a translation is the text as it is written. If you change a text in the form, write its translation again; it appears in the table as an empty cell.
Speed and tidiness
In the card Speed and tidiness you can:
- load the scripts of Contact Form 7, reCAPTCHA and Turnstile only on pages that show a form;
- stop loading the stylesheet of Contact Form 7 when your theme styles the forms;
- turn off the automatic paragraphs and line breaks, so the form is printed exactly as written. Check how your forms look after turning it on.
Block spam without a service
Turn on Block spam without a service in the card Spam. A hidden field that people never see and a minimum time between showing and sending the form catch robots. Set the shortest time to fill the form in seconds. A page kept in a cache keeps the old copy of a form until the cache is cleared, and such a form is not checked.
- Mail tags. Put
[_language]or[_language_name]in the subject or the body of a mail to see in which language the form was sent. - Failed mails. The tool remembers the last 30 mails that could not be sent, with the form, the time and the reason. What visitors sent is still kept in the form entries.
Check of the forms
The last card checks every form and lists what to improve:
- no recipient in the mail (error);
- a sender on another domain, or the address of the visitor as the sender (warning);
- no Reply-To, no consent checkbox, no spam protection;
- texts that are not translated into some language of the site;
- the pages that show the form, with links to edit them.
A form with nothing to improve shows Nothing to improve.
