If you are having a notice about writing the .mo files please read this doc

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by krzysztofT-2 4 years, 4 months ago.

Assigned support staff: Dat Hoang.

Author Posts
July 13, 2015 at 6:28 pm #658296

krzysztofT-2

Here's my code in my theme:

echo do_shortcode(__('[contact-form-7 id="7877" title="EN - Zapytanie o maszynę"]', 'formularze'));

I have translations of that contact form done through WPML. The form is displayed for all languages but English (English is not the main language on that site, it's on a subdomain en.sand-rom.com).

I have tested and the English form displays correctly if I paste its shortcode instead of other language shortcodes. So for example if I paste the same shortcode [contact-form-7 id="7877" title="EN - Zapytanie o maszynę"] in the Polish (site's main language at sand-rom.com) or German (de.sand-rom.com), the form displays itself in the English language. It also is displayed when copied directly into the post or page content. So, this is not an issue with Contact Form 7, it's an issue with executing do_shortcode() in English.

Just to be sure, I also tried this code:

echo do_shortcode('[contact-form-7 id="7877" title="EN - Zapytanie o maszynę"]');

and it also showed the form on all languages but English.

I have tried to remove the string from WPML -> String translation and re-scan, but it didn't help.

This might be related to what I did earlier. I had WPML 3.1.7.9 (or something like this) with the site's default language set to Polish (NOT English). I updated manually to WPML 3.2.2 (along with the WPML plugins) and noticed you removed the option to change the site's default language. There still was a button to change the site's default language somewhere in the settings (probably in the WPML -> WooCommerce Multilingual section). I hit the button that applied the fix: changed the site's default language to English and then was asked to re-scan strings (which I did). I'm afraid this might've broken the install somehow, as I'm experiencing the problem described above as well as another one: https://wpml.org/forums/topic/product-slug-translation-not-working/

Could be some other reason though. I'd appreciate some assistance.

July 14, 2015 at 9:41 am #658739

Dat Hoang

Actually, for Contact Form 7, you don't need to translate it.

You just need to create the different forms for different languages. Then use these IDs in the shortcodes in the correct languages.

Please take a look at: https://wpml.org/documentation/plugins-compatibility/using-contact-form-7-with-wpml/

Does that help?

July 14, 2015 at 10:36 am #658819

krzysztofT-2

Um no, that doesn't really help since the issue is related to do_shortcodes() rather than CF7.

And I do have to use the translation function __() because the shortcodes are placed in theme files, not in Posts or Pages. But this is doesn't really matter for this issue.

July 14, 2015 at 12:13 pm #658903

krzysztofT-2

I have managed to solve the issue. I did the following: disabled almost all plugins, switched WPML -> Theme & plugins localization -> translate using PO files ON (rather than using WPML translations), then tried using the Revolution Slider shortcode for testing - it worked. Switched it back to CF7 - worked (with the same form in all languages since I didn't have the shortcode translated in a PO file). Switched back on theme & plugin translation using WPML (1st step of the ones mentioned here) and switched plugins back on one-by-one and it still works. So somewhere along the way it fixed itself. Probably switching the theme & plugins localization using WPML on and off did the trick.
Thanks for your assistance, problem solved.