Skip Navigation

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

Problem:
If you're experiencing a critical error when switching your WooCommerce product page to a second language, it may be due to a translation issue with placeholders in your theme files.

Solution:
We found a fatal error related to incorrect placeholder translation in the theme file

/wp-content/themes/porto/inc/functions/wpb-elements.php

on line 1014. The correct format for translating placeholders like "%1$sarticle%2$s" should maintain the 's' after the dollar sign. If the 's' is missing, it will cause an error.

To resolve this, we recommend you:
1. Visit the WPML > String Translation section.
2. Search for the problematic string.
3. Re-translate it using the correct placeholder format.

For more information on translating placeholders, please refer to the WordPress documentation.

We have already fixed the issue for the reported instance, and the translated product should now display correctly on the front end.

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

Last updated by olliP 1 year, 6 months ago.

Assisted by: Mihai Apetrei.

Author Posts
December 2, 2023 at 12:16 am #14976425

olliP

I am trying to:
Change language from English to Finnish in frontend

Link to a page where the issue can be seen:

I expected to see:
Finnish language

Instead, I got:
Critical error.

Here's what the PHP error says:
Message
PHP Fatal error: Uncaught ValueError: Missing format specifier at end of string in /srv/htdocs/wp-content/themes/porto/inc/functions/wpb-elements.php:1014
Stack trace:
#0 /srv/htdocs/wp-content/themes/porto/inc/functions/wpb-elements.php(1014): sprintf('Jakson leveys m...', '')
#1 /wordpress/core/6.4.1/wp-includes/class-wp-hook.php(324): porto_load_shortcodes('')
#2 /wordpress/core/6.4.1/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /wordpress/core/6.4.1/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /srv/htdocs/wp-content/plugins/js_composer/include/classes/core/class-vc-manager.php(251): do_action('vc_after_init')
#5 /wordpress/core/6.4.1/wp-includes/class-wp-hook.php(324): Vc_Manager->init('')
#6 /wordpress/core/6.4.1/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#7 /wordpress/core/6.4.1/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#8 /wordpress/core/6.4.1/wp-settings.php(643): do_action('init')
#9 /srv/htdocs/wp-config.php(83): require_once('/wordpress/core...')
#10 /wordpress/core/6.4.1/wp-load.php(55): require_once('/srv/htdocs/wp-...')
#11 /wordpress/core/6.4.1/wp-blog-header.php(13): require_once('/wordpress/core...')
#12 /wordpress/core/6.4.1/index.php(17): require('/wordpress/core...')
#13 {main}
thrown in /srv/htdocs/wp-content/themes/porto/inc/functions/wpb-elements.php on line 1014
Timestamp
2023-12-02T00:06:04.000Z
Kind
themes
Name
porto
File
/srv/htdocs/wp-content/themes/porto/inc/functions/wpb-elements.php
Line
1014

December 2, 2023 at 11:52 am #14977329

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi there.

Before this ticket gets assigned to one of my colleagues I will try to help.

I created this custom search URL for you so that you can find the existing tickets for this exact same error message that already contain solutions recommended by my colleagues:
hidden link

I hope that you will find this information helpful 🙂

Kind regards,
Mihai Apetrei

December 3, 2023 at 8:18 am #14979643

olliP

Hi,

Yes, I have tried the following:
- Doing extensive research about this issue before creating a ticket
- Trying to look for the error string, could not find it even with localizing all strings on the site.
- Translating All %s to all languages as it is
- Searcing %s strings and copying them as it is to other languages
- Reinstalling all WPML components
- Deactivating string plugin, this allows the site to works but checkout & cart is then broken
- Installing new language with automatic mode, the new language works, existing languages Finnish and Norwegian are broken

Anything I'm missing from the existing solutions?

December 4, 2023 at 9:37 am #14983807

olliP

Long helped us to fix this already. Thanks a lot!