[FTL] Selectors containing quotes result in `expected literal` error
Categories
(Webtools Graveyard :: Pontoon, defect, P3)
Tracking
(Not tracked)
People
(Reporter: jk, Assigned: mathjazz)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Steps to reproduce:
Attempt to translate the following Fluent string in the "classic" Pontoon interface (not Translate.Next).
identifier = { NUMBER($var, type: "ordinal")->
[1] first
[one] { $var }st
*[other] { $var }nd
}
Actual results:
When attempting to submit a translation, an expected literal
error appears.
View the translation as using the raw FTL viewer and the missing literal is the "ordinal" term:
identifier = { NUMBER($var, type: ->
[1] first
[one] { $var }st
*[other] { $var }nd
}
Expected results:
The translation should be possible to save with no expected literal
error and the Fluent string should retain the all the syntax of the source string.
Assignee | ||
Comment 1•5 years ago
|
||
While Pontoon doesn't show selectors (e.g. NUMBER($var, type: "ordinal")
) in the rich UI, it still stores them in DOM to help with serialization.
Specifically, it naïvely puts them in data- attributes. Without any escaping, so when selector contains quotes, content gets stripped.
Comment 2•5 years ago
|
||
Thanks for fixing so quickly! We were going to submit a PR for this, but you beat us to it! :)
Assignee | ||
Comment 4•5 years ago
|
||
Thanks for reporting! I'd appreciate a code review in https://github.com/mozilla/pontoon/pull/1334.
Commented on the PR: My colleague @elisehein would be best placed to do a review.
Assignee | ||
Comment 6•5 years ago
|
||
Updated•3 years ago
|
Description
•