-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
unchanged strings have odd quoting added to them (Android strings.xml) #1519
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
Comments
The quoting is there needed because of the added spaces and this is exactly change which seems to have happened there (I've checked Esperanto, but I assume it's same with others). There is seems to be trailing newline in the string swap_scan_or_type_url which is interpreted as extra whitespace. I'm not sure this is correct, but there already have been numerous discussions about handling newlines in Android resources (see #1418, #711). Maybe just whitespace should be stripped there unless quoted. Still it would be great to have this format documented to avoid guesses like this. |
The source of these trailing spaces is from the Android Studio auto-formatter (Ctrl-Alt-L). A string like this: <string name="update_auto_download_summary">Updates are downloaded automatically and you are notified to install them</string> Is auto-wrapped by Android Studio into this: <string name="update_auto_download_summary">Updates are downloaded automatically and you are notified to install
them
</string> So I think that's clear that at least the Android Studio developers do not consider that space to be meaningful. If adding quoting is something valid for keeping spaces like that, then I think Weblate should not add those quotes, it should only keep them if they are already there. Quoting with " in the contents of an element is not an XML thing, so I guess those quotes mean something to Android. But the Android Studio code formatter does not really respect them. Could be that the Android Studio devs have not thought at all about this though, that's unfortunately common. Here's an Android Studio wrapping example with the quotes: <string name="latest__empty_state__never_updated">"Once your list of apps has been updated, the latest apps should show here "</string> after wrapping: <string name="latest__empty_state__never_updated">"Once your list of apps has been updated, the latest apps should
show here "
</string> So what to do without " quotes in the source strings seems pretty clear to me: it should strip leading and trailing whitespace, and normalize spaces between words to a single space (unless you want to try to parse the indenting). With quoting seems harder. I understand wanting to have readable blocks of text, but it seems that the Android strings.xml expects |
As far as I can tell, Android expects
So for this string in Android, the newlines are not displayed and all spaces between words are a single space: <string name="nearby_splash__both_parties_need_fdroid">Both parties need
%1$s to use nearby.
</string> And in this string, the newlines are displayed in Android: <string name="nearby_splash__both_parties_need_fdroid">"Both parties need
%1$s to use nearby. "
</string> |
Thanks for digging into this, I've submitted pull request for translate-toolkit to address this: The fix has been just deployed to Hosted Weblate as well. |
Thank you for your report, the issue you have reported has just been fixed.
|
Steps to reproduce
It happens every time I merge new translation commits into our git repo. I'm not sure the exact steps to make it happen, but it happens frequently. My guess is that it is related to Unicode, e.g. strings that contain non-ASCII characters.
Actual behaviour
Random, unchanged strings are wrapped in " double-quotes, and sometimes there are spaces added, for example:
This happens in most commits, you can see lots more in the most recent 20 commits in https://hosted.weblate.org/git/f-droid/f-droid
Expected behaviour
It should not modify strings that have not changed. It should not add pointless quoting around strings.
Server configuration
hosted.weblate.org
The text was updated successfully, but these errors were encountered: