• Resolved rqcmt

    (@rqcmt)


    Hello,

    I’m currently using WordPress 6.8.1 with Easy Digital Downloads version 3.4.0, and my site language is set to Japanese.

    Under the exact same conditions—same user (admin), same product, same workflow—I’m seeing that the emails sent by EDD (such as Purchase Receipt and New download purchase) are sometimes in Japanese and sometimes in English.

    All plugins, themes, and translation files are up to date. Nothing has changed between these tests.

    This kind of behavior—where email language randomly switches despite identical conditions—does not seem like expected or reasonable behavior.
    Could it be that the locale is not properly initialized at the time the email is generated, and that EDD is sending emails without explicitly calling switch_to_locale()?

    From what I can tell, this might allow get_locale() or get_user_locale() to return inconsistent results depending on the execution context.

    Could you please confirm whether this is a known issue, or if there’s any protection in place to ensure consistent localization during email sending?

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Mihai Joldis

    (@misulicus)

    Hey @rqcmt

    After doing some troubleshooting on our end, we were able to replicate the issue. The dev team has already logged a bug report for this and will try to have a fix in the next EDD release.

    If I may ask, can you please let us know if you are using multiple languages on the website? If the site is only set to use the Japanese language, can you tell us if the actual email contents inside EDD are saved in English or Japanese?

    • This reply was modified 11 months, 1 week ago by Mihai Joldis.
    Thread Starter rqcmt

    (@rqcmt)

    Hi @misulicus.

    I’m currently testing under two separate sites with the same environment and Japanese as the site language.

    Site A
     → Email templates are in Japanese (default, unmodified).
     → Emails are consistently sent in Japanese.

    Site B
     → Email templates are in English (default, unmodified).
     → Emails are randomly sent in Japanese or English, even under identical conditions (same user, same product, same flow).

    On Site B, the site language was once temporarily switched to English after installing EDD, and later reverted to Japanese.
    Whether this affects the behavior is unclear, but the inconsistency persists.

    Plugin Contributor Mihai Joldis

    (@misulicus)

    Thank you for the additional data!

    The Dev team has logged an issue to fix this but for now, what you can do, if you wish, is to disable the Deferred Actions feature on the Checkout page so that the emails will be sent during the Checkout process.

    By default, EDD uses a Cron event that fires a few seconds AFTER an order is completed so that the Checkout page loading times are much lower. If you disable this feature via the code snippet below, the emails should be sent in the correct language as it will be done during the Checkout process itself.

    The code snippet is:

    add_filter( 'edd_use_after_payment_actions', '__return_false' );

    You can add that to your functions.php file in the theme or using a custom plugin.

    Thread Starter rqcmt

    (@rqcmt)

    Thanks for the information. I’ll keep that workaround in mind for now, and I’m looking forward to the fix in an upcoming version update.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Email language randomly switches between Japanese and English under identical co’ is closed to new replies.