Closed Bug 1393523 Opened 7 years ago Closed 6 years ago

[FTL] Search and Replace value only

Categories

(Webtools Graveyard :: Pontoon, enhancement, P2)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mathjazz, Assigned: mathjazz)

References

Details

Attachments

(2 files)

In FTL world we store serialized FTL messages in Translation.string.

When Search and Replace mass action is used, we should only replace values, not the entire string with the full FTL syntax.
Blocks: 1407256
Priority: P3 → P2
Summary: [ftl] Search and Replace value only → [FTL] Search and Replace value only
Assignee: nobody → m
Commit pushed to master at https://github.com/mozilla/pontoon

https://github.com/mozilla/pontoon/commit/9bee538c9d76981bfab07c58b628516367677ef7
Fix bug 1393523: Search and replace text values only (#784)

To make search and replace work for FTL strings, we can't just use
Translation.string.replace(keyword, replacement) like for other file
formats, becuse we store the entire source code of the FTL Message in
Translation.string.

Instead, we need to:

  1. Parse each string and get AST
  2. Recursively traverse AST and run find & replace on text values only
  3. Serialize updated AST.

This also fixes a that triggered Unsaved changes warning for FTL string
when leaving the batch editor. We must hide batch editor first in order to
display FTL editor properly.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
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: