• Resolved holafreak

    (@holafreak)


    Is there a way to change the language from the Google Pay express button into the user’s language? Currently using the PaymentRequest Gateway.

    It always shows me the English version of the Google Pay button although there’s definitely one in my language. I know it’s an SVG file and it has a “en-” prefix but is there a template file that can be edited accordingly to change the button locale?

    Thanks for the great plugin.

    • This topic was modified 11 months, 1 week ago by holafreak.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Clayton R

    (@mrclayton)

    Hi @holafreak

    On the Advanced Settings page of the Stripe plugin, what option do you have enabled for the Locale Type setting? Try setting it to use your site’s locale and see if that reflects the desired language.

    Kind Regards

    Thread Starter holafreak

    (@holafreak)

    Hi @mrclayton

    I can only choose between Auto or Site Locale but both changes don’t affect the button.

    My site’s language is set to German and my browser locale is German too but both options give me an English Google Pay button.

    Plugin Author Clayton R

    (@mrclayton)

    Hi @holafreak

    Can you share a product page url to your site so it can be reviewed?

    Kind Regards

    Plugin Author Clayton R

    (@mrclayton)

    Hi @holafreak

    I had some testing run and here are our findings:

    1. Stripe apparently uses a different locale nomenclature for the payment request button which you can see here. https://docs.stripe.com/js/appendix/supported_locales. What that means is your WordPress site’s de-DE locale doesn’t mean anything to Stripe. It has to be in the de format.
    2. We need to make an update in the next release so the locale value is used on pages other than the checkout page. Right now, even if you pass de it will only work on the checkout page.
    3. We will need to update the plugin so it uses the short form locale (de) instead of the more common (de-DE) format.

    Here is the code snippet you can use to show the German language for the payment request button on the checkout page:

    add_filter('wc_stripe_localize_script_payment-request', function($data){
    $data['elementOptions']['locale'] = 'de';
    return $data;
    });

    Kind Regards

    Thread Starter holafreak

    (@holafreak)

    Hi @mrclayton

    Thanks for the code snippet. I can see that it changes the language of my normal Google Pay button (not the express one) on my checkout page.

    Product page, cart and express checkout Google Pay on the checkout page are still in English.

    Not important for now if it will be part of the next update but I guess it would be nice to have the auto and site’s locale option working. At the moment both options don’t seem to do anything.

    Plugin Author Clayton R

    (@mrclayton)

    At the moment both options don’t seem to do anything.

    That’s not true for all other payment methods. For example, if you test the card form with site locale, you will see it’s in German. The payment request button for some is treated differently by Stripe.

    Thread Starter holafreak

    (@holafreak)

    Thanks for the help. Yeah, the other payment methods are translated. Sorry for the confusion.

    Plugin Author Clayton R

    (@mrclayton)

    Version 3.3.87 has been released.

    Thread Starter holafreak

    (@holafreak)

    Thanks for the fast update, I’m using site locale and it’s working perfectly.

    • This reply was modified 10 months, 2 weeks ago by holafreak.
    Plugin Author Clayton R

    (@mrclayton)

    Hi @holafreak

    Awesome, thank you for confirming.

    Kind Regards

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Show Google Pay button in user’s language?’ is closed to new replies.