thunderbird-android icon indicating copy to clipboard operation
thunderbird-android copied to clipboard

Regular and narrow non-breaking spaces are being replaced by regular spaces in Weblate

Open AO-L10N opened this issue 1 year ago • 6 comments

Checklist

  • [x] I have used the search function to see if someone else has already submitted the same bug report.
  • [x] I will describe the problem with as much detail as possible.

App

Thunderbird for Android

App version

NA

Where did you get the app from?

None

Android version

NA

Device model

No response

Steps to reproduce

In Weblate, regular and narrow non-breaking spaces which are typographically required in French are being replaced by regular spaces when, somehow, the source strings and translations are being pushed again. The issue doesn’t seem to be with Weblate but with the way this project is handling regular and narrow non-breaking spaces which are fully supported by Android. On top of regular and narrow non-breaking spaces being replaced with regular spaces, the review status for these strings is lost when that happens, wasting precious time as the spaces have to be replaced and translations approved anew. This issue was brought to Wolf-Martell’s attention early March and happened again today.

Expected behavior

Regular and narrow non-breaking spaces should not be replaced with regular spaces when handling translation files, and the review status should not be lost.

Actual behavior

Regular and narrow non-breaking spaces are being replaced with regular spaces when handling translation files, and the review status is lost.

Logs

No response

AO-L10N avatar Apr 30 '25 16:04 AO-L10N

Thanks for the report. I'll check with Wolf next week to see what we can do here. Sorry for the inconvenience!

kewisch avatar May 02 '25 10:05 kewisch

To confirm the issue, I created a new test project to verify the Weblate behavior in different scenarios. Weblate properly adds new French translations with non-breaking spaces and propagates them correctly to the repository.

But once the translations are synced in the opposite direction from the source repository to Weblate, they are lost. Sadly, there are multiple occasions where this might happen. File conflicts, moving string resources from one component to another, syncing Weblate with the repository, or importing existing projects into Weblate.

This is out of our control and I submitted a support request to Weblate for further assistance.

See:

  • https://github.com/thunderbird/test-weblate-android
  • https://hosted.weblate.org/projects/test-android/

wmontwe avatar May 12 '25 10:05 wmontwe

@AO-LocLab I had a conversation with Weblate and they pointed me to the right information. Despite that, Weblate allows the use of narrow non-breaking spaces, and they might even be pushed to the source repository. Android will collapse any whitespace after it parses the string xml files, which results in all whitespace being treated as regular spaces. So, regardless of any present whitespace, it will always be a regular space.

To preserve intentional whitespace, you could use quotes or Android escaping. However, this only preserves multiple whitespaces that are not collapsed into a single space (" "). It does not prevent the replacement of narrow non-breaking spaces with regular spaces.

There is nothing we could do to change this behavior.

See: https://developer.android.com/guide/topics/resources/string-resource#escaping_quotes -> "Whitespace collapsing"

wmontwe avatar May 12 '25 12:05 wmontwe

@wmontwe is this something we should add to our localization docs?

kewisch avatar May 13 '25 14:05 kewisch

@wmontwe Thanks for checking. I coordinate the French translation of several apps in Weblate, some Android apps, yet I’ve only ever experienced this issue with Thunderbird for Android. At the Localization Lab, we translate most of our projects in Transifex, a great many Android apps, and I’ve never experienced that issue there either. I don’t see why a behaviour should be unique to Thunderbird Android. I’d like to add that this behaviour only started a couple months back. We never had it in the K9 Weblate project before.

AO-L10N avatar May 14 '25 15:05 AO-L10N

@wmontwe Bump on my last message

AO-L10N avatar Jul 28 '25 18:07 AO-L10N