Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[L20n] Unescaping

18 views
Skip to first unread message

Zibi Braniecki

unread,
May 7, 2015, 8:08:55 PM5/7/15
to mozilla-t...@lists.mozilla.org
My current plan is to unescape as little as possible in L20n and add unescapes when we see them necessary.

For v3 that means we will unescape:

- string enclosing character (`"` or `'`)
- unicode \uXXXX
- `\` character
- `{{` in string values (but not in string expressions)

Yes, that means that for now we will not unescape \n, \t, \r etc.

Let me know what you think about this approach.

zb.

Axel Hecht

unread,
May 9, 2015, 6:41:14 AM5/9/15
to mozilla-t...@lists.mozilla.org
I think that in particular \t and \r are sad to loose. Text editors just
love to have opinions on those. I'd prefer to bring that suite back.

Axel

Zibi Braniecki

unread,
May 14, 2015, 3:19:13 AM5/14/15
to mozilla-t...@lists.mozilla.org
Per conversation on l20n weekly call I updated all three parsers to support unescaping of:

- opchar (" or ')
- \
- {{
- \uXXXX

The benefit of that is that I can serialize it back knowing that if those characters (except of \uXXXX) are in the string, they must have been escaped. So RCS will show no diff.

The exception is \uXXXX - at this point I have no way to tell if in the source it was escaped or not and since I unescaped it in AST, I serialize unescaped.

I can add \t, \n and \r at any point (with the same limitation on serialization).

zb.

Zibi Braniecki

unread,
May 14, 2015, 3:22:52 AM5/14/15
to mozilla-t...@lists.mozilla.org
Also, all unknown unescapes are resulting in parser error.

zb.

Staś Małolepszy

unread,
May 14, 2015, 3:23:33 AM5/14/15
to Zibi Braniecki, mozilla-t...@lists.mozilla.org
Great, thanks Zibi. If we decide to add support for \n in the future we
won't be breaking any existing translations since \n is now illegal.
> _______________________________________________
> tools-l10n mailing list
> tools...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/tools-l10n
>
0 new messages