summaryrefslogtreecommitdiffstats
path: root/python/l10n/fluent_migrations/bug_1831872_sync.py
blob: f66c27bf5acc6dd827ebd24c65e62b778ec27091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

import fluent.syntax.ast as FTL
from fluent.migrate.helpers import TERM_REFERENCE, VARIABLE_REFERENCE
from fluent.migrate.transforms import REPLACE


def migrate(ctx):
    """Bug 1831872 - Migrate sync.properties to Fluent, part {index}."""

    source = "services/sync/sync.properties"
    target = "toolkit/services/accounts.ftl"
    ctx.add_transforms(
        target,
        target,
        [
            FTL.Message(
                id=FTL.Identifier("account-client-name"),
                value=REPLACE(
                    source,
                    "client.name2",
                    {
                        "%1$S": VARIABLE_REFERENCE("user"),
                        "%2$S": TERM_REFERENCE("brand-short-name"),
                        "%3$S": VARIABLE_REFERENCE("system"),
                    },
                ),
            ),
        ],
    )