Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client reported that a quiz feature on their staging site was working in Hebrew, English, Arabic, and Russian, but not in French and Spanish. They identified that special characters in translated strings were causing the issue and temporarily removed the translation.

Solution:
We advised the client that supporting custom code falls outside our support scope, but we provided guidance to help resolve the issue. We recommended using gettext calls to make strings added with custom code translatable and provided documentation links:

We also suggested using the

wpml_current_language

hook to add custom code for each language quiz:

$my_current_lang = apply_filters( 'wpml_current_language', NULL );<br /><br />if($my_current_lang=='fr'){<br />//Custom code for French quiz<br />}

If these solutions are not helpful, we recommended trying one of the WPML-compatible plugins listed here: WPML-compatible plugins. Alternatively, the client can seek assistance from a third-party contractor or developer, with a list of certified contractors available here: WPML-certified contractors.

If this solution doesn't look relevant, 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.

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by Mohamed Sayed 10 months, 3 weeks ago.

Assisted by: Mohamed Sayed.

Author Posts
December 30, 2023 at 9:37 am #15137901

doronY

please check this staging site:
hidden link

click submnit quiz and you can se that it work in hebre, english, arabic, russin.

in FR and ES it dosnt work, I think that something is not set corrctlly in my site
please check it, this is staging site so you can change and check as you wish, i have backups

how can i saflly give you credenssials?

December 31, 2023 at 6:30 am #15138385

doronY

Please help me, I must solve it 🙂

December 31, 2023 at 11:50 am #15138767

Mohamed Sayed

Hi Doron,
Thanks for contacting WPML support.

First of all, sorry for the late reply due to a higher workload on the weekend.

1. Please increase the WordPress Memory Limit. According to your Debug.info, the WP memory limit needs to be increased. PHP memory is fine, but WordPress uses 40Mb as default. Minimum requirements for WPML is 128Mb. (Kindly check this page https://wpml.org/home/minimum-requirements/)

You can increase it by adding the following code in your wp-config.php file, right before the /* That’s all, stop editing! Happy publishing. */ line:

/** Memory Limit */
define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

2. Please also tell me more details about which plugin you use to create the quiz and how it's translated.

3. The French page shows a critical error message (Please see the attached screenshot). Please provide me with the WordPress debug.log, so we can check what PHP errors are being produced. More Info: https://wordpress.org/support/article/debugging-in-wordpress/

To enable it, open your wp-config.php file and look for:

define('WP_DEBUG', false);

And change it to:

define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings which is recommended on a live site.
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

Then visit the French page and check if any errors were saved to the debug.log file inside the /wp-content/ directory.

If you can paste your debug.log to https://pastebin.com/ and provide me that link, it would be great!

Kind regards,
Mohamed

Screenshot_450.png
December 31, 2023 at 12:55 pm #15138824

doronY

Hi
1. thank for answerin me
2. maybe you checked the site in spesific moment that i did some error, please check now
hidden link
you will see the quiz and not the error
3. i dont use quiz plugin, it is custom code
3. it work good in other languagesm you can see, just Spanish and French dosnt work

December 31, 2023 at 1:15 pm #15138828

doronY

the debug.log is empty
bu in console i see: Uncaught SyntaxError: Unexpected identifier 'Amélioration' (at baladiyeh-municipal-hospital/:910:31)
it is only in the problematic languages

December 31, 2023 at 1:15 pm #15138831

doronY

and this: Uncaught SyntaxError: Invalid or unexpected token (at baladiyeh-municipal-hospital/:911:20)
in spanish

December 31, 2023 at 1:18 pm #15138832

doronY

sorry this is the log:
https://pastebin.com/AGQ221kr

December 31, 2023 at 1:25 pm #15138833

doronY

I find the problem, some translates string looked like this: Amélioration and the special charachters did the problem
can you sudgest me how to solve it?
now i just remove the translation

December 31, 2023 at 3:09 pm #15138896

Mohamed Sayed

Hi,

I'm glad to hear that you were able to find the problem, but I'm afraid that supporting custom code is out of our support scope. Kindly check our support policy (https://wpml.org/purchase/support-policy/)

However, I will try to point you in the right direction. To make the strings added with custom code translatable, you should use gettext calls. Please check the following docs for more info:

- https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/
- https://wpml.org/documentation/support/translating-the-theme-you-created/

Another method is trying with the "wpml_current_language" hook to add a different quiz for each language. For example:

$my_current_lang = apply_filters( 'wpml_current_language', NULL );
 
if($my_current_lang=='fr'){
//Custom code for French quiz
}

If that didn't help, I suggest trying one of the compatible plugins. Please check the list here: https://wpml.org/plugin/

You can also contact a third-party contractor or developer to fix the code. Please check
the list of certified contractors here: https://wpml.org/contractors/

Kind regards,
Mohamed