Skip Navigation

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

Problem:
If you're trying to export your site content in English to provide to a translation company, but the XLIFF file contains already translated content instead of just English, even after cancelling and reopening the translation jobs.
Solution:
We recommend the following workaround to ensure the XLIFF export contains only the original English content:
1. Ensure you back up your database and website before making any changes.
2. Edit the file

wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php

.
3. Around line 378, replace the code:

$translation_unit['target'] = array( 'content' => $field_data_translated );

with:

$translation_unit['target'] = array( 'content' => "" );

This change will set the target content to be empty, like "".
For more information, you can refer to a similar ticket on our forum: https://wpml.org/forums/topic/export-to-xliff-keep-translation-empty/ If this solution doesn't seem relevant to your issue, please don't hesitate to open a new support ticket with us: Contact WPML Support

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 5 replies, has 2 voices.

Last updated by Long Nguyen 1 year, 7 months ago.

Assisted by: Long Nguyen.

Author Posts
November 9, 2023 at 1:36 pm #14767541

lyndsayP-2

I am trying to export the site content in English to provide to our clients chosen translation company. When testing the translations, the company provided some pseudo-translations for me to test. I tested these and they worked okay so the company asked for the exports again in English.

When I export the pages, the XLIFF contains the pseudo-translated content instead of just English.

This is after cancelling the translation jobs and re-opening the jobs and exporting to XLIFF.

November 13, 2023 at 8:13 am #14785961

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Lyndsay,

Thank you for contacting WPML support, I'd be happy to help you with this issue.

Please follow some steps below and see if it helps:
1. Make a small change to the page in English > Save changes.
2. Go to WPML > Translation Management > Send the page to translation.
3. Go to WPML > Translations > Export the job to translate the page to an XLIFF file.

If it doesn't help, please let me know the page URL and share the XLIFF file after you follow 3 steps above.

Look forward to your reply.
Thanks

November 13, 2023 at 9:52 am #14786951

lyndsayP-2

Hi Long,

I think this is due to translation memory. I think the pseudotranslations have been saved to translation memory, so when the page are being exported the pseudotranslated content is still there. However, the translation team just want the exports in English.

Would it be possible for you clear the translation memory?

November 13, 2023 at 10:19 am #14787249

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I understand the issue. Currently, there isn't an option to remove the translated content in the XLIFF file. You can follow the workaround below to remove it:

❌ IMPORTANT: Please backup your database and website before proceeding ❌
- Edit the file wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php
- Around line 378, change the code:

$translation_unit['target']                 = array( 'content' => $field_data_translated );

to:

$translation_unit['target']                 = array( 'content' => "" );

This will essentially make the target to be like "<target><![CDATA[]]></target>".

Refer to this ticket https://wpml.org/forums/topic/export-to-xliff-keep-translation-empty/

Look forward to your reply.
Thanks

November 13, 2023 at 11:17 am #14787759

lyndsayP-2

I can try this to see if I can the exports out correctly but any changes to the plguin files will be overwritten when its updated correct?

November 14, 2023 at 2:15 am #14793191

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Yes, it is a quick workaround for this case. The code will be overridden after updating WPML to the new version. You can keep using that workaround until there is an option for this.
Also, I think the translated content in the XLIFF file won't impact the translation process. You or the company can re-translate the content as well.

I hope I was helpful. Don't hesitate to ask if you find any problem along the way, I'll gladly help you.