Create language map for smart buttons

This commit is contained in:
Narek Zakarian 2023-10-31 16:33:44 +04:00
parent da8f18d8c5
commit 55f89451ea
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
2 changed files with 57 additions and 32 deletions

View file

@ -1424,38 +1424,47 @@ return array(
),
'wcgateway.wp-paypal-locales-map' => static function( ContainerInterface $container ): array {
return array(
'ar' => 'ar_EG',
'arq' => 'ar_EG',
'ary' => 'ar_EG',
'de_AT' => 'de_DE',
'de_CH' => 'de_DE',
'de_CH_informal' => 'de_DE',
'de_DE_formal' => 'de_DE',
'el' => 'el_GR',
'es_AR' => 'es_ES',
'es_CL' => 'es_ES',
'es_CO' => 'es_ES',
'es_CR' => 'es_ES',
'es_DO' => 'es_ES',
'es_GT' => 'es_ES',
'es_HN' => 'es_ES',
'es_MX' => 'es_ES',
'es_PE' => 'es_ES',
'es_PR' => 'es_ES',
'es_ES' => 'es_ES',
'es_UY' => 'es_ES',
'es_VE' => 'es_ES',
'fi' => 'fi_FI',
'fr_BE' => 'fr_FR',
'ja' => 'ja_JP',
'nb_NO' => 'no_NO',
'nn_NO' => 'no_NO',
'nl_BE' => 'nl_NL',
'nl_NL_formal' => 'nl_NL',
'pt_AO' => 'pt_PT',
'pt_PT_ao90' => 'pt_PT',
'th' => 'th_TH',
'zh_SG' => 'zh_CN',
'' => __( 'Browser language', 'woocommerce-paypal-payments' ),
'ar-DZ' => __( 'Arabic (Algeria)', 'woocommerce-paypal-payments' ),
'ar-BH' => __( 'Arabic (Bahrain)', 'woocommerce-paypal-payments' ),
'ar-EG' => __( 'Arabic (Egypt)', 'woocommerce-paypal-payments' ),
'ar-JO' => __( 'Arabic (Jordan)', 'woocommerce-paypal-payments' ),
'ar-KW' => __( 'Arabic (Kuwait)', 'woocommerce-paypal-payments' ),
'ar-MA' => __( 'Arabic (Morocco)', 'woocommerce-paypal-payments' ),
'ar-SA' => __( 'Arabic (Saudi Arabia)', 'woocommerce-paypal-payments' ),
'cs-CZ' => __( 'Czech', 'woocommerce-paypal-payments' ),
'zh-CN' => __( 'Chinese (Simplified)', 'woocommerce-paypal-payments' ),
'zh-HK' => __( 'Chinese (Hong Kong)', 'woocommerce-paypal-payments' ),
'zh-TW' => __( 'Chinese (Traditional)', 'woocommerce-paypal-payments' ),
'da-DK' => __( 'Danish', 'woocommerce-paypal-payments' ),
'nl-NL' => __( 'Dutch', 'woocommerce-paypal-payments' ),
'en-AU' => __( 'English (Australia)', 'woocommerce-paypal-payments' ),
'en-GB' => __( 'English (United Kingdom)', 'woocommerce-paypal-payments' ),
'en-US' => __( 'English (United States)', 'woocommerce-paypal-payments' ),
'fi-FI' => __( 'Finnish', 'woocommerce-paypal-payments' ),
'fr-CA' => __( 'French (Canada)', 'woocommerce-paypal-payments' ),
'fr-FR' => __( 'French (France)', 'woocommerce-paypal-payments' ),
'de-DE' => __( 'German (Germany)', 'woocommerce-paypal-payments' ),
'de-CH' => __( 'German (Switzerland)', 'woocommerce-paypal-payments' ),
'de-AT' => __( 'German (Austria)', 'woocommerce-paypal-payments' ),
'de-LU' => __( 'German (Luxembourg)', 'woocommerce-paypal-payments' ),
'el-GR' => __( 'Greek', 'woocommerce-paypal-payments' ),
'he-IL' => __( 'Hebrew', 'woocommerce-paypal-payments' ),
'hu-HU' => __( 'Hungarian', 'woocommerce-paypal-payments' ),
'id-ID' => __( 'Indonesian', 'woocommerce-paypal-payments' ),
'it-IT' => __( 'Italian', 'woocommerce-paypal-payments' ),
'ja-JP' => __( 'Japanese', 'woocommerce-paypal-payments' ),
'ko-KR' => __( 'Korean', 'woocommerce-paypal-payments' ),
'no-NO' => __( 'Norwegian', 'woocommerce-paypal-payments' ),
'es-ES' => __( 'Spanish (Spain)', 'woocommerce-paypal-payments' ),
'es-MX' => __( 'Spanish (Mexico)', 'woocommerce-paypal-payments' ),
'pl-PL' => __( 'Polish', 'woocommerce-paypal-payments' ),
'pt-BR' => __( 'Portuguese (Brazil)', 'woocommerce-paypal-payments' ),
'pt-PT' => __( 'Portuguese (Portugal)', 'woocommerce-paypal-payments' ),
'ru-RU' => __( 'Russian', 'woocommerce-paypal-payments' ),
'sk-SK' => __( 'Slovak', 'woocommerce-paypal-payments' ),
'sv-SE' => __( 'Swedish', 'woocommerce-paypal-payments' ),
'th-TH' => __( 'Thai', 'woocommerce-paypal-payments' ),
);
},
'wcgateway.paypal-locale' => static function( ContainerInterface $container ): string {

View file

@ -80,6 +80,22 @@ return function ( ContainerInterface $container, array $fields ): array {
'requirements' => array(),
'gateway' => 'paypal',
),
'smart_button_language' => array(
'title' => __( 'Smart Button Language', 'woocommerce-paypal-payments' ),
'type' => 'select',
'desc_tip' => true,
'description' => __(
'The language and region used for the displayed PayPal Smart Buttons. 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' => $container->get('wcgateway.wp-paypal-locales-map'),
'screens' => array( State::STATE_ONBOARDED ),
'gateway' => 'paypal',
'requirements' => array(),
),
// General button styles.
'button_general_layout' => array(
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),