File: bug_1880918_webauthn.py

package info (click to toggle)
firefox 148.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,719,656 kB
  • sloc: cpp: 7,618,171; javascript: 6,701,506; ansic: 3,781,787; python: 1,418,364; xml: 638,647; asm: 438,962; java: 186,285; sh: 62,885; makefile: 19,010; objc: 13,092; perl: 12,763; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10; exp: 6
file content (138 lines) | stat: -rw-r--r-- 4,865 bytes parent folder | download | duplicates (3)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# 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 COPY, REPLACE


def migrate(ctx):
    """Bug 1880918 - Migrate WebAuthn strings from browser.properties to webauthnDialog.ftl, part {index}."""

    source = "browser/chrome/browser/browser.properties"
    target = "browser/browser/webauthnDialog.ftl"

    ctx.add_transforms(
        target,
        target,
        [
            FTL.Message(
                id=FTL.Identifier("webauthn-user-presence-prompt"),
                value=REPLACE(
                    source,
                    "webauthn.userPresencePrompt",
                    {"%1$S": VARIABLE_REFERENCE("hostname")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-register-direct-prompt"),
                value=REPLACE(
                    source,
                    "webauthn.registerDirectPrompt3",
                    {"%1$S": VARIABLE_REFERENCE("hostname")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-register-direct-prompt-hint"),
                value=REPLACE(
                    source,
                    "webauthn.registerDirectPromptHint",
                    {"%1$S": TERM_REFERENCE("brand-short-name")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-select-sign-result-prompt"),
                value=REPLACE(
                    source,
                    "webauthn.selectSignResultPrompt",
                    {"%1$S": VARIABLE_REFERENCE("hostname")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-select-device-prompt"),
                value=REPLACE(
                    source,
                    "webauthn.selectDevicePrompt",
                    {"%1$S": VARIABLE_REFERENCE("hostname")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-device-blocked-prompt"),
                value=REPLACE(
                    source,
                    "webauthn.deviceBlockedPrompt",
                    {"%1$S": VARIABLE_REFERENCE("hostname")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-pin-auth-blocked-prompt"),
                value=REPLACE(
                    source,
                    "webauthn.pinAuthBlockedPrompt",
                    {"%1$S": VARIABLE_REFERENCE("hostname")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-pin-not-set-prompt"),
                value=REPLACE(
                    source,
                    "webauthn.pinNotSetPrompt",
                    {"%1$S": VARIABLE_REFERENCE("hostname")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-uv-blocked-prompt"),
                value=REPLACE(
                    source,
                    "webauthn.uvBlockedPrompt",
                    {"%1$S": VARIABLE_REFERENCE("hostname")},
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-already-registered-prompt"),
                value=COPY(
                    source,
                    "webauthn.alreadyRegisteredPrompt",
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-cancel"),
                value=COPY(
                    source,
                    "webauthn.cancel",
                ),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("accesskey"),
                        value=COPY(source, "webauthn.cancel.accesskey"),
                    ),
                ],
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-allow"),
                value=COPY(
                    source,
                    "webauthn.allow",
                ),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("accesskey"),
                        value=COPY(source, "webauthn.allow.accesskey"),
                    ),
                ],
            ),
            FTL.Message(
                id=FTL.Identifier("webauthn-block"),
                value=COPY(
                    source,
                    "webauthn.block",
                ),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("accesskey"),
                        value=COPY(source, "webauthn.block.accesskey"),
                    ),
                ],
            ),
        ],
    )