-
-
Notifications
You must be signed in to change notification settings - Fork 956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
& in XLIFF does not get unescaped #3081
Comments
update: looks like xliff files imported with a previous version did not have these problems; only components I've created with weblate 3.7.1 |
The XML markup is handled differently for some time, see #490 and related issues. |
as far as I can read out of the issue (and PR), the XLIFF content is now handles as rich source, where no more conversion/escaping is done? But if I remember correctly, there is a need to escape some characters in a XML file (like the ampersand). How could we solve that? |
It should escape the strings when necessary (AFAIR it's when it's not valid XML). |
But if you take the example from above and create a new test component in a weblate 3.7.1 instance, you will recognize that the ampersand is not unescaped.. tbh I do not have any clue where to look for a solution |
With current code, it's expected to be unescaped. We can either interpret the XML and strip tags or include the tags and leave the XML as is including tags and escaped entities. |
Would it be possible to include a setting in the component to choose the behavior? |
Probably not in the settings, but separate file format would do that. |
This issue has been added to the backlog. It is not scheduled on the Weblate roadmap, but it eventually might be implemented. In case you need this feature soon, please consider helping or push it by funding the development. |
Hi there, |
hm, my & is still counted as 5 chars. have tried to place the xml-text flag in both header and translation unit, like: |
The flag needs to be set in Weblate, but it should be set automatically for XLIFF. You might need to use |
What would be the preferred solution here?
In case the second option wins, implementing it is pretty straightforward - it's just a matter of adding another XLIFF file format support to Weblate which will skip current XML handling logic. |
Hi there, |
Okay, in that case, we can go for two file formats - XLIFF (raw XML) (current one) / XLIFF (escaped XML) (to be developed). Looking at Transifex, they escape only parts of the strings, but that sounds too fragile to me (and that won't cover the HTML use case mentioned in #7224): https://docs.transifex.com/formats/xliff#escaping-characters |
Thank you for your report; the issue you have reported has just been fixed.
|
Thank you so much for thise! I was able to pull from |
Describe the bug
If you have
&
in your XLIFF files, it does not get unescaped to&
.Example:
orginal:
Sicht "&" Eintrag kopieren als: Zieleintrag
XLIFF;
and in weblate, exactly this string is represented as:
To Reproduce
Steps to reproduce the behavior:
&
Expected behavior
The
&
should be unscaped for translation (and re-escaped on commit)Screenshots
see above
Server configuration and status
The text was updated successfully, but these errors were encountered: