Skip Navigation

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

Problem:
The client is using the Klarna Payments for WooCommerce plugin and is unable to find the plugin's strings translated into Greek in the string translation to translate them into English, despite scanning the plugin and theme and using various translation options.
Solution:
We recommend modifying the plugin's code to ensure WPML correctly identifies and translates the strings. Follow these steps:
1. Edit the file at

wp-content/plugins/klarna-payments-for-woocommerce/vendor/krokedil/klarna-onsite-messaging/src/Utility.php

2. Replace the existing

get_locale_from_currency

function with the following code:

public static function get_locale_from_currency() {<br />    $locale       = get_locale();<br />    $currency     = get_woocommerce_currency();<br />    $country_code = self::get_purchase_country();<br /><br />    if ($is_wpml_configured = apply_filters('wpml_setting', false, 'setup_complete') == 1) {<br />        if ($locale == "en_US") {<br />            $locale = "en-GR";<br />            return $locale;<br />        }<br />    }<br />}

Please ensure to back up your site before implementing these changes.

If this solution does not resolve your issue or seems outdated, we recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket at WPML support forum.

0% of people find this useful.

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

Last updated by George Botsev 5 months, 1 week ago.

Assisted by: Osama Mersal.

Author Posts
June 5, 2024 at 7:20 am #15705293

nikolaosM

They have not answered us yet. You have said that your team is contacting them to see if you can get an account to see where the strings are generated. How is it going?

June 5, 2024 at 7:22 am #15705298

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

They haven't answered us yet, and our team is trying to figure this out on a copy of your staging site.

I'll update you as soon as I get any update from our team.

Best regards,
Osama

June 12, 2024 at 12:45 pm #15731643

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

We couldn't replicate the issue because of the account. However, we have a workaround that could be helpful. Please check the following steps:

1- Edit the "wp-content/plugins/klarna-payments-for-woocommerce/vendor/krokedil/klarna-onsite-messaging/src/Utility.php" file
2- Replace the following code

	public static function get_locale_from_currency() {
		$locale       = get_locale();
		$currency     = get_woocommerce_currency();
		$country_code = self::get_purchase_country();

With

public static function get_locale_from_currency() {
		$locale       = get_locale();
		$currency     = get_woocommerce_currency();
		$country_code = self::get_purchase_country();
       if ($is_wpml_configured = apply_filters( 'wpml_setting', false, 'setup_complete' ) == 1) {
            return $locale;
        }

❌ Please backup your site before performing the above steps ❌

Best regards,
Osama

June 13, 2024 at 8:02 am #15734597

nikolaosM

Hello Osama,

I have tried what you suggested in our demo site and the message goes missing from the product page.

Before: hidden link
After: hidden link

Thanks!

June 13, 2024 at 8:04 am #15734601

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Would it be possible for our 2nd tier support team to check the issue on your demo site?

If yes, please add the access details to the private fields.

Best regards,
Osama

June 13, 2024 at 12:52 pm #15736242

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for the details. Our 2nd tier team will check the issue on your site and I'll update you with their findings.

Best regards,
Osama

June 14, 2024 at 9:57 am #15739488

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Please check if the message is translated correctly.

Best regards,
Osama

2024-06-14_12-55-43.jpg
June 17, 2024 at 7:19 am #15743521

nikolaosM

Yes we can see the string translated. If you are asking about the translation, it is not correct, after the euro symbol you sould add this string inside the brakets ", via debit or credit card".

June 17, 2024 at 10:41 am #15744774

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

We didn't translate the message. The message is retrieved from the Klarna server, so you would need to contact them to change the message.

Best regards,
Osama

June 18, 2024 at 7:16 am #15747508

nikolaosM

So what you did was contact Klarna and issue is solved?

June 18, 2024 at 10:00 am #15748322

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

We changed the code so the Kalrna server sends the message according to the language local.

Best regards,
Osama

June 18, 2024 at 11:39 am #15748734

nikolaosM

Hello,

Sorry but we are geting confused. Can you explain the things you did so we can make this work? Do we have to change anything in the live site?

Thanks!

June 18, 2024 at 11:57 am #15748771

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Please replace the previous workaround code with the following code. (https://wpml.org/forums/topic/cant-find-strings-for-klarna-payments-plugin/page/2/#post-15731643)

public static function get_locale_from_currency() {
		$locale       = get_locale();
		$currency     = get_woocommerce_currency();
		$country_code = self::get_purchase_country();

		if ($is_wpml_configured = apply_filters( 'wpml_setting', false, 'setup_complete' ) == 1) {
     if ($locale == "en_US") {
          $locale = "en-GR";
                      return $locale;
     }

        }

Best regards,
Osama

June 18, 2024 at 2:00 pm #15749432

nikolaosM

Hello Osama,

Thanks fot the help. It fixed the issue in the product page, but the problem the problem still remains in the checkout page. We would like a solution for this also.

June 18, 2024 at 5:22 pm #15750477

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Please contact the plugin author for more help regarding translating the checkout message.

Also, please check this guide. (hidden link)

Best regards,
Osama