python/l10n/fluent_migrations/bug_1520924_updateHistory.py
author Mark Banner <standard8@mozilla.com>
Fri, 15 Mar 2019 16:43:11 +0000
changeset 464402 e05c19c17c88d69bbad0646b3839564a082179a3
parent 454729 85f4a4a750613b8693046f6d34c0f31e72406746
permissions -rw-r--r--
Bug 1534661 - Fix the QuantumBar results view to have an accessible role of ROLE_COMBOBOX_LIST. r=dao Differential Revision: https://phabricator.services.mozilla.com/D23155

# coding=utf8

# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import transforms_from
from fluent.migrate.helpers import VARIABLE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE


def migrate(ctx):
    """Bug 1520924 - Remove 'update' XBL binding and convert strings to Fluent, part {index}."""

    ctx.add_transforms(
        "toolkit/toolkit/updates/history.ftl",
        "toolkit/toolkit/updates/history.ftl",
        transforms_from(
"""
update-details = { COPY("toolkit/chrome/mozapps/update/updates.dtd", "update.details.label") }
""")
)

    ctx.add_transforms(
    "toolkit/toolkit/updates/history.ftl",
    "toolkit/toolkit/updates/history.ftl",
    [
        FTL.Message(
            id=FTL.Identifier("update-full-build-name"),
            value=REPLACE(
                "toolkit/chrome/mozapps/update/updates.properties",
                "updateFullName",
                {
                    "%1$S": VARIABLE_REFERENCE("name"),
                    "%2$S": VARIABLE_REFERENCE("buildID"),
                },
                normalize_printf=True
            )
        ),
        FTL.Message(
            id=FTL.Identifier("update-installed-on"),
            value=CONCAT(
                COPY(
                    "toolkit/chrome/mozapps/update/updates.dtd",
                    "update.installedOn.label"
                ),
                FTL.TextElement(" "),
                VARIABLE_REFERENCE("date"),
            ),
        ),
        FTL.Message(
            id=FTL.Identifier("update-status"),
            value=CONCAT(
                COPY(
                    "toolkit/chrome/mozapps/update/updates.dtd",
                    "update.status.label"
                ),
                FTL.TextElement(" "),
                VARIABLE_REFERENCE("status"),
            ),
        ),
    ]
)