Closed Bug 1420225 Opened 7 years ago Closed 7 years ago

Read legacy files when scanning for Sources in transforms

Categories

(Localization Infrastructure and Tools :: Fluent Migration, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stas, Assigned: stas)

Details

Attachments

(1 file)

54 bytes, text/x-github-pull-request
Details | Review
Right now calling ctx.maybe_add_localization is required to set up the migration context and read legacy translation files.

    ctx.maybe_add_localization(
        'mobile/android/chrome/aboutDownloads.dtd')

    ctx.add_transforms('mobile/about_downloads.ftl', 'about_downloads.ftl', [
        FTL.Message(
            id=FTL.Identifier('title'),
            value=COPY(
                'mobile/android/chrome/aboutDownloads.dtd',
                'aboutDownloads.title'
            )
        )
    ])

There's redundancy between maybe_add_localization and COPY's first argument.

Since we already scan all transforms for instances of Source (which COPY also is) to create a dependency chart of translations needed for each transform, it should be possible to read those legacy files during that scan and remove maybe_add_localization.

I would also like to encourage the use of keyword arguments in calls to add_transforms: target, template and transforms, like so:

    ctx.add_transforms(
        target='mobile/about_downloads.ftl',
        template='about_downloads.ftl',
        transforms=[
            FTL.Message(
                id=FTL.Identifier('title'),
                value=COPY(
                    'mobile/android/chrome/aboutDownloads.dtd',
                    'aboutDownloads.title'
                )
            )
        ]
    )
Attached file Pull Request
Assignee: nobody → stas
Status: NEW → ASSIGNED
https://github.com/projectfluent/python-fluent/commit/eb6bab11cae9ffccfdacd085b52d572f9f1997c8
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
No longer blocks: fluent.migrate
Component: Python Library → Fluent Migration
Product: L20n → Localization Infrastructure and Tools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: