Skip Navigation

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

Problem:
Client was experiencing a fatal error (Fatal error: Uncaught Error: Call to a member function get_source_language_code()), when trying to translate a page automatically.

Solution:
There seemed to be the problem with page's records in DB, perhaps corrupted, which we fixed with the following steps:

1. Open the product for editing in the default language.
2. Switch to the target language using the top admin language bar.
3. Click "Copy content from [default language]" and then save.
4. Repeat these steps for each language you want to translate to.
5. Go to WPML -> Translation Management and send the product for automatic translation again.

If this solution doesn't look relevant to your issue, please open a new support ticket with us.

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 7 replies, has 2 voices.

Last updated by Waqas Bin Hasan 1 year, 3 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
January 23, 2024 at 7:05 am #15214175

timS-73

I am trying to: Translate it automatically my woocommerce products

Link to a page where the issue can be seen: hidden link

I expected to see: The products have been translated.

Instead, I got:

Fatal error: Uncaught Error: Call to a member function get_source_language_code() on bool in /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php:501 Stack trace: #0 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/classes/ATE/Hooks/class-wpml-tm-ate-jobs-actions.php(153): wpml_tm_create_ATE_job_creation_model() #1 [internal function]: WPML_TM_ATE_Jobs_Actions->{closure}() #2 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Fns.php(164): array_map() #3 [internal function]: WPML\FP\Fns::WPML\FP\{closure}() #4 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array() #5 [internal function]: WPML\FP\Fns::WPML\FP\{closure}() #6 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/collect/src/Illuminate/Support/Traits/Macroable.php(56): call_user_func_array() #7 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/classes/ATE/Hooks/class-wpml-tm-ate-jobs-actions.php(152): WPML\FP\Fns::__callStatic() #8 /www/wwwroot/evowatt.ch/wp-includes/class-wp-hook.php(324): WPML_TM_ATE_Jobs_Actions->added_translation_jobs() #9 /www/wwwroot/evowatt.ch/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #10 /www/wwwroot/evowatt.ch/wp-includes/plugin.php(517): WP_Hook->do_action() #11 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(1478): do_action() #12 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(1316): TranslationManagement->send_jobs() #13 /www/wwwroot/evowatt.ch/wp-includes/class-wp-hook.php(324): TranslationManagement->action_send_jobs() #14 /www/wwwroot/evowatt.ch/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #15 /www/wwwroot/evowatt.ch/wp-includes/plugin.php(517): WP_Hook->do_action() #16 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/API/Batch.php(40): do_action() #17 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/API/Batch.php(56): WPML\TM\API\Batch::WPML\TM\API\{closure}() #18 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/API/Batch.php(44): WPML\TM\API\Batch::send() #19 [internal function]: WPML\TM\API\Batch::sendPosts() #20 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(100): call_user_func_array() #21 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/classes/translation-jobs/Dispatch/Elements.php(49): WPML\FP\{closure}() #22 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/classes/translation-jobs/Dispatch/Posts.php(19): WPML\TM\Jobs\Dispatch\Elements::dispatch() #23 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(498): WPML\TM\Jobs\Dispatch\Posts::dispatch() #24 /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(295): TranslationManagement->process_request() #25 /www/wwwroot/evowatt.ch/wp-includes/class-wp-hook.php(324): TranslationManagement->wp_loaded() #26 /www/wwwroot/evowatt.ch/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #27 /www/wwwroot/evowatt.ch/wp-includes/plugin.php(517): WP_Hook->do_action() #28 /www/wwwroot/evowatt.ch/wp-settings.php(665): do_action() #29 /www/wwwroot/evowatt.ch/wp-config.php(88): require_once('...') #30 /www/wwwroot/evowatt.ch/wp-load.php(50): require_once('...') #31 /www/wwwroot/evowatt.ch/wp-admin/admin.php(34): require_once('...') #32 {main} thrown in /www/wwwroot/evowatt.ch/wp-content/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php on line 501
There has been a critical error on this website. Please check your site admin email inbox for instructions.

Learn more about troubleshooting WordPress.

January 23, 2024 at 9:28 am #15215101

timS-73

Also, I cannot remove the items from the translation queue after finishing the translation. I'm trying to approve the translation reviews but it shows this message. Please give me a solution as soon as possible because I'm losing money on marketing.

Screenshot_12.png
January 23, 2024 at 9:52 am #15215382

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support.

The said error was resolved some time ago (https://wpml.org/errata/woocommerce-multilingual-fatal-error-uncaught-error-call-to-a-member-function-get_source_language_code-on-bool/), however, before proceeding further, may I ask you to try the following?

IMPORTANT: Take full backup of your website and database beforehand. It is highly advised to try the following on a staging/dev site first, so your live website isn't compromised.

- Update WooCommerce Multilingual & Multicurrency to the latest version.
- Deactivate all plugins except WPML and its addons and check for the issue.
- Activate each plugin one-by-one, while keeping check on the issue after a plugin is activated. This way you'll be able to pinpoint a plugin having a conflict (or problem), if any.
- If the problem persists, repeat the above steps with a default theme of WordPress (i.e. 2021 or 2023). This may not be an issue but since your current theme isn't on our compatibility list (https://wpml.org/theme/), lets rule out the possibility of any conflict.

P.S.: Also check your other issue about approving translations, if the above mentioned practice doesn't let you through it, I recommend opening a separate ticket because as per forum policy we can only handle one issue per ticket. So you can get more to the point help, without mixing up several issues in one long ticket.

Regards.

January 23, 2024 at 11:00 am #15215759

timS-73

I've deactivated all plugins except wpml plugin and extension. Also used twenty twenty-four WordPress default themes. But still, the issue persists.

Screenshot_14.png
Screenshot_13.png
January 23, 2024 at 12:54 pm #15216744

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates.

I need to take a closer look at your site. So I request temporary access (WP-Admin and FTP), preferably to a test site where the problem has been replicated.

Your next answer will be private, to share this information safely.

Also provide detailed steps to reproduce the issue and links to pages in admin and on frontend.

IMPORTANT: Please take a complete backup of the site to avoid data loss. I may need to activate/deactivate plugins also.

See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security.

January 24, 2024 at 5:29 am #15219458

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the access but looks like it hasn't been activated. I am getting following message when tried to login:

Avertissement : Votre compte est en attente de révision. Veuillez noter que la connexion n'est pas actuellement autorisée.

Warnung: Ihr Konto steht zur Überprüfung aus. Bitte beachten Sie, dass eine Anmeldung derzeit nicht möglich ist.

See attached.

Please check on your side and if you want to provide new/updated credentials, I've set your next message as private.

P.S.: Since this is a live site, I am afraid during activate/deactivate plugins, something may go wrong. It would be great if you can copy/clone this to a test site and provide access to that. Or if it is OK for you, I can continue checking on the same live site (once I'm able to login).

Screenshot 2024-01-24 102538.jpg
January 24, 2024 at 12:33 pm #15221708

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the update, I was able to login. I am working on this and 'll get back to you as soon as I find something or have a solution.

January 25, 2024 at 6:35 am #15224474

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I checked several things including configurations and translation statuses on our servers, everything looks perfectly fine.

I also created a test product "Test product WPML" and translated it automatically successfully. I tried the same with another existing product and it was just fine.

The problem was with "BYD Battery-Box Premium HV Combiner Box CBH-40A" product only. As soon as I sent it to translate automatically, I got that fatal error. This was not only it, if I opened the product for editing and clicked the gear icon to edit the translation, I got the same.

Surprisingly there's no record for its translations in our servers. I couldn't even find the translated versions of this product in your site's WP Admin (i.e. go to Products and switch to other language from top admin bar).

While on the frontend, this product was showing same content for all the translations.

So to fix this I followed these steps:

- Opened the product for editing in default language.
- Switched to German from top admin language bar.
- Clicked "copy content from French" and then saved.
- Repeated these steps for Italian as well.
- Then from WPML -> Translation Management, I sent this product for automatic translation again and it all went just fine.

As per my understanding, perhaps there was some DB corruption for this particular product. And when you were sending for automatic translation, it was creating that fatal error problem, while others were just fine.

Besides the above mentioned, I also cancelled some existing jobs - you can now send again.

Attached screenshots are for your reference to the above mentioned. Please remember to remove "Test product WPML" and its translations after checking.

Screenshot 2024-01-25 111936.jpg
Screenshot 2024-01-25 110218.jpg