WooCommerce Square plugin change ‘Place Order’ button to multiple languages

Plugin Support
Rynald0s.a11n

(@rynald0s)

Automattic Happiness Engineer

Hi @fiona0615

The Place order button is not specifically coming from Square.

Can you tell me what exact filter you added to the functions.php file, so I can see if that is correct?

Also, is there a reason you prefer using a filter and not something like Loco translate?

Cheers!

Hello,

Here is the filter that I added.

function custom_available_payment_gateways($payment) {
 
  // squareの決済ボタンのテキスト
  $payment['square_credit_card']->order_button_text = '注文する';
 
  return $payment;
}
add_filter('woocommerce_available_payment_gateways', 'custom_available_payment_gateways', 100);


I prefer translate but looks there is no way to translate.

Thank you.

Plugin Support
Rynald0s.a11n

(@rynald0s)

Automattic Happiness Engineer

Hi

Ah, okay, I can see what you mean. It shows the translated button across the English, Japanese, and Chinese instances (all instances showing Japanese).

It’s not very easy to change the string conditionally based on which locale is selected, to be honest. And it would probably somehow need to tie in with whatever code used with your WPML plugin/s.

Have you reached out to WPML to see if they have any suggestions?

Cheers!

Hello,

I have not reached out to WPML yet, because I thought it’s the problem for square only.
I will reach out WPML.

Thank you for your help.

Plugin Support
Rynald0s.a11n

(@rynald0s)

Automattic Happiness Engineer

Hi @fiona0615

Sounds good!

In the meantime, I do believe they have string translations in a similar way that Loco translate have — initializing translations by language. You can read more about that here:

With Loco translate, too. You should mainly check the WooCommerce core plugin, and not only Square if that is where you are trying to translate that string.

Cheers!

Hello,

I chat with WPML and they help me to fix this problem.
Now I know I have to scan WooCommerce Square Plugin and WooCommerce before use string translations.

Thank you!

Plugin Support
Rynald0s.a11n

(@rynald0s)

Automattic Happiness Engineer

Hi @fiona0615

Fantastic! I’m glad we were able to help! If you have a few minutes, we’d love if you could leave us a review:

Cheers!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer