Closed Bug 1447103 Opened 6 years ago Closed 6 years ago

[FTL] Placeable names should not be used to generate access keys candidates

Categories

(Webtools Graveyard :: Pontoon, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: flod, Assigned: mathjazz)

Details

Attachments

(3 files)

Attached image Access keys screenshot
For example in Fluent:

When {-brand-short-name} starts

"{-brand-short-name}" should be excluded when generating the list of potential access keys.

Attaching a screenshot, because I'm not sure how long the link will be active
https://mozilla-pontoon-staging.herokuapp.com/sl/test-fluent/preferences.ftl/?search=accessk&string=176235
Summary: Variable and placeholder names should not be used to generate access keys candidates → [FTL] Placeable names should not be used to generate access keys candidates
Is it safe to simply strip "{placeable}" out of textarea elements to generate candidates from?
Priority: -- → P3
(In reply to Matjaz Horvat [:mathjazz] from comment #1)
> Is it safe to simply strip "{placeable}" out of textarea elements to
> generate candidates from?

It sounds rough, but given the target I don't think it's too dangerous to strip via regex (unless there's a better way via AST)
Commit pushed to master at https://github.com/mozilla/pontoon

https://github.com/mozilla/pontoon/commit/46315b38d8d2f364dcf81edf33d458359b2b126c
Fix bug 1447103: Exclude placeables from access key candidates (#907)
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Assignee: nobody → m
Commit pushed to master at https://github.com/mozilla/pontoon

https://github.com/mozilla/pontoon/commit/62e3fb682d080b53cbc2400007db120e95941a4f
Fix bug 1447103 more reliably (#908)

Exclude Placeables from generating access key candidates by building a
fake FTL Message from textarea contents, parsing it and only taking
TextElements into account.

Previous implementation used regex to try to do the same, which would
fail when curly brackets are escaped, e.g.:

```
key = Hello \{ and then { -brand-short-name} World
```

If we hit a`ParseError` (also happens on untranslated strings), the entire
element content is used to  generate access key candidates.
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: