Tidy translation strings for better Weblate translation #4833
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The way that translations are shown on the Weblate interface is sometimes incorrect compared to how the string resources are processed by Android, I think because of how Weblate reads newlines and spaces. I guess it's Weblate's fault, but since that's what we use, I'm hoping this MR fixes the discrepancy, or at least minimises it.
I've opted to collapse multi-line strings onto one line (i.e.
help_empty_home
), unless there's a list or something (i.e.wellbeing_mode_notice
) in which case (for XML source readability) minimal newlines are used which hopefully makes the Weblate issue uniform and minor, if it appears at all.Here's an example of a good string in the strings.xml:
How it appears in Weblate (note that there no extra spaces anywhere):
Here are the problems:
Example 1
String in strings.xml:
How it appears in Weblate (note the spaces between words where there is a newline char in the strings.xml, and the trailing spaces at the very end of the string because the XML tag is on the next line):
Example 2
String in strings.xml:
How it appears in Weblate (note the incorrect space in front of the last line of the source and target languages):
Example 3
String in strings.xml:
How it appears in Weblate (for some reason the target language string keeps having more and more spaces added to it, I can't delete them, they keeping being added back again, perhaps it's because of only having \n newline text on a line?):
There are other issues as well, and I don't know what causes them. They should be fixed somehow, but that might be (automatic?) formatting or something at your end that I can't help with. You can see some of them fairly recently by browsing https://weblate.tusky.app/changes/browse/tusky/tusky/cy/ - entries where it says "String updated in the repository" and the edit is just whitespace changes. Here's an example where extra whitespace keeps getting added to the target language:
String in strings.xml:
How it appears in Weblate (the incorrect spaces keep getting added back in the target language):