Open tipa opened 1 week ago
Indeed, translate-toolkit (which Weblate uses to manipulate with the translation files) adds newline to improve XML readability. The additional whitespace due to the newline is added at the end of the string, what should be pretty harmless. To be precise, translate-toolkit does what SO answer you've shared suggests as a correct approach to this since https://github.com/translate/translate/pull/3606.
I don't agree with the "solution" in the SO post I linked. This comment also highlights the problem with the newlines.
Yes, the additional whitespace at the end of each line is harmless or unnoticeable in most of the cases (especially when used in uneditable, unselectable labels), but not in all of them. I noticed it in my app in a case where the multi-line localized string resource is the default for a user-editable value, shown in an editable text field. In the end, it's not the exact string that was translated in Weblate - and that should be the expected result imo.
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).
While I understand you, I'm a bit hesitant in breaking behavior translate-toolkit has for years. Let's see if somebody objects to https://github.com/translate/translate/pull/5352
Describe the issue
When downloading Android translation strings (either through the website or the API), strings that include a line break have - additionally to the expected and required "\n" - a newline character in the export XML. This causes the string, when loaded in an Android app, to have an additional, unwanted space character: https://stackoverflow.com/a/31683548/3585218
I already tried
Steps to reproduce the behavior
Expected behavior
No newlines inside the
string
-tags in XML files, only\n
Screenshots
Current behavior:
Expected behavior:
Exception traceback
No response
How do you run Weblate?
Other
Weblate versions
Weblate deploy checks
Additional context
No response