And I got it. What was missing was re-loading the text domain for WooCommerce, that was loaded with the current locale at initialization:
// set the current locale and send email with it active
unload_textdomain('woocommerce');
setlocale(LC_ALL, $new_locale);
global $q_config, $locale, $woocommerce;
$locale = $new_locale;
$q_config['language'] = substr($new_locale, 0, 2);
$woocommerce->load_plugin_textdomain();
global $wc_cle_wc_email;
$wc_cle_wc_email->customer_completed_order($order_id);
// set the old locale back
unload_textdomain('woocommerce');
$q_config['language'] = substr($old_locale, 0, 2);
$locale = $old_locale;
setlocale(LC_ALL, $old_locale);
$woocommerce->load_plugin_textdomain();
Some of the calls setting the locale variables are probably redundant and/or simply unnecessary, but this works.
Related Posts:
- Disable qTranslate by post type in admin + disable per page / post ID on front-end [closed]
- Qtranslate displays empty categories with get_categories()
- Custom values are not translated
- titles in recent posts appear together in all languages with qtranslate
- Plugin translations problem
- How to set a custom title per language?
- How to enable qTranslate languages tabs in custom plugin page
- qTranslate conflicts with SEO-plugins [closed]
- Multi language site [closed]
- How to merge two .PO language files?
- qTranslate remove default directory from link
- How can i change the texts of plugin (created by me) in wordpress admin?
- How to change Header image depending on language [closed]
- Translating Website
- qTranslate‑X is not translating all shortcodes
- Disable plugin / plugin action via theme
- How would you require and automatically download dependent plugins?
- Change the path where wordpress plugins are uploaded
- Add section (add_settings_section) to a custom page (add_submenu_page)
- How to override shortcodes.php core file?
- Custom Widget Creating PHP Exception When Placed In Its Own PHP File
- How to set value/term of a Woocommerce attribute text field in admin panel?
- How does WooCommerce display a custom comment_type in Comment Admin?
- WordPress PHP plugin – Settings page error
- How to fork a plugin to avoid updates after modifications?
- How to display public user profile with 2 additional fields? (GitHub source code included)
- How to limit WordPress pages during updates?
- ajax front-end increment views on click
- WordPress converting my code
- Plugin to list active plugins across networked sites
- Can you limit the memory usage of a particular plugin?
- Scope for PHP Variables Assigned in functions.php or a plugin
- How to make a custom field as an editor in wordpress?
- Gutenberg: How to refresh ServerSideRender with useSelect and AsyncModeProvider true?
- Adding custom code to a WordPress site
- How to remove addthis from my default template
- get_post_type() and WP_QUERY issue
- How do I display only the latest post on my home page, while maintaining proper plugin hooks?
- Python with wordpress plugin
- How to remove plug in styles for WPForms Lite [closed]
- How to find wordpress db schema changes when upgrading from 4.9 to 5.2
- Passing an array from shortcode-function to filter-function
- Plugin update failed – ‘Installation failed: 504 Gateway Time-out 504 Gateway Time-out nginx/1.15.8’ error message
- WP_Async_Task doesn’t appear to be running asynchronously
- How do I go back to wordpress 3.5
- add_action in a custom plugin
- Add custom text color WordPress 3.9 TinyMCE 4 Visual editor
- ACF: post query, hide duplicate values [closed]
- WordPress Jquery UI Spinner
- How to customize a plugin?
- How to replace website?
- How can I modify admin bar only if my plugin is loaded
- Proper way to use plugin functions in functions.php
- Is there a plugin to turn comments into structured reviews [closed]
- Adding custom meta boxes to specified custom post type
- How do I make reusable content blocks for header and footer when using WordPress headless with another front-end?
- How do I make a shortcode to display the shop name on Dokan?
- Remove Pagination for Product Category Pages WooCommerce
- Is there a plugin or a way in the wordpress that would let us have different versions of a post or page accessibe to users?
- Automatic WordPress Clone Backup
- Adding a simple Javascript file with a plugin
- Can’t Install/Upgrade Plugins Through WordPress
- Get post content from outside the loop with plugin shortcode usability
- Adding option values as an array using a multi selectable select box
- Example for use tinymce in wordpress 3.5.1?
- Dynamic Image Replacement through call rail phone call tracking plugins in wordpress
- Advanced custom fields and Slideshow gallery desn’t work together? [closed]
- How could I fix the lowercase problem in nextgen gallery? [closed]
- Listing all sidebars
- Load CSS before Theme CSS
- WordPress Media Library Folders + Custom Linux Server Hosting
- How does the WP repository determine that two plugins are the same when counting active installs?
- Need to edit author permissions | custom taxonomy
- Custom Logo Link WordPress
- WP Import All Multiple Dynamic Link Imports
- admin_notices show after load completed
- Optimise wordpress database using SQL after deleting registered images from Media Folder
- is there a way to display product gallery images via cdn
- Changing the Default New User Notification Email
- WP Fastest Cache -> Render Blocking Js -> Exclude Js Sources
- function post to trash problem
- how to add a hidden type input to wp admin login form programmatically
- save short-code in my custom plugin settings problem missed something
- Uploading website to live causing problems to plug-in and layout
- save multi-select input using update_option for plugin
- Capture Recaptcha fail event on Contact Form 7
- Returning incorrect $post->ID after installing plugin
- Plugin: Translated plugin is “not translated”
- How can I share my wordpress site with a friend?
- wp_schedule_event function reference
- Users Ultra: Hide asterisk for required registration fields?
- Retrive images from the_content()
- Disqus plugin outputs script as literal text
- Multi-step, live updating search
- Turning Existing Eccommerce Site into Multi-SIte
- Woocommerce Emails not being sent [closed]
- Display HTML5 jQuery Audio Player On Front Page
- Plugin Option Fire Custom Function After Save
- My wp_update_nav_menu action is firing twice
- View Version Details” on Plugin update shows “Plugin not found