WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.53k stars 1k forks source link

HTML-escaped strings are shown as HTML #11995

Open theimpulson opened 3 months ago

theimpulson commented 3 months ago

Describe the issue

Weblate shows HTML-escaped strings as HTML when translating them. This leads to translators applying/writing HTML tags instead of HTML-escaped tags.

Reference for HTML-escaped strings:

I already tried

Steps to reproduce the behavior

Actual String

<string name="existing_work_profile_help">To manage the existing work profile, navigate to the &lt;b&gt;Work&lt;/b&gt; tab in the launcher</string>

Source: https://github.com/CalyxOS/platform_packages_apps_Bellis/blob/android14/app/src/main/res/values/strings.xml#L18

Weblate

Screenshot 2024-07-03 at 1 41 01 PM

Source: https://hosted.weblate.org/translate/calyxos/platform_packages_apps_Bellis/en/?checksum=017818400dc6c297

Expected behavior

These strings should be shown as it is and/or users should be warned about it.

Screenshots

No response

Exception traceback

No response

How do you run Weblate?

weblate.org service

Weblate versions

No response

Weblate deploy checks

No response

Additional context

No response

theimpulson commented 3 months ago

An alternative would be to show them like that in the UI and when saved keep them escaped like the original string.

nijel commented 3 months ago

I don't think translators should be dealing with this kind of mess, so saving of XML should be turned on only for strings which have XML in the source. Presently, there is independent logic deciding whether to use XML or escape in https://github.com/translate/translate/blob/ae6abd4c8935c0675933eea49eaed7255dca7981/translate/storage/aresource.py#L381-L420

github-actions[bot] commented 3 months ago

The issue you've reported needs to be addressed in the translate-toolkit. Please file the issue there, and include links to any relevant specifications about the formats (if applicable).