Support » Plugin: Translate Multilingual sites - TranslatePress » Woocommerce emails in user language

  • Resolved walpap

    (@walpap)


    Hi

    Im using your plugin with woocommerce and it works well in the front end.
    Also, it shows my custom translated strings along with the woocommerce default .PO translations.
    But when a customer makes an order he/she receive the email of new order in the wordpress default language and not in the language he/she was seeing in the frontend.

    So, I read in other support posts that you say custom translated strings are not translated from the customizer, BUT what happen with the original/default translations?

    Is it me only? Maybe I have something misconfigured? Or your plugin sends emails only in one language email?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter walpap

    (@walpap)

    I mean.. when the users are browsing the website in their language, all woocommerce texts are showing in the right language. I didnt have to translate this thexts, because Translatepress takes de .PO translation of the user selected language and shows it correctly.

    The problem is with the emails.

    Lets say I have WordPress default language as English.
    And I add 3 languages: French, Chinese, Spanish.
    The frontend works flawlessly but all the emails are being sent in english!

    Thanks for your help

    • This reply was modified 3 months, 3 weeks ago by walpap.
    Plugin Support Alex

    (@alexcozmoslabs)

    The WooCommerce emails are actual templates (like theme files) so it means you can translate whatever is localized using gettext in them. https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
    Our plugin doesn’t yet detects these strings because they are not visible in the front-end, only processed. The good new is that most languages already have these translated properly.

    Alternatively, you can also use LocoTranslate in order to translate these strings.

    A side note to take into account: while emails that get sent after a user action are translated correctly, out of order emails like reminders (if you use subscriptions) will always be sent in the default language as we don’t store the user language in order to know in what language we should send the email.

    In order to translate an email that you customize in the WordPress admin, you can use the Conditional Shortcode https://translatepress.com/docs/translation-shortcode/
    You wrap the content for every language using the right shortcode and only the correct part will be emailed to the user.
    Here’s an example of another plugin that has a similar email: https://translatepress.com/how-to-translate/charitable-plugin/ (scroll down to the bottom)

    Thread Starter walpap

    (@walpap)

    Hello

    I think I was clear when I said that languages are well translated in each language.
    Of course everybody knows that WordPress has the original english and spanish translations of Woocommerce perfectly implemented with .po files without the need of using Loco Translate.

    So, let’s say I install WordPress + Woocommerce without TranslatePress installed.
    Then if I go to WordPress Settings and choose English as main language, everything in Woocommerce would show in english for everyone, including order emails, right?
    The same will happen if I choose Spanish as main language. That is the normal behavior of WordPress + Woocommerce.

    Then, if I install TranslatePress and choose Spanish as main language and English as secondary language, every woocommerce string in the front end will be shown in spanish or english depending on the language chosen by the user. This works like this by default without making any custom translation, because translations are being taken from the .po files, right?

    Ok, until that moment everything works as it should BUT not the emails part.
    As I said in my first post, if I have set Spanish as main language in WordPress settings and the user selects English as frontend language, he/she will see everything in English but every email (including the first new order email or the next ones) will be sent in SPANISH!

    I’m not talking about manually or custom translated strings. I’m talking about original, untouched .po woocommerce files.

    You say that “the good news is that most languages already have these translated properly”. Yeah! I agree with that. That’s what I’m saying. But it’s not working that way! The emails are always being sent in the main wordpress language despite the language selected by the user in the frontend. I hope you understand now.

    I need to know if this is a limitation of your plugin, or if it’s there some kind of solution, because I cannot send the same language email for every language and I don’t want to edit every woocommerce email template for every language manually, that would be crazy.

    Thanks in advance for your help.

    • This reply was modified 3 months, 1 week ago by walpap.
    • This reply was modified 3 months, 1 week ago by walpap. Reason: spelling

    @walpap did you find a solution to this? I also simply cannot consider sending emails in one default language. The conditional shortcode will be useful for a few cases, but won’t do anything for automated system emails.

    • This reply was modified 1 month, 3 weeks ago by nickchomey.
    Thread Starter walpap

    (@walpap)

    Hi @nickchomey

    Finally after some tests I realized that the first email of “thanks for your order” is sent in the correct language.
    The problem is with the other emails, such as order cancelled or completed.
    They are being sent in the default language, and I didn’t find any solution to that.

    • This reply was modified 1 month, 3 weeks ago by walpap.

    There is actually a solution for that:
    https://gist.github.com/dartrax/85b3ab77b8210e92cc50e1b68de83c73

    With this additional code, the user language will be stored in the order metadata and the “out of order” emails will be sent in the correct language.

    – dartrax

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.