• Resolved barthdesigns

    (@barthdesigns)


    Hello,

    How can I change the outgoing emails’ language from the admin’s chosen language to site language?

    The store is located and only sells to Hungary though, so the site language is set to HU. I am the admin and I prefer to use WordPress in EN (US) so I have my own admin user’s language set as EN (US).

    Unfortunately my outgoing emails language to Hungarian users are EN (US).

    The only way I could manage to translate the strings like “Payment method:”, “Subtotal:” etc is to use LOCO and add an EN(US) language and change the strings to Hungarian. Although with any Woo updates it reverts back to the original English.

    I believe there is a solution for this?

    Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Saif

    (@babylon1999)

    Hello @barthdesigns,

    Thank you for reaching out!

    I understand that you want to continue receiving emails in English even though the site’s language is Hungarian, correct?

    According to this guide from TranslatePress, it is possible to achieve this with their plugin: Translating WooCommerce Emails

    I suggest giving it a try.

    Let us know how it goes!

    Thread Starter barthdesigns

    (@barthdesigns)

    Hi there, thanks for the reply!

    Well, not quite!

    I would like that my clients who register and purchase (and receive custom notes, order status updates emails etc.) receive all emails in Hungarian.

    Although my admin language can stay in English.

    Currently admin’s language is associated with the language in which clients do receive their emails, which is not ideal.

    I would not want to install a plugin for this – I have LOCO installed and a way is to add EN-EU language and rewrite original English sentences, words to Hungarian. But not ideal ??

    Hi there @barthdesigns ??

    I would like that my clients who register and purchase (and receive custom notes, order status updates emails etc.) receive all emails in Hungarian.

    Thank you for clarifying further.

    Currently admin’s language is associated with the language in which clients do receive their emails

    That is the default functionality. Correct.

    My recommendation would be:

    • That the site’s language set to HU, in the screen at WordPress > Settings > General
    • Set the current 1st Administrator’s language to HU, also
    • Create a new administrator (or Store Manager) role, and set it to US English, for your daily use

    I’ve just tested, and it appears to be working as you’d like.

    I hope this is helpful! Please let us know if you have any further questions or concerns.

    Thread Starter barthdesigns

    (@barthdesigns)

    Thank you!

    Unfrotunately that seem too complex ??

    I believe I will stay with the solution to use LOCO translate and rewrite those lines/sentences.

    Thanks for the idea though – might help others with the same issue! ??

    Plugin Support Raif D. a11n

    (@rdeari)

    Howdy @barthdesigns!

    That’s indeed a good idea! Otherwise, you can use an extension like AutomateWoo, with that approach you would simply turn off all the default emails and create new emails via workflows – that way you can easily edit the language as well as the design of the emails ??

    I hope this helps! Have a great one!

    Thread Starter barthdesigns

    (@barthdesigns)

    Hello,

    Many thanks, I will take a look!

    Enjoy your weekend! ??

    Plugin Support Kader Ibrahim S. a11n

    (@kaderibrahim)

    Hello @barthdesigns,

    Thank you for getting back. WooCommerce is a highly customisable software with tons of actions and hooks, allowing users to add their own customisations.

    In your case, we can achieve your requirement using custom coding. For example:

    add_filter( 'woocommerce_allow_switching_email_locale', 'wc_child_switch_email_locale', 10, 2 );
    add_filter( 'woocommerce_allow_restoring_email_locale', 'wc_child_switch_email_locale', 10, 2 );
    
    function wc_child_get_email_locale() {
    	return 'en_US';
    }
    
    function wc_switch_to_admin_locale() {
    	global $wp_locale_switcher;
    
    	if ( function_exists( 'switch_to_locale' ) && isset( $wp_locale_switcher ) ) {
    		switch_to_locale( wc_child_get_email_locale() );
    
    		// Filter on plugin_locale so load_plugin_textdomain loads the correct locale.
    		add_filter( 'plugin_locale', 'wc_child_get_email_locale' );
    
    		// Init WC locale.
    		WC()->load_plugin_textdomain();
    	}
    }
    
    function wc_child_switch_email_locale( $switch_email_locale, $email ) {
    	if ( false === $email->is_customer_email() ) {
    		wc_switch_to_admin_locale();
    	} else {
    		wc_restore_locale();
    	}
    	return $switch_email_locale;
    }

    The above code should go into your child theme’s functions.php file. Once added, the above code will set the email locale as en_US only for admin emails. All other customer emails default to the site locale. New Order, Failed Order and Cancelled Order are the only three admin emails and rest are customer emails.

    I hope this helps you. Please note that the above code is only to demonstrate the customisability of WooCommerce. I request you to test it out thoroughly before using it in production.

    Please do not hesitate to try out our AutomateWoo extension, which allows you to quickly build workflows without worrying about writing custom codes.

    Thread Starter barthdesigns

    (@barthdesigns)

    Hi there,

    Many thanks for the kind help!

    I’ve reached the point where I could test the code. Unfortunately it doesn’t work ?? I use DIVI and inserted the code and see no effect. (I see some errors, red “X” icons when pasting the code to ‘Theme customizing” field.)

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @barthdesigns,

    The code provided was meant to be inserted into your child theme’s functions.php file, not in the “Theme Customizing” field. Here’s how you can do this:

    1. Access your site’s files via FTP/cPanel and create a child theme. You can follow the Divi theme’s guide on creating a child theme here: https://help.elegantthemes.com/en/articles/2188070-how-to-make-a-child-theme
    2. Navigate to wp-content/themes/your-child-theme/.
    3. Open the functions.php file.
    4. Paste the provided code at the end of this file.
    5. Save and close the file.

    Please ensure you have a site backup before making changes to your theme files. If you’re not comfortable with this process, I recommend hiring a developer or reaching out to the theme’s support for assistance.

    Let us know how it goes or if you have any other questions.

    Thread Starter barthdesigns

    (@barthdesigns)

    Hello,

    In DIVI theme, this is the place to insert it to functions.php ??

    Never mind, I did use Loco Translate at the end.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Sent out emails in site language (instead of admin)’ is closed to new replies.