Closed
Bug 1452107
Opened 7 years ago
Closed 7 years ago
Helper to use regular FTL in recipe files
Categories
(Localization Infrastructure and Tools :: Fluent Migration, enhancement)
Localization Infrastructure and Tools
Fluent Migration
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: stas, Assigned: stas)
Details
Attachments
(1 file)
I wonder if we could modify or extend the migration code to accept recipes written as valid FTL files:
connection-window =
.title = { COPY("browser/chrome/browser/preferences/connection.dtd", "connectionsDialog.title") }
.style = width: { PLATFORM() ->
[macos] { COPY("browser/chrome/browser/preferences/connection.dtd", "window.macWidth2") }
*[other] { COPY("browser/chrome/browser/preferences/connection.dtd", "window.width2") }
}
We could then use FluentParser to get an AST which would then be fed into the migration code.
For feature parity with the current recipes, we'd need a way to define or replace lambda which are currently used together with REPLACE_IN_TEXT:
FTL.Message(
id=FTL.Identifier('containers-remove-alert-msg'),
value=PLURALS(
'browser/chrome/browser/preferences/preferences.properties',
'removeContainerMsg',
EXTERNAL_ARGUMENT('count'),
lambda text: REPLACE_IN_TEXT(
text,
{
'#S': EXTERNAL_ARGUMENT('count')
}
)
)
),
Comment 1•7 years ago
|
||
stas and I talked about this, keeping notes of that here.
We want to keep the regular python structure of the recipes. There's ton of meta data about commits, and whatnot, and also we don't want to make the testing surface of the recipes tooooooo ftl specific.
Instead, we want to use FTL just as a way to specify the transforms. We'll create a helper that you can use to parse FTL like in the comment that stas gave, and that'll create a valid list of transforms by extending the BUILTINS of the context in which we parse.
Best of both worlds.
Summary: Make recipes look like regular FTL files → Helper to use regular FTL in recipe files
Comment 3•7 years ago
|
||
Comment 4•7 years ago
|
||
Comment on attachment 8969570 [details]
Bug 1452107 - Helper for using regular FTL to define recipes. r?Pike
Axel Hecht [:Pike] has approved the revision.
https://phabricator.services.mozilla.com/D1002
Attachment #8969570 -
Flags: review+
Assignee | ||
Comment 5•7 years ago
|
||
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•