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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by Long Nguyen 4 days, 7 hours ago.

Assisted by: Long Nguyen.

Author Posts
June 23, 2024 at 3:03 pm #15795460

carlos-danielV

Background of the issue:
I am trying to update DIVI to the last version. For now, the WPML Multilingual & Multicurrency plugin has been deactivated. Link to a page where the issue can be seen: hidden link

Symptoms:
PHP Fatal error Uncaught TypeError: WP_Translation_Controller::translate(): Argument #1 ($text) must be of type string, array given, called in /home/customer/www/centrourku.org/public_html/wp-includes/l10n/class-wp-translations.php on line 144 and defined in /home/customer/www/centrourku.org/public_html/wp-includes/l10n/class-wp-translation-controller.php:263

Questions:
How can I resolve the PHP Fatal error related to WP_Translation_Controller::translate()?
Is there a compatibility issue between the latest version of DIVI and WPML Multilingual & Multicurrency plugin?

Message from DIVI:
On another inspection, I found that as long as the plugin WooCommerce Multilingual & Multicurrency is active, we get a critical error on the frontend.

So I've disabled that plugin for now. You can reach out to the author of the plugin to get some insight from them on this critical error.

This rule disables the XML-RPC requests, so if any plugin or theme is using this feature to communicate with your site, they won't be able to do so.
Can you please check with the WPML team and see if they are using this API for their WooCommerce Multilingual & Multicurrency plugin? Is there any other problem you're facing right now apart from that plugin causing critical error?

June 24, 2024 at 4:08 am #15801599

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Carlos,

Thank you for contacting WPML support, I’m happy to help you with this issue.

According to the error message, I see it is related to a WordPress class WP_Translation_Controller, it is called in WooCommerce Multilingual file wp-content/plugins/woocommerce-multilingual/classes/MO/Hooks.php
to load/unload a text-domain. I think it isn't affected by XML RPC code in the .htaccess file. Does the issue persist if you remove that code?

If yes, I suggest you enable a minimal environment as below and see how it goes:
- Deactivate all plugins except WPML plugins, WooCommerce.
- Activate WooCommerce Multilingual.
❌ IMPORTANT: Please backup your database and website before proceeding ❌

Looking forward to your reply.
Thanks

June 24, 2024 at 9:31 am #15804975

carlos-danielV

Hello,

Two months ago I reported another problem with WPML String Translation:

Problem:
The client was experiencing a fatal error after updating to PHP 8.1, which suggested that the plugin was trying to use "isset" with an array instead of an object.

Solution:
We identified this as a known issue and provided a workaround. We recommended adding the following code to the theme's functions.php file after making a full backup of the site:

add_filter( 'option_woocommerce_micuentawebstd_settings', function( $settings ) {
$locale = get_locale();
foreach ( [ 'title', 'description' ] as $key ) {
if ( is_array( $settings[ $key ] ) ) {
$settings[ $key ] = isset( $settings[ $key ][ $locale ] )
? $settings[ $key ][ $locale ]
: $settings[ $key ]['en_US'];
}
}

return $settings;
} );

I was able to update my php version.

Now the problem is with the plugin WooCommerce Multilingual & Multicurrency. I have to turn it off beacause there a conflict with the last version of DIVI (Versión: 4.25.2).

XML RPC code isn't affecte the proper functioning.

I have created a test environment and left the WMPL and Woocommerce plugins in place. You can see this error in the screemshot.

Login to the test environement: hidden link
[supporter removed]

Thank you in advance for your help.

Carlos Vecco

wacdsc.jpg
June 24, 2024 at 9:59 am #15805294

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I would like to request temporary access (wp-admin and FTP) to your staging site to take a better look at the issue. Your next reply is set to private to share the info.

❌ IMPORTANT: Please backup your database and website before proceeding ❌
You can use this plugin to create the backup: https://wordpress.org/plugins/duplicator/
✙ I would need your permission to de-activate and re-activate Plugins and the Theme to change configurations on the site if needed. This is also a reason the backup is critical.

Looking forward to your reply.
Thanks

June 26, 2024 at 1:50 am #15827404

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

The admin account isn't correct, I'm not able to access your staging site admin area. After restoring your site on my local host with a backup file, activating WooCommerce Multilingual plugin, I see there is a fatal error in the log:

[26-Jun-2024 01:41:51 UTC] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to WP_Translation_Controller::translate() must be of the type string, array given, called in /Applications/MAMP/htdocs/centrourku/wp-includes/l10n/class-wp-translations.php on line 144 and defined in /Applications/MAMP/htdocs/centrourku/wp-includes/l10n/class-wp-translation-controller.php:263
Stack trace:
#0 /Applications/MAMP/htdocs/centrourku/wp-includes/l10n/class-wp-translations.php(144): WP_Translation_Controller->translate(Array, '', 'woocommerce')
#1 /Applications/MAMP/htdocs/centrourku/wp-includes/l10n.php(195): WP_Translations->translate(Array)
#2 /Applications/MAMP/htdocs/centrourku/wp-includes/l10n.php(306): translate(Array, 'woocommerce')
#3 /Applications/MAMP/htdocs/centrourku/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-wc-gateways.php(156): __(Array, 'woocommerce')
#4 /Applications/MAMP/htdocs/centrourku/wp-content/plugins/woocommerce-multilingual/classes/PaymentGateways/BlockHooks.php(36): WCML_WC_Gateways->get_translated_gateway_string(Array in /Applications/MAMP/htdocs/centrourku/wp-includes/l10n/class-wp-translation-controller.php on line 263

it is related to the payment gateway "Mi Cuenta Web" on your site. Then I use the code in the previous ticket, add it to the file functions.php in the child theme folder and the site works properly in the frontend.

add_filter( 'option_woocommerce_micuentawebstd_settings', function( $settings ) {
    $locale = get_locale();
    foreach ( [ 'title', 'description' ] as $key ) {
        if ( is_array( $settings[ $key ] ) ) {
            $settings[ $key ] = isset( $settings[ $key ][ $locale ] )
                ? $settings[ $key ][ $locale ]
                : $settings[ $key ]['en_US'];
        }
    }
 
    return $settings;
} );

https://wpml.org/forums/topic/wpml-string-translate-plugin-incompatibility-with-php-versions-higher-than-7-4/

Please add the code to your staging site and recheck the issue.

Looking forward to your reply.
Thanks