Skip to content

Commit 964f6c0

Browse files
authored
Fix Translations not loaded in admin (UPE / JSON) (#2287)
* Add missing wp_set_script_translations() call after wp_register_script()
1 parent 9d7ae03 commit 964f6c0

4 files changed

+21
-1
lines changed

includes/admin/class-wc-stripe-old-settings-upe-toggle-controller.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ public function upe_toggle_script() {
6969
'is_upe_enabled' => WC_Stripe_Feature_Flags::is_upe_checkout_enabled(),
7070
]
7171
);
72+
wp_set_script_translations(
73+
'woocommerce_stripe_old_settings_upe_toggle',
74+
'woocommerce-gateway-stripe'
75+
);
7276
wp_enqueue_script( 'woocommerce_stripe_old_settings_upe_toggle' );
7377
}
7478
}

includes/admin/class-wc-stripe-payment-gateways-controller.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public function register_payments_scripts() {
4343
$payment_gateways_script_asset['version'],
4444
true
4545
);
46+
wp_set_script_translations(
47+
'woocommerce_stripe_payment_gateways_page',
48+
'woocommerce-gateway-stripe'
49+
);
4650
wp_register_style(
4751
'woocommerce_stripe_payment_gateways_page',
4852
plugins_url( 'build/payment_gateways.css', WC_STRIPE_MAIN_FILE ),

includes/admin/class-wc-stripe-payment-requests-controller.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ public function admin_scripts() {
3333
$asset_metadata['version'],
3434
true
3535
);
36+
wp_set_script_translations(
37+
'wc-stripe-payment-request-settings',
38+
'woocommerce-gateway-stripe'
39+
);
3640
wp_enqueue_script( 'wc-stripe-payment-request-settings' );
3741

3842
wp_register_style(

includes/admin/class-wc-stripe-settings-controller.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,15 @@ public function admin_scripts( $hook_suffix ) {
111111
'is_upe_checkout_enabled' => WC_Stripe_Feature_Flags::is_upe_checkout_enabled(),
112112
'stripe_oauth_url' => $oauth_url,
113113
];
114-
wp_localize_script( 'woocommerce_stripe_admin', 'wc_stripe_settings_params', $params );
114+
wp_localize_script(
115+
'woocommerce_stripe_admin',
116+
'wc_stripe_settings_params',
117+
$params
118+
);
119+
wp_set_script_translations(
120+
'woocommerce_stripe_admin',
121+
'woocommerce-gateway-stripe'
122+
);
115123

116124
wp_enqueue_script( 'woocommerce_stripe_admin' );
117125
wp_enqueue_style( 'woocommerce_stripe_admin' );

0 commit comments

Comments
 (0)