From 36571fc14097ccfd9ecd2c0b1bfc4fdb3def95e7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 25 Oct 2024 08:42:32 -0700 Subject: [PATCH] Cherry pick 52199 into release/9.4 (#52340) * Early translation mitigation (#52199) * Improve handling (WP 6.7+) when translations are inadvertently loaded early. * Changelog. * Prep for cherry pick 52199 --------- Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com> Co-authored-by: WooCommerce Bot --- plugins/woocommerce/includes/class-woocommerce.php | 2 +- plugins/woocommerce/readme.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce/includes/class-woocommerce.php b/plugins/woocommerce/includes/class-woocommerce.php index 85ce78999c1..c566d474bb0 100644 --- a/plugins/woocommerce/includes/class-woocommerce.php +++ b/plugins/woocommerce/includes/class-woocommerce.php @@ -868,7 +868,7 @@ final class WooCommerce { */ $locale = apply_filters( 'plugin_locale', $locale, 'woocommerce' ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingSinceComment - unload_textdomain( 'woocommerce' ); + unload_textdomain( 'woocommerce', true ); load_textdomain( 'woocommerce', WP_LANG_DIR . '/woocommerce/woocommerce-' . $locale . '.mo' ); load_plugin_textdomain( 'woocommerce', false, plugin_basename( dirname( WC_PLUGIN_FILE ) ) . '/i18n/languages' ); } diff --git a/plugins/woocommerce/readme.txt b/plugins/woocommerce/readme.txt index 66005783949..03911537aa8 100644 --- a/plugins/woocommerce/readme.txt +++ b/plugins/woocommerce/readme.txt @@ -173,6 +173,7 @@ WooCommerce comes with some sample data you can use to see how products look; im **WooCommerce** +* Fix - Support situations in which (WooCommerce) translations are inadvertently loaded too early. [#52199](https://github.com/woocommerce/woocommerce/pull/52199) * Fix - Add a retry mechanism to the query to obtain the SKU lock for product creation through the API. [#51735](https://github.com/woocommerce/woocommerce/pull/51735) * Fix - Fix `Error: Failed opening required '.../wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/AI/ProductsSchema.php` fatal error [#51912](https://github.com/woocommerce/woocommerce/pull/51912) * Fix - Resolved fatal error when applying Brands-restricted coupon [#51577](https://github.com/woocommerce/woocommerce/pull/51577)