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

More consistent line breaks in exported po files #11615

Closed
Cerno-b opened this issue May 10, 2024 · 5 comments
Closed

More consistent line breaks in exported po files #11615

Cerno-b opened this issue May 10, 2024 · 5 comments
Labels
enhancement Adding or requesting a new feature. translate-toolkit Issues which need to be fixed in the translate-toolkit wontfix Nobody will work on this.

Comments

@Cerno-b
Copy link

Cerno-b commented May 10, 2024

Describe the problem

When I export a po file in Weblate and edit it using an external editor like poedit, I get inconsistent line breaks, which makes merging and comparing changes from weblate with the exported file nearly impossible. Poedit allows setting different line break values, but no matter which value I use, I can't get it to align with the weblate output.

I am currently working on https://hosted.weblate.org/projects/godot-engine/godot-class-reference/de/

Describe the solution you would like

I'd like weblate to create po files on export that are identical (down to the line breaks) to the files generated by the most popular po file editors (e.g. poedit).

Describe alternatives you have considered

A workaround would be to always pass the downloaded files through poedit before attempting a merge, but I was hoping for a more consistent output from weblate directly.

Screenshots

image

Additional context

Here are some observations I made, and I can't get a grasp on the logic behind where line breaks occur and where they are prevented:

So generally weblate seems to target a maximum line length of 80, but I have also (very rarely) seen longer lines, like these:

85: "permission#BIND_NOTIFICATION_LISTENER_SERVICE]BIND_NOTIFICATION_LISTENER_SERVICE[/"
81: "print(ts.string_get_word_breaks(\"Test ❤️‍🔥 Test\")) # Prints [1, 2, 3, 4, 5, "

The first one might not have found any character at which a break is allowed, and the second one might be confused with the unicode emojis.

These corner cases aside, Weblate seems to try to avoid breaking up words, but the rules seem inconsistent:

Here, breaking after the "[" is allowed (top line length: 76):

"Konvertiert [param what] in [param type] auf die bestmögliche Weise. Der ["
"param type] verwendet die [enum Variant.Type]-Werte.\n"

But here it is not, even though it would still fit into the top line (length: 77):

"- Eine von [Object] abgeleitete Klasse, die in [ClassDB] existiert, z. B. "
"[Node].\n"

Sometimes I even get a forced break inside a word (here: "erhöht"), even though there is a space before the word that could have been used as the break. Also, the line like this is only 79 characters long, so there would still be space for the "h". Maybe the ö is represented as unicode and weblate is allowed to break after unicode characters?

"[code]range(b: int, n: int, s: int)[/code]: Beginnt bei [code]b[/code], erhö"
"ht/verringert sich in Schritten von [code]s[/code] und endet [i]vor[/i] "

I could try and provide more example if that helps.

It would be nice if we could get po files that are more consistent.

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

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).

@nijel
Copy link
Member

nijel commented May 11, 2024

Indeed the implementation in translate-toolkit and gettext do differ. I think I've posted some summary years ago on some translate-toolkit issue, but I can't find it right now.

@Cerno-b
Copy link
Author

Cerno-b commented May 11, 2024

Thanks, will do.

@Cerno-b
Copy link
Author

Cerno-b commented May 11, 2024

Posted it as an issue here: translate/translate#5251

@nijel nijel added the wontfix Nobody will work on this. label May 13, 2024
@nijel
Copy link
Member

nijel commented May 13, 2024

Closing this now as there is nothing to be done in Weblate to fix this.

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 wontfix Nobody will work on this.
Projects
None yet
Development

No branches or pull requests

2 participants