From 8b96613339e45bd025926ad69007050ebc3dad02 Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Wed, 25 Sep 2024 00:09:27 +0200 Subject: [PATCH] Localize strings --- .../resources/js/components/Card/CardChangeButton.js | 3 ++- .../resources/js/components/EmailButton/EmailButton.js | 3 ++- .../resources/js/components/Payment/Payment.js | 6 +++++- .../js/components/Shipping/ShippingChangeButton.js | 7 ++++++- modules/ppcp-axo-block/resources/js/index.js | 7 ++++--- modules/ppcp-axo-block/src/AxoBlockPaymentMethod.php | 1 - 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/modules/ppcp-axo-block/resources/js/components/Card/CardChangeButton.js b/modules/ppcp-axo-block/resources/js/components/Card/CardChangeButton.js index 8286c809a..1779d67b6 100644 --- a/modules/ppcp-axo-block/resources/js/components/Card/CardChangeButton.js +++ b/modules/ppcp-axo-block/resources/js/components/Card/CardChangeButton.js @@ -1,4 +1,5 @@ import { createElement } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; const CardChangeButton = ( { onChangeButtonClick } ) => createElement( @@ -12,7 +13,7 @@ const CardChangeButton = ( { onChangeButtonClick } ) => onChangeButtonClick(); }, }, - 'Choose a different card' + __( 'Choose a different card', 'woocommerce-paypal-payments' ) ); export default CardChangeButton; diff --git a/modules/ppcp-axo-block/resources/js/components/EmailButton/EmailButton.js b/modules/ppcp-axo-block/resources/js/components/EmailButton/EmailButton.js index 527a7835a..ab41f067e 100644 --- a/modules/ppcp-axo-block/resources/js/components/EmailButton/EmailButton.js +++ b/modules/ppcp-axo-block/resources/js/components/EmailButton/EmailButton.js @@ -1,5 +1,6 @@ import { STORE_NAME } from '../../stores/axoStore'; import { useSelect } from '@wordpress/data'; +import { __ } from '@wordpress/i18n'; const EmailButton = ( { handleSubmit } ) => { const { isGuest, isAxoActive, isEmailSubmitted } = useSelect( @@ -29,7 +30,7 @@ const EmailButton = ( { handleSubmit } ) => { visibility: isEmailSubmitted ? 'hidden' : 'visible', } } > - Continue + { __( 'Continue', 'woocommerce-paypal-payments' ) } { isEmailSubmitted && ( { } return (
- Enter your email address above to continue. + { __( + 'Enter your email address above to continue.', + 'woocommerce-paypal-payments' + ) }
); } diff --git a/modules/ppcp-axo-block/resources/js/components/Shipping/ShippingChangeButton.js b/modules/ppcp-axo-block/resources/js/components/Shipping/ShippingChangeButton.js index 56f71a4d5..b7d55d508 100644 --- a/modules/ppcp-axo-block/resources/js/components/Shipping/ShippingChangeButton.js +++ b/modules/ppcp-axo-block/resources/js/components/Shipping/ShippingChangeButton.js @@ -1,3 +1,5 @@ +import { __ } from '@wordpress/i18n'; + const ShippingChangeButton = ( { onChangeShippingAddressClick } ) => ( ( onChangeShippingAddressClick(); } } > - Choose a different shipping address + { __( + 'Choose a different shipping address', + 'woocommerce-paypal-payments' + ) } ); diff --git a/modules/ppcp-axo-block/resources/js/index.js b/modules/ppcp-axo-block/resources/js/index.js index 82acff78b..f3092fb55 100644 --- a/modules/ppcp-axo-block/resources/js/index.js +++ b/modules/ppcp-axo-block/resources/js/index.js @@ -1,4 +1,5 @@ -import { useState } from '@wordpress/element'; +import { useState, createElement } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; import { registerPaymentMethod } from '@woocommerce/blocks-registry'; // Hooks @@ -76,7 +77,7 @@ const Axo = ( props ) => { onChangeButtonClick={ onChangeCardButtonClick } /> ) : ( -
Loading Fastlane...
+ <>{ __( 'Loading Fastlane…', 'woocommerce-paypal-payments' ) } ); }; @@ -89,7 +90,7 @@ registerPaymentMethod( { /> ), content: , - edit:

This is Axo Blocks in the editor

, + edit: createElement( ppcpConfig.title ), ariaLabel: ppcpConfig.title, canMakePayment: () => true, supports: { diff --git a/modules/ppcp-axo-block/src/AxoBlockPaymentMethod.php b/modules/ppcp-axo-block/src/AxoBlockPaymentMethod.php index 26c3c0ab9..bea2f09cd 100644 --- a/modules/ppcp-axo-block/src/AxoBlockPaymentMethod.php +++ b/modules/ppcp-axo-block/src/AxoBlockPaymentMethod.php @@ -243,7 +243,6 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType { ), 'logging_enabled' => $this->settings->has( 'logging_enabled' ) ? $this->settings->get( 'logging_enabled' ) : '', 'wp_debug' => defined( 'WP_DEBUG' ) && WP_DEBUG, - 'billing_email_button_text' => __( 'Continue', 'woocommerce-paypal-payments' ), ); } }