Skip Navigation

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

Problem:
You are trying to translate content on your site, but the translation process is stuck and the changes cannot be seen on the website.
Solution:
We’ve investigated the issue affecting your translation jobs and identified the root cause.

The problem appears to be related to your server’s character encoding settings. Specifically, it looks like the server’s locale is not explicitly set, and it defaults to an older encoding format (ISO-8859-1) instead of the required UTF-8 encoding. UTF-8 is essential for correctly handling Chinese characters.

As a result, when a string such as 圖示清單:文字 (encoded in UTF-8) is processed using the PHP function ucwords, the encoding unexpectedly switches to ISO-8859-1. This causes issues in our logic when generating the XLIFF files used to submit translation jobs. Essentially, this encoding mismatch leads to corrupted data in the translation files, which then prevents translation jobs from being processed correctly and causes them to get stuck (specifically in status 6).

The XLIFF file being generated on your server is improperly encoded with ISO-8859-1.

This leads to corrupted translation units, with the file being abruptly cut off.

The issue stems from the labelize() function in the WPML plugin, which uses ucwords()—a function not suitable for non-ASCII characters like Chinese.

Workaround solution :

We’ve modified our internal utility function to use mb_convert_case() instead of ucwords(), which correctly handles UTF-8 encoding. This change resolves the issue on your site, allowing translation jobs to complete successfully.

Here’s the updated function. Please note that this change was made directly within the WPML plugin files (sitepress-multilingual-cms/classes/utilities/Labels.php)

From :

public static function labelize( $string ) {
        return ucwords(
            strtr(
                $string,
                [
                    '-' => ' ',
                    '_' => ' ',
                ]
                )
            );
    }

To :

public static function labelize( $string ) {
    return mb_convert_case(
        strtr(
            $string,
            [
                '-' => ' ',
                '_' => ' ',
            ]
        ),
        MB_CASE_TITLE,
        'UTF-8'
    );
}

Anyway, our developers have fixed this and an update will be available in the next release.

Please note that the solution provided might be outdated or not applicable to your specific case. We highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.

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

Last updated by cindyC-2 3 days, 10 hours ago.

Assisted by: Kor.

Author Posts
March 17, 2025 at 3:03 pm #16825961

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your patience. I've downloaded the site and I've shared it with our 2nd Tier Support. I will come back to you once I've feedback.

March 18, 2025 at 6:02 am #16827837

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thank you for your patience. Our 2nd Tier Support has provided feedback and they are requesting your permission to directly access your production site. If you agree, please ensure you have backed up everything and inform us so we can proceed with thorough troubleshooting. Please be aware that we may need to deactivate plugins/themes and install third-party plugins if necessary to resolve the issue. Kindly confirm if you authorize us to proceed.

March 19, 2025 at 1:33 am #16833006

cindyC-2

Thank you so much for helping. I have backed up everything. You can access my production site directly. Once you have fixed the issue, please share the result with me. Thanks again.

March 19, 2025 at 5:42 am #16833216

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply. I've shared your feedback with our 2nd Tier Support. I will get back to you once I've feedback.

March 21, 2025 at 8:47 am #16843176

cindyC-2

Thank you. Looking forward for further updates.

March 24, 2025 at 4:31 pm #16853310

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your patience.

I have feedback from our 2nd Tier Support and this is what they mentioned.

We’ve investigated the issue affecting your translation jobs and identified the root cause.

The problem appears to be related to your server’s character encoding settings. Specifically, it looks like the server’s locale is not explicitly set, and it defaults to an older encoding format (ISO-8859-1) instead of the required UTF-8 encoding. UTF-8 is essential for correctly handling Chinese characters.

As a result, when a string such as 圖示清單:文字 (encoded in UTF-8) is processed using the PHP function ucwords, the encoding unexpectedly switches to ISO-8859-1. This causes issues in our logic when generating the XLIFF files used to submit translation jobs. Essentially, this encoding mismatch leads to corrupted data in the translation files, which then prevents translation jobs from being processed correctly and causes them to get stuck (specifically in status 6).

The XLIFF file being generated on your server is improperly encoded with ISO-8859-1.

This leads to corrupted translation units, with the file being abruptly cut off.

The issue stems from the labelize() function in the WPML plugin, which uses ucwords()—a function not suitable for non-ASCII characters like Chinese.

Workaround solution :

We’ve modified our internal utility function to use mb_convert_case() instead of ucwords(), which correctly handles UTF-8 encoding. This change resolves the issue on your site, allowing translation jobs to complete successfully.

Here’s the updated function. Please note that this change was made directly within the WPML plugin files (sitepress-multilingual-cms/classes/utilities/Labels.php)

From :

public static function labelize( $string ) {
		return ucwords(
			strtr(
				$string,
				[
					'-' => ' ',
					'_' => ' ',
				]
				)
			);
	}

To :

public static function labelize( $string ) {
	return mb_convert_case(
		strtr(
			$string,
			[
				'-' => ' ',
				'_' => ' ',
			]
		),
		MB_CASE_TITLE,
		'UTF-8'
	);
}

Anyway, our developers have fixed this and an update will be available in the next release.

March 26, 2025 at 9:50 am #16861414

cindyC-2

Thank you so much for helping to resolve this issue. I have tested it, and the translation has been successfully processed. Thanks again, and I will close this ticket.