Skip Navigation

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.

Tagged: 

This topic contains 22 replies, has 2 voices.

Last updated by ludekC-3 8 months ago.

Assisted by: Andreas W..

Author Posts
May 6, 2024 at 3:02 pm #15598174

ludekC-3

Hey brave WPML supporter!

We have an e-shop with three languages:
Czech (default)
Polish
Slovak

Support for multiple languages is provided by WPML.

We also use PDF Invoices & Packing Slips for WooCommerce by WP Overnight (https://wpml.org/plugin/woocommerce-pdf-invoices-and-packing-slips-professional/)

We have also modified the PDF template files in the child template to add some extra fields.
We have all the strings in the templates correctly specified using the _e() function with the text domain specified. All strings are translated.

Now the problem: when we generate a PDF for a language other than the default language, e.g. Polish, some strings are in Czech, so the languages are mixed up.

1. This affects all the strings we have in the child template for PDF. We have listed them in the source code in English, they get translated to PDF, but to the wrong language (Czech instead of Polish).

2. This affects also strings used in the PDF template customiser.

See screenshot (PDF ss.png), yellow untranslated strings from template, red untranslated strings from customizer.
Not marked strings are OK.

I reported this bug to the WP Overnight support and we found out, that those badly translated string are always in the language set in the user profile. So WP Overnight support asked me to contact you, because it looks more like a WPML bug.

E.g.
- If I set my profile to Czech and then generate PDF for Polish order, in the PDF are mixed Polish and Czech strings (are strings should be in Polish)
- If I set my profile to Slovak and then generate PDF for Polish order, in the PDF are mixed Polish and Slovak strings (are strings should be in Polish)
- If I set my profile to English and then generate PDF for Polish order, all string are correctly in Polish language

These erroneous PDF documents with mixed languages are also sent to our clients when they are generated based on a change of order status (final invoice when goods are shipped). In this case, it seems that it does not depend on the language that is set in the profile of the registered customer or the order, but on the language that is set by the administrator changing the order status.

Thank you for checking and have a great day.
Ludek

PDF ss 1.png
child-template.png
image (1).png
May 8, 2024 at 1:48 am #15604022

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello Ludek,

Indeed, user e-mails are supposed to use the language declared inside the user's profile.

An issue might be, that your user has "Site default language" set as profile language which leads to a mix of strings in the site's default language or even admin strings if an admin forces the email to be sent to the client.

This said, a user with Polish as profile language, should receive emails in Polish.

is this the case?

Best regards
Andreas

May 8, 2024 at 7:04 am #15604514

ludekC-3

Hey Andreas,

thank you for the reply.

This is not the case

- Majority of our customers doesn't have even user profile, they are buying without registration.
- Email attachments (email body itself is OK) are send partly in correct language a partly translated to a wrong language. To the language set in administrator profile, not user.
- Non translated strings comes from child template or PDF customiser.

Please read my report carefully and letm me know if you need further assistance from my side.

Regards,
Ludek

May 8, 2024 at 5:51 pm #15607494

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

If a user is not registered and has no user language inside WordPress or a dedicated usermeta custom field with a language value assigned, then WordPress will always use the site's default language.

Recent feedback from our Compatibility Team regarding a similar issue:

Emails should be sent in the user language (the one set in Users > Your Profile) and not in the page language as most people expect.

1) Create a user
2) Go to Users > Your Profile.
3) Change the user's language.
4) Trigger the email. It will be sent in the specified language of the user's profile.

May 8, 2024 at 5:52 pm #15607495

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I would like to offer to have a closer look at the problem and request temporary access (wp-admin and FTP) to the website to investigate this issue further.

You can find the required fields below the comment section when you log in to leave the next reply. The information you provide is private, which means only you and I can see and access it.

IMPORTANT
Please be sure to make a backup copy of the website and database before allowing us access.
If you can't see the wp-admin / FTP fields, your post and website credentials are set as PUBLIC. DO NOT publish the data unless you see the required wp-admin / FTP fields.

I may have to install a plugin called "All In One WP Migration" to make a copy of the website where I can investigate the issue further.

However, I would also be very grateful if you could provide a staging site or copy of the website from your server yourself for this purpose.

If you have any questions about creating such a staging site, you can consult your hosting provider. Just take note that WPML should be registered on this site again.

If you are unable to provide such a copy of the site for testing, please let me know on this ticket.

The private response form looks like this:
hidden link

Next time you reply, click "I still need assistance."

Video:
hidden link

Please note that we are obliged to request this information individually on each ticket. We may not access any access information not specifically submitted on this ticket in the private response form.

Best regards
Andreas

May 14, 2024 at 3:41 pm #15626348

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Your site's default language is Czech which is why it would be expected and recommended to use Czech as the site's default language for your templates.

I do understand, right that this is a working solution in this case.

If so, then I would kindly like to ask you to use the site's default language for your templates.

May 14, 2024 at 4:47 pm #15626529

ludekC-3

Hey Andreas,

Using the default site language in templates is a workable solution, but it only addresses half of the problem. Some strings in the PDFs remain untranslated. Please refer to my previous message for a detailed description.

May 14, 2024 at 5:36 pm #15626644

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Please do not use any default values at WooCommerce > PDF Invoices Customizer, as they might come programmatically in English.

Make sure all fields have a value.

Then go to WPML > String Translation > Translate texts in admin strings and search for each string. Add each string to String Translation and translate them.

Example:

Search for "Sazba DPH" and you will find:

[wpo_wcpdf_editor_settings][fields_invoice_columns][4]label
[wpo_wcpdf_editor_settings][fields_proforma_columns][3]label

If you change the order of the fields inside the customizer or change their values you might need to delete the registered admin_text strings and register them again.

If this will not solve the issue, please let me know.

May 22, 2024 at 3:11 pm #15659029

ludekC-3

Hey Andreas,

thanks, I partly solved the issue, however strings marked in the attachement remains untranslated.

Yellow ones: no way how to add custom labels for this fields
Purple one: Untranslated in the PDF, but added and translated in the String Translation as you advised, strange...

wpml-pdf.png
May 23, 2024 at 12:55 am #15659964

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

I am about to take a copy of the site using the plugin "All In One WP Migration" in order to run some tests on localhost. I hope you agree with that?

Once I am done with those tests I will get in contact with you again.

May 24, 2024 at 12:07 am #15665346

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

I am writing to let you know that I am still working on getting a copy of your site to run.

Due to the huge size of the database, the migration is still not completed.

May 25, 2024 at 3:01 am #15669578

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I created a test order on your live site today.

hidden link

I used the Polish shop page.

See attached the created PDF. Now, I have to admit that I do not speak any of the languages used on the website, but this PDF looks correct to me.

If not, please provide me examples from this PDF.

Best regards
Andreas

PDF.jpg
May 25, 2024 at 7:06 pm #15670438

ludekC-3

Hey Andreas,

thanks for your tests.

The document you share here is fine, I found no error on it.

However, when I look at the mail log, I see that you received a PDF by email, but it contains errors.
See the file: hidden link

If you are going to create another test order, please put to your name preffix TEST.

If you need my assistance let me know, I can export DB at the server side for example.

Regards,
Ludek

wpml-pdf2.png
May 26, 2024 at 4:09 am #15670585

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello Ludek,

I sadly do have a really difficult time to test on a local copyof your site, as the migration process took very long and failed a couple times. Now, that I got a local copy running I do get many 500 error for which I do not really the the reason, as it is not generating any debug.log.

Would it be possible for you to install PDF Invoices & Packing Slips incl. all Add-ons on a test site which I would like to provide, so that we can try to recreate the issue there?

Best regards
Andreas

June 4, 2024 at 2:37 pm #15702547

ludekC-3

Hi Andreas,

sorry for the delay, I was on vacation to recharge my batteries.

I'm sorry you're having so much trouble with testing. When the debug.log is not generated the Query Monitor plugin works well for me, it prints the debug log to the screen.

For us, in the meantime, we decided to migrate the invoicing completely out of Woo and invoice directly in the accounting system. So I suggest not to worry about this problem any further.

But if you want to get to the bottom of it, I can try to do the staging on our server, which will make it much easier to migrate the data. What do you say?

Thanks for your help and have a good day.