Android-l10n should escape straight apostrophes or double quotes
This issue was created automatically by a script.
Bug 1615458
Bug Reporter: Juan Ajsivinac <[email protected]> CC: @flodolo, @guerojeff, @Pike, @Delphine, @mathjazz, @rprys See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1605059
Created attachment 9126583 apostrofe en cak.png
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
Steps to reproduce:
I wanted to locate the Android L10n project in kaqchikel
Actual results:
Strings containing words that are written with apostrophe do not allow you to save them instead this message appears "Apostrophe must be escaped"
Expected results:
The other projects that are located in kaqchikel can be used apostrophe.
Comment Author: @guerojeff
Hi Juan!
You can still use apostrophes, they just need to be "escaped". This is an issue with the Android build system. It's very delicate and introducing unescaped characters break things.
To escape a character, all you need to do is introduce a \ character before it. I've submitted a suggestion for that string from translation memory that includes the escaped characters in the appropriate spots: https://pontoon.mozilla.org/cak/android-l10n/mozilla-mobile/android-components/components/browser/engine-system/src/main/res/values/strings.xml/?string=198458
Hope this helps. Please feel free to reopen this if you feel you need more help or more answers.
Jeff
Comment Author: @flodolo
In Firefox for Android you normally don't have to escape apostrophes, that's taken care of by Pontoon.
Is that assumption still valid for android-l10n and XML files?
If that's the case, I assume the problem here is the fact that the string has both " and '. Can Pontoon be smart and solve the problem transparently?
Comment Author: Juan Ajsivinac <[email protected]>
I do not know what the problem is, but although there is not (") I always receive the message" The following verifications have failed = The apostrophe must escape "
Comment Author: @flodolo
I tried, and indeed I can't submit a translation including '. I don't think that's reasonable to ask localizers to escape characters in their translation?
I've double checked, and Firefox for Android would allow me to add those characters, and escape them silently. I think that should happen also for android-l10n.
Comment Author: @mathjazz
One solution is to change the parser, serializer and checks to handle escaping and unescaping of quotes behind the scenes, similar to how we handle it in DTDs. Resources:
- bug #1193860
- bug #1390111
- https://github.com/mozilla/pontoon/blob/master/pontoon/sync/formats/silme.py#L90
- https://github.com/mozilla/pontoon/blob/master/pontoon/sync/utils.py#L134
The other solution is to implement editor hooks and automatically escape quotes as they are entered into the editor. That would also require work on TM to make sure strings are reusable across projects.
In any of the solutions we should migrate manually escaped translations and their TM entries.
Comment Author: @Pike
I was wondering about what we want to do with Android mid-term. Looking at https://developer.android.com/guide/topics/resources/string-resource, escaping is just one thing that's not up-to-par. We also have plurals, that we don't support yet. And the CDATA hack we use for markup isn't the best solution either.
Which makes me wonder, should we have an Android rich editor, like we do for Fluent?
Comment Author: @guerojeff
Another community is reporting issues with this and says that they can't localize without a solution. Since this is affecting Fenix l10n, we need to prioritize a solution.
(In reply to Axel Hecht [:Pike][back 03/16] from comment #6)
I was wondering about what we want to do with Android mid-term. Looking at https://developer.android.com/guide/topics/resources/string-resource, escaping is just one thing that's not up-to-par. We also have plurals, that we don't support yet. And the CDATA hack we use for markup isn't the best solution either.
Which makes me wonder, should we have an Android rich editor, like we do for Fluent?
That's definitely a conversation we should all have, can you set up a time or file a new bug where we can discuss?
Comment Author: @Delphine
Update: this is also an issue for the Breton locale
Comment Author: @mathjazz
*** Bug #1605059 has been marked as a duplicate of this bug. ***