Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem: I need to translate some non-standard WooCommerce email added by a WooCommerce extension Solution: To solve this you can search and register the strings of the custom emails (Subject, heading, and body) in WPML -> String Translation -> Translate texts in admin screens. Relevant Documentation: https://wpml.org/documentation/getting-started-guide/translating-theme-options/

0% of people find this useful.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 13 replies, has 2 voices.

Last updated by Jelle 2 years, 2 months ago.

Assigned support staff: Vincenzo.

Author Posts
July 6, 2018 at 1:13 pm #2470920

Jelle

Hi,

I'm trying to translate the WooCommerce emails. But i can't find the method / location to do so. See: hidden link I need "Subject", "heading" and "body" translated.

Site: hidden link

Thanks!

July 6, 2018 at 1:46 pm #2471031

Jelle

Also, i have overridden a default template: jupiter-child/woocommerce/emails/customer-order-status-email.php. I want to translate the custom text i added manually by using:
if (get_locale() == 'en_US'){}

But that doesn't seem to work. How do you advise to handle this?

Thanks

July 6, 2018 at 3:17 pm #2471250

Jelle

Scanning & following these steps didn't work either:
- Go to WPML - Theme & Plugins Localizations
- Select WooCommerce plugin and scan
- Go to WPML - String Translations

July 9, 2018 at 12:07 pm #2476144

Jelle

Could somebody help us out?

July 9, 2018 at 3:47 pm #2477067

Vincenzo
Supporter

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello, thank you for contacting WPML Support!
I will take care of your ticket.

I am sorry for the delay in answering. This is not usual in this forum. Reply time will be shorter from now.

From your screenshot, it seems like a custom email.

1. Can you please tell me if this issue is reproducible also with the standard WooCommerce Emails?

2. Can you please tell me which version of the theme is installed?

3. Did you try to update the theme to the latest version?

4. As the email templates are in the theme's folder, di you try to scan the theme for strings?

5. If you are adding text in the custom template, please add it inside GetTexts calls as explained here:
https://wpml.org/faq/language-setup/
https://wpml.org/documentation/support/translating-the-theme-you-created/
https://code.tutsplus.com/tutorials/internationalizing-wordpress-projects-the-introduction--cms-26636

You may also try this code:

if(ICL_LANGUAGE_CODE=='en'){
// your code here;
 }

Thank you

July 10, 2018 at 12:42 pm #2481217

Jelle

Hi Vincenzo,

Thanks for your reply.

"From your screenshot, it seems like a custom email."
> Yes, 2 templates are made custom. But these aren't the only issue.

Also these email custom order status emails fields don't have any translation options:
Translation dropdown:
hidden link

No translation dropdown:
hidden link

1. Nope, see above, the problem is only with custom order status emails.

2. Latest version Jupiter theme installed.

3. Yes, of course. Plugins too.

4. Yeah, just asked WPML to scan everything, didn't help.

5. Ok, will try that to.

Thanks!

July 10, 2018 at 1:10 pm #2481476

Jelle

I tried:

if( ICL_LANGUAGE_CODE=='en' ){
Eng TEXT
}elseif ( ICL_LANGUAGE_CODE=='nl' ){
Dutch TEXT
}

Order WPML lang is 'en' > hidden link

Still Dutch text is showing in the email... strange!

I prefer using this method above: <?php _e('Links','theme-text-domain'); ?> in the emails as that is easier maintainable for us and should work as well.

July 10, 2018 at 6:26 pm #2483568

Vincenzo
Supporter

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello,

thank you for your detailed answer.

Yes, the language drop-down is available only for the default WooCommerce Emails.

1. Can you please search for the strings of the custom emails (Subject, heading, and body) in WPML -> String Translation -> Translate texts in admin screens?
See: https://wpml.org/documentation/getting-started-guide/translating-theme-options/

2. What is the selected language for the user that receives those emails?
- You can check it in the user's profile

3. Can you please tell me if using the GetText calls as shown in your last answer fixed the issue?

Thank you

July 11, 2018 at 9:31 am #2485815

Jelle

"Yes, the language drop-down is available only for the default WooCommerce Emails."
> Hmm very unfortunate.

1. FOUND THEM!! hidden link
But can't find them in the string translations after adding them: hidden link
Aaaah!

2. Default language is ENGLISH, so that is strange to, as the email texts defaults to Dutch: hidden link (Using: if( ICL_LANGUAGE_CODE=='en' ){})

3. Not using GetText yet in the custom email templates for the Order status manager emails as i think if (get_locale() == 'en_US'){} should work as it does for the native woocommerce email (of which we also made custom email template) ORDER RECEIVED.

The plugin developer says there (was) compatibility:
https://wpml.org/documentation/plugins-compatibility/?wpv_view_count=119945&dev=0&wpv_post_search=order+status+manager&wpv_filter_submit=Search

Thanks!

July 11, 2018 at 12:26 pm #2486601

Vincenzo
Supporter

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello,

to be able to add strings from the admin texts page, it is needed to increase the MaxInputVars PHP value.
Can you please try to edit the php.ini file to increase the MaxInputVars from 1000 to 30000?

max_input_vars = 30000

Thank you

July 11, 2018 at 12:59 pm #2486724

Jelle

Done: hidden link

Re-added: hidden link

No result: hidden link

July 11, 2018 at 1:02 pm #2486733

Jelle

Ah, wait, the strings show now in the string translations section.

Only the custom email templates left.

July 12, 2018 at 10:44 am #2489296

Vincenzo
Supporter

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello,

I'm glad to know that the main issue was solved.
For the second issue, I think that some custom coding is required as maybe you need to perform the "if" check on the order of the language instead of the current language.

However, for support rules, we are able to handle only one issue per ticket.
May I ask you to open a new ticket?
You can do it from here: https://wpml.org/forums/forum/english-support/
This helps us to bring you a better service and also help other users with similar problems to find solutions when searching the forum.

Thank you

July 12, 2018 at 2:26 pm #2489918

Jelle

"I'm glad to know that the main issue was solved."
> Same here!

"For the second issue, I think that some custom coding is required as maybe you need to perform the "if" check on the order of the language instead of the current language."
> Agree, did that and it works well now 🙂