Skip to content
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

[ts] Request to collapse empty XML elements #1118

Closed
bjorn opened this issue May 17, 2016 · 9 comments
Closed

[ts] Request to collapse empty XML elements #1118

bjorn opened this issue May 17, 2016 · 9 comments
Labels
enhancement Adding or requesting a new feature. translate-toolkit Issues which need to be fixed in the translate-toolkit

Comments

@bjorn
Copy link

bjorn commented May 17, 2016

Steps to reproduce

  1. Have a project using the .ts format
  2. Notice that Weblate writes location info like <location line="+83"></location>
  3. Since this is different from what Qt Linguist does (<location line="+83"/>), it leads to huge diffs when Weblate and Qt Linguist are used interchangeably.

Expected behaviour

Collapsing empty XML elements makes sense both for avoiding these huge diffs as well as for space-saving reasons, since it is unnecessary verbosity.

There are some other differences in the output (another example below), but the expanded XML elements are causing by far the most changes.

-<?xml version="1.0" encoding="utf-8"?> (Qt Linguist)
+<?xml version='1.0' encoding='utf-8'?> (Weblate)

Server configuration

Using hosted Weblate (https://hosted.weblate.org/projects/tiled/)

@nijel nijel added enhancement Adding or requesting a new feature. translate-toolkit Issues which need to be fixed in the translate-toolkit labels May 18, 2016
@nijel
Copy link
Member

nijel commented May 18, 2016

This behavior comes from translate-toolkit, library we use for manipulation with the files.

The closing tags were added intentionally in translate/translate@e2b714e, see also translate/translate#1420.

For the header this was already discussed in https://github.com/nijel/weblate/issues/462, but I don't think anybody has talked with translate-toolkit upstream to address this.

@bjorn
Copy link
Author

bjorn commented May 19, 2016

Ah, thanks for the pointers! It's interesting that they already tried to match the Qt Linguist format better, but the "Pretty-print empty tags without self-closing them" is only half the story, since while Qt Linguist does not self-close the translation element, it does self-close the location element. I'll see if I can do a pull request against translate.

@bjorn
Copy link
Author

bjorn commented May 21, 2016

I've opened translate/translate#3443 for this.

@dg0yt
Copy link
Contributor

dg0yt commented Jul 24, 2016

Updated in translate/translate#3465. The difference which is left open is the handling of '/" vs. '/".

@dg0yt
Copy link
Contributor

dg0yt commented Jul 27, 2016

The first PR to translate got merged. Now i submitted translate/translate#3470 for writing quotes as entities. Since this requires postprocessing of the XML output, it somewhat slows down saving as .ts.

@nijel
Copy link
Member

nijel commented Aug 10, 2016

Closing this issue as there is nothing what could be done on Weblate side to improve this.

@nijel nijel closed this as completed Aug 10, 2016
@bjorn
Copy link
Author

bjorn commented Aug 10, 2016

@nijel You mean Weblate will automatically pick up this improvement once translate/translate#3470 is merged?

@bjorn
Copy link
Author

bjorn commented Aug 10, 2016

Is Weblate already updated to use the improvements submitted in translate/translate#3465?

@nijel
Copy link
Member

nijel commented Aug 10, 2016

Weblate will use installed translate-toolkit, so whatever fixes it has, those will work in Weblate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding or requesting a new feature. translate-toolkit Issues which need to be fixed in the translate-toolkit
Projects
None yet
Development

No branches or pull requests

3 participants