mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Add GooglePay button language/locale
This commit is contained in:
parent
e8b21ed044
commit
c3e5d21e75
4 changed files with 63 additions and 2 deletions
|
@ -55,6 +55,7 @@ return array(
|
|||
'elements' => array(
|
||||
'#field-googlepay_button_color',
|
||||
'#field-googlepay_button_type',
|
||||
'#field-googlepay_button_language',
|
||||
'#field-googlepay_button_shipping_enabled',
|
||||
),
|
||||
),
|
||||
|
@ -96,6 +97,22 @@ return array(
|
|||
'gateway' => 'paypal',
|
||||
'requirements' => array(),
|
||||
),
|
||||
'googlepay_button_language' => array(
|
||||
'title' => str_repeat( ' ', 6 ) . __( 'Button Language', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The language and region used for the displayed Google Pay button. The default value is the current language and region setting in a browser.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'en',
|
||||
'options' => PropertiesDictionary::button_languages(),
|
||||
'screens' => array( State::STATE_ONBOARDED ),
|
||||
'gateway' => 'paypal',
|
||||
'requirements' => array(),
|
||||
),
|
||||
'googlepay_button_shipping_enabled' => array(
|
||||
'title' => str_repeat( ' ', 6 ) . __( 'Shipping Callback', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
|
|
|
@ -149,6 +149,7 @@ class GooglepayButton {
|
|||
allowedPaymentMethods: [baseCardPaymentMethod],
|
||||
buttonColor: buttonStyle.color || 'black',
|
||||
buttonType: buttonStyle.type || 'pay',
|
||||
buttonLocale: buttonStyle.language || 'en',
|
||||
buttonSizeMode: 'fill',
|
||||
});
|
||||
jQuery(wrapper).append(button);
|
||||
|
|
|
@ -388,8 +388,9 @@ class Button implements ButtonInterface {
|
|||
$context = str_replace( '-block', '', $context );
|
||||
|
||||
$values = array(
|
||||
'color' => 'black',
|
||||
'type' => 'pay',
|
||||
'color' => 'black',
|
||||
'type' => 'pay',
|
||||
'language' => 'en',
|
||||
);
|
||||
|
||||
foreach ( $values as $style => $value ) {
|
||||
|
|
|
@ -43,4 +43,46 @@ class PropertiesDictionary {
|
|||
'subscribe' => __( 'Subscribe', 'woocommerce-paypal-payments' ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the possible list of button languages.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function button_languages(): array {
|
||||
return array(
|
||||
'' => __( 'Browser language', 'woocommerce-paypal-payments' ),
|
||||
'ar' => __( 'Arabic', 'woocommerce-paypal-payments' ),
|
||||
'bg' => __( 'Bulgarian', 'woocommerce-paypal-payments' ),
|
||||
'ca' => __( 'Catalan', 'woocommerce-paypal-payments' ),
|
||||
'zh' => __( 'Chinese', 'woocommerce-paypal-payments' ),
|
||||
'hr' => __( 'Croatian', 'woocommerce-paypal-payments' ),
|
||||
'cs' => __( 'Czech', 'woocommerce-paypal-payments' ),
|
||||
'da' => __( 'Danish', 'woocommerce-paypal-payments' ),
|
||||
'nl' => __( 'Dutch', 'woocommerce-paypal-payments' ),
|
||||
'en' => __( 'English', 'woocommerce-paypal-payments' ),
|
||||
'et' => __( 'Estonian', 'woocommerce-paypal-payments' ),
|
||||
'fi' => __( 'Finnish', 'woocommerce-paypal-payments' ),
|
||||
'fr' => __( 'French', 'woocommerce-paypal-payments' ),
|
||||
'de' => __( 'German', 'woocommerce-paypal-payments' ),
|
||||
'el' => __( 'Greek', 'woocommerce-paypal-payments' ),
|
||||
'id' => __( 'Indonesian', 'woocommerce-paypal-payments' ),
|
||||
'it' => __( 'Italian', 'woocommerce-paypal-payments' ),
|
||||
'ja' => __( 'Japanese', 'woocommerce-paypal-payments' ),
|
||||
'ko' => __( 'Korean', 'woocommerce-paypal-payments' ),
|
||||
'ms' => __( 'Malay', 'woocommerce-paypal-payments' ),
|
||||
'no' => __( 'Norwegian', 'woocommerce-paypal-payments' ),
|
||||
'pl' => __( 'Polish', 'woocommerce-paypal-payments' ),
|
||||
'pt' => __( 'Portuguese', 'woocommerce-paypal-payments' ),
|
||||
'ru' => __( 'Russian', 'woocommerce-paypal-payments' ),
|
||||
'sr' => __( 'Serbian', 'woocommerce-paypal-payments' ),
|
||||
'sk' => __( 'Slovak', 'woocommerce-paypal-payments' ),
|
||||
'sl' => __( 'Slovenian', 'woocommerce-paypal-payments' ),
|
||||
'es' => __( 'Spanish', 'woocommerce-paypal-payments' ),
|
||||
'sv' => __( 'Swedish', 'woocommerce-paypal-payments' ),
|
||||
'th' => __( 'Thai', 'woocommerce-paypal-payments' ),
|
||||
'tr' => __( 'Turkish', 'woocommerce-paypal-payments' ),
|
||||
'uk' => __( 'Ukrainian', 'woocommerce-paypal-payments' ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue