Closed
Bug 1459619
Opened 7 years ago
Closed 7 years ago
Allow substitutions in transforms_from
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)
Bug 1457948 has a good example of what a migration recipe may look like when the transforms_from helper from bug 1452107 is used. See attachment 8973425 [details].
I wonder if we can do even better, in particular when it comes to the long path names passed into COPY:
permissions-invalid-uri-title = { COPY("browser/chrome/browser/preferences/preferences.properties", "invalidURITitle") }
permissions-invalid-uri-label = { COPY("browser/chrome/browser/preferences/preferences.properties", "invalidURI") }
Flod suggested we use variables: COPY($preferences_properties, "invalidURITitle").
I generalized this idea a bit to allow passing custom functions to transforms_from. This way, the processing logic doesn't have to be hardcoded in fluent.migrate.
Comment 1•7 years ago
|
||
Updated•7 years ago
|
Assignee: nobody → stas
Comment 2•7 years ago
|
||
I'm torn on this one.
I wonder if we really want a generic approach here, or just another common case handled sweet? That's what I like about transforms_from, it's doing one job well.
My counter-proposal would be to add a keyword argument from_path to transforms_from, which is used by the COPY() inspection code if only one argument is given?
transforms_from('''\
permissions-invalid-uri-title = { COPY("invalidURITitle") }
permissions-invalid-uri-label = { COPY("invalidURI") }
permissions-other-label = { COPY("browser/chrome/browser/preferences/other.properties", "invalidURI") }
''', from_path="browser/chrome/browser/preferences/preferences.properties")
The idea being that most often, these simple conversion are done from one or two files to another, so you can do two blocks.
That feels more straightforward. I'm not perfectly happy with the magic-COPY-nargs, but I'm also not too concerned.
With the current approach, we'll sprinkle COPY_KEY() in many places, I'm afraid.
Stas?
Flags: needinfo?(stas)
Assignee | ||
Comment 3•7 years ago
|
||
I like it! I'll amend the patch on Monday. Thanks, Axel!
Flags: needinfo?(stas)
Comment 4•7 years ago
|
||
Comment on attachment 8973686 [details]
Bug 1459619 - Allow substitutions in transforms_from.
Axel Hecht [:Pike] has approved the revision.
https://phabricator.services.mozilla.com/D1149
Attachment #8973686 -
Flags: review+
Updated•7 years ago
|
Attachment #8973686 -
Attachment description: Bug 1459619 - Allow custom transform functions in transforms_from. r?Pike → Bug 1459619 - Allow substitutions in transforms_from.
Assignee | ||
Comment 5•7 years ago
|
||
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Summary: Allow custom transform functions in transforms_from → Allow substitutions in transforms_from
You need to log in
before you can comment on or make changes to this bug.
Description
•