summaryrefslogtreecommitdiffstats
path: root/python/l10n/fluent_migrations/bug_1791178_nsContextMenu_saveHelper.py
blob: d12533be9a9ea5ca29767a9215769bb7926ffa86 (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
32
33
34
35
36
37
38
39
# 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 VARIABLE_REFERENCE
from fluent.migrate.transforms import COPY, REPLACE


def migrate(ctx):
    """Bug 1791178 - Convert nsContextMenu saveHelper() localization to Fluent, part {index}."""

    source = "toolkit/chrome/mozapps/downloads/downloads.properties"
    target = "browser/browser/downloads.ftl"
    ctx.add_transforms(
        target,
        target,
        [
            FTL.Message(
                id=FTL.Identifier("downloads-error-alert-title"),
                value=COPY(source, "downloadErrorAlertTitle"),
            ),
            FTL.Message(
                id=FTL.Identifier("downloads-error-blocked-by"),
                value=REPLACE(
                    source,
                    "downloadErrorBlockedBy",
                    {"%1$S": VARIABLE_REFERENCE("extension")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("downloads-error-extension"),
                value=COPY(source, "downloadErrorExtension"),
            ),
            FTL.Message(
                id=FTL.Identifier("downloads-error-generic"),
                value=COPY(source, "downloadErrorGeneric"),
            ),
        ],
    )