This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing an issue where the main language is Latvian, and while translating forms into English and Russian using WPML, the Gravity Form is being overwritten to English. Solution: We recommend the following steps to resolve this issue: 1. Edit the file at
$st_context = $this->get_st_context( $form['id'] );
// Cache.
$current_lang = $sitepress->get_current_language();
if ( isset( $this->current_forms[ $form['id'] ][ $current_lang ] ) ) {
return $this->current_forms[ $form['id'] ][ $current_lang ];
}
$snh = new GFML_String_Name_Helper();
$check = new \WPML\Utils\DebugBackTrace();//add this
if ( $check->is_class_function_in_call_stack( 'GFFormDisplay', 'process_form' ) ) { //add this
return $form;//add this
}//add this
$form = $this->populate_translated_values( $form, $st_context );
3. Update the form and try to reproduce the issue.
If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket at WPML support forum.
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.
Thanks for contacting WPML forums support. I’ll be glad to help you today.
1) Could you please check if the issue persists in a minimal environment by following these steps?
1- Deactivate all the plugins except WPML, Gravity Forms, Gravity Multilingual.
2- Switch for a moment to a WordPress default theme like Twenty Twenty-one.
3- Update the original form.
4- Update the translation via WPML-> Translation Management. (https://wpml.org/documentation/related-projects/gravity-forms-multilingual/)
If the issue is gone, activate one by one to see which one is causing an interaction issue.
❌ Please backup your database and website before performing the above test ❌
2) If the issue persists in the minimal installation, would you please create a new test form and translate it to check if you will face the same issue?
I found the issue - in the "Gravity Forms Autocomplete" plugin there is an option to allow visitors to add a new option. When this option is enabled and the visitor adds a new option the whole gravity form is overwritten to a language the user is in.
Let's say the user has selected the Russian language as the website language and then proceeds to complete the form. In the form, he adds a new option to the autocomplete field and submits the form...Now in the CMS, the form will be in Russian!
This happens only when a person adds a new option from the autocomplete field!
I switched to Twenty Twenty-Two WordPress theme and the issue still persisted.
The "Gravity Forms Autocomplete" plugins support said that they can't help me and it's multilingual plugins fault.
"Gravity Forms Autocomplete" plugins page - hidden link
Thanks for your update. Could you please login to this sandbox site and upload the "Gravity Forms Autocomplete" plugin? (hidden link)
After that, please create a test form and translate it, then try to replicate the issue. If the issue is replicable, kindly tell me the steps to reproduce it to consult our compatibility team regarding this issue.
Please note that this plugin is not officially compatible with WPML. You can check our computability list here. (https://wpml.org/plugin/)
Here is a video where I replicate the issue in the sandbox site hidden link
1)Open the form in a new tab (because when it will be overwritten to Russian you'll need a way to revert to the original language) hidden link
2)Go to the Russian page where this form is visible hidden link
3)The autocomplete CSS is broken so you'll need to remove the width property from the "select2-container"
4)Add a new option to autocomplete
5)Submit the form
6)Check if the form language has changed
7)If the language has changed then open the tab from the 1)step and save the form again so the form language will be English again
Thanks for replicating the issue, the video, and detailed steps to reproduce the issue. Currently, I'm consulting our 2nd tier supporters, and I'll update you as soon as I get their reply.
I've received our 2nd tier supporters' reply, and they found a workaround for this issue by the following steps:
1- Edit the (wp-content/plugins/gravityforms-multilingual/inc/gravity-forms-multilingual.class.php in \Gravity_Forms_Multilingual), and replace the following code Line 772