Translation warning persists in WooCommerce Stripe Gateway 9.4.1
-
Hello team, I hope you’re well.
I’m reaching out regarding the ongoing issue with WooCommerce Stripe Gateway plugin and WordPress 6.7, where translation loading is triggered too early, causing PHP notices:
[23-Apr-2025 18:17:41 UTC] PHP Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the woocommerce-gateway-stripe domain was triggered too early.
I’ve seen that this issue was addressed in GitHub (Issue #3604 – https://github.com/woocommerce/woocommerce-gateway-stripe/issues/3604) and presumably fixed in version 9.4.1. However, I’m still experiencing this issue even after updating to the latest version.
I’ve tried several approaches to fix this locally:
- Changing the hook priority for loading translations
- Adding checks before translation functions are called
- Other standard approaches
What finally worked for me was loading the translation file directly in the global scope at the beginning of the plugin file, before any functions are defined:
// Initialize translations immediately, in the global scope // This runs before any functions or hooks require_once(ABSPATH . 'wp-includes/l10n.php'); // Make sure translation functions are available if (function_exists('load_textdomain')) { load_textdomain(WC_STRIPE_TEXT_DOMAIN, WP_LANG_DIR . '/plugins/woocommerce-gateway-stripe-' . determine_locale() . '.mo'); }While this workaround is effective, I wanted to please check if:
- Is this still considered an open issue by the Stripe Gateway team?
- Would you consider my approach a valid temporary workaround?
- Is there a more recommended way to address this issue?
Thank you for any guidance you can provide.
The page I need help with: [log in to see the link]
The topic ‘Translation warning persists in WooCommerce Stripe Gateway 9.4.1’ is closed to new replies.