pontoon icon indicating copy to clipboard operation
pontoon copied to clipboard

Android-l10n should escape straight apostrophes or double quotes

Open bugzilla-to-github opened this issue 5 years ago • 9 comments

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.

bugzilla-to-github avatar Feb 13 '20 06:02 bugzilla-to-github

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

bugzilla-to-github avatar Feb 14 '20 05:02 bugzilla-to-github

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?

bugzilla-to-github avatar Feb 14 '20 13:02 bugzilla-to-github

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 "

bugzilla-to-github avatar Feb 15 '20 05:02 bugzilla-to-github

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.

bugzilla-to-github avatar Feb 15 '20 15:02 bugzilla-to-github

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.

bugzilla-to-github avatar Feb 17 '20 17:02 bugzilla-to-github

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?

bugzilla-to-github avatar Feb 18 '20 20:02 bugzilla-to-github

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?

bugzilla-to-github avatar Mar 11 '20 23:03 bugzilla-to-github

Comment Author: @Delphine

Update: this is also an issue for the Breton locale

bugzilla-to-github avatar Dec 03 '20 01:12 bugzilla-to-github

Comment Author: @mathjazz

*** Bug #1605059 has been marked as a duplicate of this bug. ***

bugzilla-to-github avatar Jan 13 '21 01:01 bugzilla-to-github