Skip Navigation

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.

WordPress 6.7 has introduced a new issue that impact translations, please update WooCommerce and WPML to the latest versions before you report issues. More about this here - https://wpml.org/errata/php-error-wp-6-7-notice-function-_load_textdomain_just_in_time-was-called/
Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 1 reply, has 2 voices.

Last updated by Mateus Getulio 1 month ago.

Assisted by: Mateus Getulio.

Author Posts
October 25, 2024 at 12:18 pm #16330571

desireeM

Background of the issue:
open wp-admin (e.g. your admin language is "fr")
Click something that will trigger an admin-ajax POST request that contains "lang" with value "de" and "action" in the POST body.

All text in the ajax post reply will be in "de" instead of "fr" and I do not understand a word of that language.

This happens bc you have a bug in WPML_Locale->locale()

if ( $is_ajax && isset( $_REQUEST['action'], $_REQUEST['lang'] ) ) {
$locale_lang_code = preg_replace( '/[^-a-zA-Z0-9_]/', '', $_REQUEST['lang'] );

Practical use case (where this happens to us all the time):
when we modify a WooCommerce order, we have a button that will send an email and it also uses "lang" which contains the customers (!) language though.

Solution:
instead of using $_REQUEST use $_GET

Symptoms:
All text in the ajax post reply is in 'de' instead of 'fr'

Questions:
Fix your code

October 25, 2024 at 7:42 pm #16332105

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi,

This is a brief note to let you know that this issue has been reported to our developers for a fix.

I will get back to you as soon as I get an answer from them.

Best regards,
Mateus