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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
import fluent.syntax.ast as FTL
from fluent.migrate.transforms import COPY, COPY_PATTERN
def migrate(ctx):
"""Bug 1814969 - Convert contextual identity service strings to Fluent, part {index}."""
source = "browser/chrome/browser/browser.properties"
alltabs = "browser/browser/allTabsMenu.ftl"
target = "toolkit/toolkit/global/contextual-identity.ftl"
ctx.add_transforms(
target,
target,
[
FTL.Message(
id=FTL.Identifier("user-context-personal"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY(source, "userContextPersonal.label"),
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY(source, "userContextPersonal.accesskey"),
),
],
),
FTL.Message(
id=FTL.Identifier("user-context-work"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY(source, "userContextWork.label"),
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY(source, "userContextWork.accesskey"),
),
],
),
FTL.Message(
id=FTL.Identifier("user-context-banking"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY(source, "userContextBanking.label"),
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY(source, "userContextBanking.accesskey"),
),
],
),
FTL.Message(
id=FTL.Identifier("user-context-shopping"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY(source, "userContextShopping.label"),
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY(source, "userContextShopping.accesskey"),
),
],
),
FTL.Message(
id=FTL.Identifier("user-context-none"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY(source, "userContextNone.label"),
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY(source, "userContextNone.accesskey"),
),
],
),
FTL.Message(
id=FTL.Identifier("user-context-manage-containers"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY_PATTERN(
alltabs, "all-tabs-menu-manage-user-context.label"
),
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY_PATTERN(
alltabs, "all-tabs-menu-manage-user-context.accesskey"
),
),
],
),
],
)
|