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.
Tagged: Bug
This topic contains 9 replies, has 2 voices.
Last updated by chrisW-51 1 year, 7 months ago.
Assisted by: Prosenjit Barman.
Author | Posts |
---|---|
April 24, 2023 at 12:00 pm #13526899 | |
chrisW-51 |
I want to show the tranlated language wpforms smart logic field in entry preview.But the smart logic field value cannot show in tranlated language(en) entry preview. 1. Smart logic field screen 2 smart logic field |
April 26, 2023 at 2:36 am #13537619 | |
chrisW-51 |
I want to show the smart logic field in wpforms entry preview in tranlated language.How can fix this issue? |
April 26, 2023 at 7:05 am #13538259 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hello There, I completely understood the issue you're having. Based on the information you've provided, I checked and have successfully been able to reproduce the issue. Please be informed that the issue has been forwarded to the 2nd tier team for further investigation. Upon investigating the issue, I discovered that the data appears correctly in the Entry preview if I keep the translated value for the "Field" and "Choice"(added in the conditional logic) the same as the default language. But, I'm hoping that the 2nd tier team will come up with a more efficient solution for this issue. I will surely let you know when I have more updates on this. I appreciate your patience and cooperation in this matter. Best Regards, |
April 28, 2023 at 4:28 am #13554077 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hi There, Hope you're doing fine. I have an update to share. Upon investigating further, our team has successfully identified the root cause. One of the classes used in the conditional logic compares a translated value with the original. As the value is different in other languages, it always returns false in the secondary languages. The problem has been added to the development board, and our team is working on finding the best possible solution. In the meantime, we have a temporary workaround that can effectively address the issue. Please follow the steps mentioned below to solve the issue. - Open the wp-content\plugins\wpforms\pro\includes\class-conditional-logic-core.php file. if ( in_array( $value, $choice, true ) ) { $provided_id[] = $key; } With this code: // WPML Workaround if ( class_exists( 'SitePress' ) ) { $my_current_lang = apply_filters( 'wpml_current_language', NULL ); $my_default_lang = apply_filters( 'wpml_default_language', NULL ); // Only register/translate the string if we are not in original language if ( $my_current_lang != $my_default_lang ) { do_action( 'wpml_register_single_string', 'wpforms', 'WPML Workaround for: '.substr($value, 0, 40), $value ); $translated_value = apply_filters('wpml_translate_single_string', $value, 'wpforms', 'WPML Workaround for: '.substr($value, 0, 40)); // Let's just apply the translation if it match the original value if ( in_array( $translated_value, $choice, true ) ) { $value = $translated_value; } } } if ( in_array( $value, $choice, true ) ) { $provided_id[] = $key; } - After that, fill up the form in another language and check the Entry Preview. The entry will not appear in the preview but, the string will be registered for translation. - Now, please navigate to the WPML String Translator and search for the affected option. Apparently, you should find it at the top of the String Translation section(Please check this screenshot: hidden link). - Translate the string with the exact value defined for the choice in the original language. - After making these changes, it's time to check. Fill up the form in another language and check the Entry preview. The field value should appear properly now because the condition will match. Please be informed that you need to repeat these steps for every language/field till we release an optimal solution. Let me know if that helps. I will be glad to assist you if you need further assistance in this matter. Best Regards, |
April 28, 2023 at 7:37 am #13555057 | |
chrisW-51 |
After I update the code of wpform plugin,I can see the field on WPML String Translator and translate the string,testing ressult below: hidden link hidden link hidden link Final Result 2 language entry preview can show smart logic field,1 language entry preview cannot show smart logic field. |
May 2, 2023 at 4:52 am #13566785 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hi There, I understood that the issue still persists in the Third language. I checked in my development environment by activating Third Language and found that the value is appearing properly after adding the translation for that specific option properly. Can you please make sure that the Choice is translated properly with the exact value defined for the choice in the original language? If the issue persists even after that, then please allow me to check the issue closely from your end. I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to have a testing site where the issue is replicated. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it. Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you. IMPORTANT Looking forward to your response. Best Regards, |
May 2, 2023 at 9:29 am #13568979 | |
chrisW-51 |
i already clone a testing site for testing. Could you enable the private box? Thanks |
May 3, 2023 at 10:52 am #13577741 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hello There, I enabled the private box for you so that you can securely share access to your site. Please also let me know the name of the form you're having the issue. Looking forward to your response. Best Regards, |
May 5, 2023 at 6:04 am #13590759 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hi There, Thanks for sharing the credentials. I have succesfully been able to fix the issue on your testing site. Somehow, the source language of the "Other" option was changed to "English" whereas it should be the Default language of the site as for now. I changed the Source language of the option named "Other" to Simplified Chinese and that fixes the issue. You can change the source language of any String from String translation. The process is described properly in this documentation: https://wpml.org/documentation/getting-started-guide/string-translation/how-to-change-the-source-language-of-strings/ Please check and let me know if that helps or if you need any further assistance. I will be happy to help you. Best Regards, |