Exemplo n.º 1
0
def migrate(ctx):
    """Migrate bedrock/newsletter/templates/newsletter/opt-out-confirmation.html, part {index}."""

    ctx.add_transforms(
        "newsletter/opt-out-confirmation.ftl",
        "newsletter/opt-out-confirmation.ftl",
        transforms_from("""
opt-out-confirmation-cool-we-hear = {COPY(opt_out_confirmation, "Cool. We hear you.",)}
opt-out-confirmation-youre-now-opted = {COPY(opt_out_confirmation, "You’re now opted out of a series of emails about setting up your account.",)}
opt-out-confirmation-youll-continue = {COPY(opt_out_confirmation, "You’ll continue to receive other emails you’re subscribed to, along with occasional important updates about your account. To manage all your subscriptions, enter your email below — we need to make sure we’re talking to the right person.",)}
opt-out-confirmation-your-email = {COPY(opt_out_confirmation, "Your email address:",)}
opt-out-confirmation-yournameexamplecom = {COPY(opt_out_confirmation, "*****@*****.**",)}
opt-out-confirmation-manage-preferences = {COPY(opt_out_confirmation, "Manage Preferences",)}
opt-out-confirmation-prefer-to-get = {COPY(opt_out_confirmation, "Prefer to get information another way?",)}
opt-out-confirmation-check-out-our = {COPY(opt_out_confirmation, "Check out our blogs",)}
opt-out-confirmation-get-help = {COPY(opt_out_confirmation, "Get help",)}
""",
                        opt_out_confirmation=opt_out_confirmation) +
        [
            FTL.Message(
                id=FTL.Identifier("opt-out-confirmation-subscribe-to"),
                value=REPLACE(
                    opt_out_confirmation,
                    "Subscribe to occasional newsletter updates from Firefox",
                    {
                        "Firefox": TERM_REFERENCE("brand-name-firefox"),
                    })),
        ])
Exemplo n.º 2
0
def migrate(ctx):
    """Bug 1745932 - Move highlighters.properties to fluent, part {index}."""

    ctx.add_transforms(
        "devtools/shared/highlighters.ftl",
        "devtools/shared/highlighters.ftl",
        transforms_from(
            """
gridtype-container = { COPY(from_path, "gridType.container") }
gridtype-item = { COPY(from_path, "gridType.item") }
gridtype-dual = { COPY(from_path, "gridType.dual") }
flextype-container = { COPY(from_path, "flexType.container") }
flextype-item = { COPY(from_path, "flexType.item") }
flextype-dual = { COPY(from_path, "flexType.dual") }
remote-node-picker-notice-action-desktop = { COPY(from_path, "remote-node-picker-notice-action-desktop") }
remote-node-picker-notice-action-touch = { COPY(from_path, "remote-node-picker-notice-action-touch") }
remote-node-picker-notice-hide-button = { COPY(from_path, "remote-node-picker-notice-hide-button") }
""",
            from_path="devtools/shared/highlighters.properties",
        ),
    )

    ctx.add_transforms(
        "devtools/shared/highlighters.ftl",
        "devtools/shared/highlighters.ftl",
        [
            FTL.Message(
                id=FTL.Identifier("grid-row-column-positions"),
                value=REPLACE(
                    "devtools/shared/highlighters.properties",
                    "grid.rowColumnPositions",
                    {
                        "%1$S": VARIABLE_REFERENCE("row"),
                        "%2$S": VARIABLE_REFERENCE("column"),
                    },
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("remote-node-picker-notice"),
                value=REPLACE(
                    "devtools/shared/highlighters.properties",
                    "remote-node-picker-notice",
                    {"%1$S": VARIABLE_REFERENCE("action")},
                ),
            ),
        ],
    )
Exemplo n.º 3
0
def migrate(ctx):
    """Migrate bedrock/privacy/templates/privacy/principles.html, part {index}."""

    ctx.add_transforms(
        "privacy/principles.ftl", "privacy/principles.ftl",
        transforms_from("""
privacy-principles-data-privacy-principles = {COPY(principles, "Data Privacy Principles",)}
""",
                        principles=principles) +
        [
            FTL.Message(
                id=FTL.Identifier(
                    "privacy-principles-mozilla-is-an-open-source"),
                value=REPLACE(
                    principles,
                    "Mozilla is an open source project with a mission to improve your Internet experience. This is a driving force behind our privacy practices.",
                    {
                        "Mozilla": TERM_REFERENCE("brand-name-mozilla"),
                    })),
            FTL.Message(
                id=FTL.Identifier(
                    "privacy-principles-the-following-five-principles"),
                value=REPLACE(
                    principles,
                    "The following five principles stem from the <a href=\"%(link)s\">Mozilla Manifesto</a> and inform how we:",
                    {
                        "%%": "%",
                        "%(link)s": VARIABLE_REFERENCE("link"),
                        "Mozilla": TERM_REFERENCE("brand-name-mozilla"),
                    })),
        ] + transforms_from("""
privacy-principles-develop-our-products = {COPY(principles, "develop our products and services",)}
privacy-principles-manage-user-data-we-collect = {COPY(principles, "manage user data we collect",)}
privacy-principles-select-and-interact-with = {COPY(principles, "select and interact with partners",)}
privacy-principles-shape-our-public-policy = {COPY(principles, "shape our public policy and advocacy work",)}
privacy-principles-no-surprises = {COPY(principles, "No surprises",)}
privacy-principles-use-and-share-information = {COPY(principles, "Use and share information in a way that is transparent and benefits the user.",)}
privacy-principles-user-control = {COPY(principles, "User control",)}
privacy-principles-develop-products-and = {COPY(principles, "Develop products and advocate for best practices that put users in control of their data and online experiences.",)}
privacy-principles-limited-data = {COPY(principles, "Limited data",)}
privacy-principles-collect-what-we-need = {COPY(principles, "Collect what we need, de-identify where we can and delete when no longer necessary.",)}
privacy-principles-sensible-settings = {COPY(principles, "Sensible settings",)}
privacy-principles-design-for-a-thoughtful = {COPY(principles, "Design for a thoughtful balance of safety and user experience.",)}
privacy-principles-defense-in-depth = {COPY(principles, "Defense in depth",)}
privacy-principles-maintain-multi-layered = {COPY(principles, "Maintain multi-layered security controls and practices, many of which are publicly verifiable.",)}
""",
                            principles=principles))
Exemplo n.º 4
0
def migrate(ctx):
    """Bug 1411012 - Migrate Do Not Track preferences to Fluent, part {index}."""

    ctx.add_transforms(
        'browser/browser/preferences/preferences.ftl',
        'browser/locales/en-US/browser/preferences/preferences.ftl',
        [
            FTL.Message(
                id=FTL.Identifier('do-not-track-description'),
                value=COPY(
                    'browser/chrome/browser/preferences/privacy.dtd',
                    'doNotTrack.description'
                )
            ),
            FTL.Message(
                id=FTL.Identifier('do-not-track-learn-more'),
                value=COPY(
                    'browser/chrome/browser/preferences/privacy.dtd',
                    'doNotTrack.learnMore.label'
                )
            ),
            FTL.Message(
                id=FTL.Identifier('do-not-track-option-default'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('label'),
                        COPY(
                            'browser/chrome/browser/preferences/privacy.dtd',
                            'doNotTrack.default.label'
                        )
                    )
                ]
            ),
            FTL.Message(
                id=FTL.Identifier('do-not-track-option-always'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('label'),
                        COPY(
                            'browser/chrome/browser/preferences/privacy.dtd',
                            'doNotTrack.always.label'
                        )
                    )
                ]
            ),
        ]
    )
Exemplo n.º 5
0
def cldr_to_ftl(langs, config):

    page_url = ""  # stem of address for individual Region or Language pages
    find_str = ""  # searched tag to extract data
    name_str = ""  # stem of name of ftl variables

    if config == 0:
        page_url = "http://icu-project.org/trac/browser/trunk/icu4c/source/data/lang/"
        find_str = "Languages{"
        name_str = "language-name-{}"
    elif config == 1:
        page_url = "http://icu-project.org/trac/browser/trunk/icu4c/source/data/region/"
        find_str = "Countries{"
        name_str = "region-name-{}"

    directory = "ftl_files/"

    for lang in langs:
        new_directory = re.sub(".txt", "", lang)
        if not os.path.exists(directory + new_directory):
            os.makedirs(directory + new_directory)
        new_file = new_directory + "/resources.ftl"
        wout = open(directory + new_file, "a")
        if lang[-4:] == ".txt":
            source = urllib.request.urlopen(page_url + lang + "?format=txt")
            text = source.read().decode('utf-8', "strict")
            text_lines = text.split("\n")
            interior = 0
            catch = False
            for line in text_lines:
                line = re.sub("\ufeff", "", line)
                if bool(re.search("^//", line)) == False and bool(
                        re.search("[(/**)(**/)]",
                                  line)) == False and line != '':
                    line = re.sub("\s+", " ", line)
                    line = re.sub("^\s", "", line)

                    if "{" in line and "}" not in line:
                        interior += 1
                        if find_str in line:
                            catch = True
                    elif "}" in line and "{" not in line:
                        interior -= 1
                        catch = False
                    elif len(re.findall("{", line)) < 2 and len(
                            re.findall("}", line)) < 2:
                        if catch == True:
                            parts = re.split("[\{\}\"]", line)

                            res = ast.Resource()

                            l10n_id = ast.Identifier(name_str.format(parts[0]))
                            value = ast.Pattern([ast.TextElement(parts[2])])
                            msg = ast.Message(l10n_id, value)
                            res.body.append(msg)

                            s = serialize(res)
                            wout.write(s)
        wout.close()
Exemplo n.º 6
0
def migrate(ctx):
    """Bug 1445084 - Migrate search results pane of Preferences to Fluent, part {index}."""

    ctx.add_transforms(
        'browser/browser/preferences/preferences.ftl',
        'browser/browser/preferences/preferences.ftl', [
            FTL.Message(
                id=FTL.Identifier('search-input-box'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('style'),
                        CONCAT(
                            FTL.TextElement('width: '),
                            COPY(
                                'browser/chrome/browser/preferences/preferences.dtd',
                                'searchField.width')),
                    ),
                    FTL.Attribute(
                        FTL.Identifier('placeholder'),
                        FTL.Pattern([
                            FTL.Placeable(
                                FTL.SelectExpression(
                                    expression=FTL.CallExpression(
                                        callee=FTL.Function('PLATFORM')),
                                    variants=[
                                        FTL.Variant(
                                            key=FTL.VariantName('windows'),
                                            default=False,
                                            value=COPY(
                                                'browser/chrome/browser/preferences/preferences.properties',
                                                'searchInput.labelWin')),
                                        FTL.Variant(
                                            key=FTL.VariantName('other'),
                                            default=True,
                                            value=COPY(
                                                'browser/chrome/browser/preferences/preferences.properties',
                                                'searchInput.labelUnix'))
                                    ]))
                        ])),
                ]),
            FTL.Message(
                id=FTL.Identifier('search-results-header'),
                value=COPY(
                    'browser/chrome/browser/preferences/preferences.dtd',
                    'paneSearchResults.title')),
        ])
def migrate(ctx):
    """Bug 1453800 - Migrate Container removal strings to Fluent, part {index}."""

    ctx.add_transforms(
        'browser/browser/preferences/preferences.ftl',
        'browser/browser/preferences/preferences.ftl',
        [
            FTL.Message(
                id=FTL.Identifier('containers-remove-alert-title'),
                value=COPY(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'removeContainerAlertTitle',
                ),
            ),
            FTL.Message(
                id=FTL.Identifier('containers-remove-alert-msg'),
                value=PLURALS(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'removeContainerMsg',
                    EXTERNAL_ARGUMENT('count'),
                    lambda text: REPLACE_IN_TEXT(
                        text,
                        {
                            '#S': EXTERNAL_ARGUMENT('count')
                        }
                    )
                )
            ),
            FTL.Message(
                id=FTL.Identifier('containers-remove-ok-button'),
                value=COPY(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'removeContainerOkButton',
                ),
            ),
            FTL.Message(
                id=FTL.Identifier('containers-remove-cancel-button'),
                value=COPY(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'removeContainerButton2',
                ),
            ),
        ]
    )
Exemplo n.º 8
0
def migrate(ctx):
    """Bug 1608199 - Port devtools/client/styleeditor.dtd to Fluent, part {index}."""

    ctx.add_transforms(
        "devtools/client/styleeditor.ftl",
        "devtools/client/styleeditor.ftl",
    transforms_from(
"""
styleeditor-new-button =
    .tooltiptext = { COPY(from_path, "newButton.tooltip", trim:"True") }
    .accesskey = { COPY(from_path, "newButton.accesskey", trim:"True") }
styleeditor-import-button =
    .tooltiptext = { COPY(from_path, "importButton.tooltip", trim:"True") }
    .accesskey = { COPY(from_path, "importButton.accesskey", trim:"True") }
styleeditor-visibility-toggle =
    .tooltiptext = { COPY(from_path, "visibilityToggle.tooltip")}
    .accesskey = { COPY(from_path, "saveButton.accesskey", trim:"True") }
styleeditor-save-button = { COPY(from_path, "saveButton.label", trim:"True") }
    .tooltiptext = { COPY(from_path, "saveButton.tooltip", trim:"True") }
    .accesskey = { COPY(from_path, "saveButton.accesskey", trim:"True") }
styleeditor-options-button =
    .tooltiptext = { COPY(from_path, "optionsButton.tooltip", trim:"True") }
styleeditor-media-rules = { COPY(from_path, "mediaRules.label", trim:"True") }
styleeditor-editor-textbox =
    .data-placeholder = { COPY(from_path, "editorTextbox.placeholder", trim:"True") }
styleeditor-no-stylesheet = { COPY(from_path, "noStyleSheet.label", trim:"True") }
styleeditor-open-link-new-tab =
    .label = { COPY(from_path, "openLinkNewTab.label", trim:"True") }
styleeditor-copy-url =
    .label = { COPY(from_path, "copyUrl.label", trim:"True") }
""", from_path="devtools/client/styleeditor.dtd"))

    ctx.add_transforms(
        "devtools/client/styleeditor.ftl",
        "devtools/client/styleeditor.ftl",
        [
            FTL.Message(
                        id=FTL.Identifier("styleeditor-no-stylesheet-tip"),
                        value=CONCAT(
                                    COPY(
                                        "devtools/client/styleeditor.dtd",
                                         "noStyleSheet-tip-start.label",
                                         ),
                                    FTL.TextElement('<a data-l10n-name="append-new-stylesheet">'),
                                    COPY(
                                        "devtools/client/styleeditor.dtd",
                                        "noStyleSheet-tip-action.label",
                                        ),
                                    FTL.TextElement("</a>"),
                                    COPY("devtools/client/styleeditor.dtd",
                                         "noStyleSheet-tip-end.label",
                                         ),
                                    ),
            )
        ]
    )
Exemplo n.º 9
0
def migrate(ctx):
    """Bug 1521792 - Migrate unknownContentType dialog to FTL, part {index}"""

    ctx.add_transforms(
        "toolkit/toolkit/global/unknownContentType.ftl",
        "toolkit/toolkit/global/unknownContentType.ftl",
        transforms_from(
            """

unknowncontenttype-intro = { COPY(path1, "intro2.label") }
unknowncontenttype-which-is = { COPY(path1, "whichIs.label") }
unknowncontenttype-from = { COPY(path1, "from.label") }
unknowncontenttype-prompt = { COPY(path1, "unknownPromptText.label") }
""",
            path1="toolkit/chrome/mozapps/downloads/unknownContentType.dtd",
        ) + [
            FTL.Message(
                id=FTL.Identifier("unknowncontenttype-action-question"),
                value=REPLACE(
                    "toolkit/chrome/mozapps/downloads/unknownContentType.dtd",
                    "actionQuestion.label",
                    {
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    },
                ),
            ),
        ] + transforms_from(
            """
unknowncontenttype-open-with =
    .label = { COPY(path1, "openWith.label") }
    .accesskey = { COPY(path1, "openWith.accesskey") }
unknowncontenttype-other =
    .label = { COPY(path1, "other.label") }
unknowncontenttype-choose-handler =
    .label =
        { PLATFORM() ->
            [macos] { COPY(path1, "chooseHandlerMac.label") }
           *[other] { COPY(path1, "chooseHandler.label") }
        }
    .accesskey =
        { PLATFORM() ->
            [macos] { COPY(path1, "chooseHandlerMac.accesskey") }
           *[other] { COPY(path1, "chooseHandler.accesskey") }
        }
unknowncontenttype-save-file =
    .label = { COPY(path1, "saveFile.label") }
    .accesskey = { COPY(path1, "saveFile.accesskey") }
unknowncontenttype-remember-choice =
    .label = { COPY(path1, "rememberChoice.label") }
    .accesskey = { COPY(path1, "rememberChoice.accesskey") }
""",
            path1="toolkit/chrome/mozapps/downloads/unknownContentType.dtd",
        ),
    )
def migrate(ctx):
    """Bug 1606909 - Port Tips from the experiment behind a pref, part {index}."""

    ctx.add_transforms(
        'browser/browser/browser.ftl', 'browser/browser/browser.ftl', [
            FTL.Message(
                id=FTL.Identifier("urlbar-search-tips-onboard"),
                value=REPLACE("browser/chrome/browser/browser.properties",
                              "urlbarSearchTip.onboarding",
                              {"%1$S": VARIABLE_REFERENCE("engineName")},
                              normalize_printf=True,
                              trim=True)),
            FTL.Message(
                id=FTL.Identifier("urlbar-search-tips-redirect"),
                value=REPLACE("browser/chrome/browser/browser.properties",
                              "urlbarSearchTip.engineIsCurrentPage",
                              {"%1$S": VARIABLE_REFERENCE("engineName")},
                              normalize_printf=True,
                              trim=True)),
        ])
def migrate(ctx):
    """Bug 1622269 - Migrate cert error titles from netError.dtd to aboutCertError.ftl, part {index}"""
    ctx.add_transforms(
        "browser/browser/aboutCertError.ftl",
        "browser/browser/aboutCertError.ftl",
        transforms_from("""
generic-title = { COPY(from_path, "generic.title") }
captivePortal-title = { COPY(from_path, "captivePortal.title") }
dnsNotFound-title = { COPY(from_path, "dnsNotFound.title1") }
fileNotFound-title = { COPY(from_path, "fileNotFound.title") }
fileAccessDenied-title = { COPY(from_path, "fileAccessDenied.title") }
malformedURI-title = { COPY(from_path, "malformedURI.title1") }
unknownProtocolFound-title = { COPY(from_path, "unknownProtocolFound.title") }
connectionFailure-title = { COPY(from_path, "connectionFailure.title") }
netTimeout-title = { COPY(from_path, "netTimeout.title") }
redirectLoop-title = { COPY(from_path, "redirectLoop.title") }
unknownSocketType-title = { COPY(from_path, "unknownSocketType.title") }
netReset-title = { COPY(from_path, "netReset.title") }
notCached-title = { COPY(from_path, "notCached.title") }
netOffline-title = { COPY(from_path, "netOffline.title") }
netInterrupt-title = { COPY(from_path, "netInterrupt.title") }
deniedPortAccess-title = { COPY(from_path, "deniedPortAccess.title") }
proxyResolveFailure-title = { COPY(from_path, "proxyResolveFailure.title") }
proxyConnectFailure-title = { COPY(from_path, "proxyConnectFailure.title") }
contentEncodingError-title = { COPY(from_path, "contentEncodingError.title") }
unsafeContentType-title = { COPY(from_path, "unsafeContentType.title") }
nssFailure2-title = { COPY(from_path, "nssFailure2.title") }
nssBadCert-title = { COPY(from_path, "certerror.longpagetitle2") }
nssBadCert-sts-title = { COPY(from_path, "certerror.sts.longpagetitle") }
cspBlocked-title = { COPY(from_path, "cspBlocked.title") }
xfoBlocked-title = { COPY(from_path, "xfoBlocked.title") }
remoteXUL-title = { COPY(from_path, "remoteXUL.title") }
corruptedContentError-title = { COPY(from_path, "corruptedContentErrorv2.title") }
sslv3Used-title = { COPY(from_path, "sslv3Used.title") }
inadequateSecurityError-title = { COPY(from_path, "inadequateSecurityError.title") }
blockedByPolicy-title = { COPY(from_path, "blockedByPolicy.title") }
clockSkewError-title = { COPY(from_path, "clockSkewError.title") }
networkProtocolError-title = { COPY(from_path, "networkProtocolError.title") }
""",
                        from_path="browser/chrome/overrides/netError.dtd"))
    ctx.add_transforms(
        "browser/browser/aboutCertError.ftl",
        "browser/browser/aboutCertError.ftl", [
            FTL.Message(
                id=FTL.Identifier("certerror-mitm-title"),
                value=REPLACE(
                    "browser/chrome/overrides/netError.dtd",
                    "certerror.mitm.title",
                    {
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    },
                ),
            ),
        ])
Exemplo n.º 12
0
def migrate(ctx):
    """Bug 1668284 - Unknown content type change settings label is no longer accurate, part {index}."""

    ctx.add_transforms(
        "toolkit/toolkit/global/unknownContentType.ftl",
        "toolkit/toolkit/global/unknownContentType.ftl",
        [
            FTL.Message(
                id=FTL.Identifier("unknowncontenttype-settingschange"),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("value"),
                        value=FTL.Pattern(
                            elements=[
                                FTL.Placeable(
                                    expression=FTL.SelectExpression(
                                        selector=MESSAGE_REFERENCE("PLATFORM()"),
                                        variants=[
                                            FTL.Variant(
                                                key=FTL.Identifier("windows"),
                                                default=False,
                                                value=REPLACE(
                                                    "toolkit/chrome/mozapps/downloads/settingsChange.dtd",
                                                    "settingsChangeOptions.label",
                                                    {
                                                        "&brandShortName;": TERM_REFERENCE(
                                                            "brand-short-name"
                                                        ),
                                                    },
                                                ),
                                            ),
                                            FTL.Variant(
                                                key=FTL.Identifier("other"),
                                                default=True,
                                                value=REPLACE(
                                                    "toolkit/chrome/mozapps/downloads/settingsChange.dtd",
                                                    "settingsChangePreferences.label",
                                                    {
                                                        "&brandShortName;": TERM_REFERENCE(
                                                            "brand-short-name"
                                                        ),
                                                    },
                                                ),
                                            ),
                                        ],
                                    )
                                )
                            ]
                        ),
                    )
                ],
            )
        ],
    )
Exemplo n.º 13
0
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"),
                ),
            ),
        ])
Exemplo n.º 14
0
def migrate(ctx):
    """Bug 1733495 - Convert plugins.properties to Fluent, part {index}."""

    source = "dom/chrome/plugins.properties"
    target = "toolkit/toolkit/about/aboutPlugins.ftl"
    ctx.add_transforms(
        target,
        target,
        [
            FTL.Message(
                id=FTL.Identifier("plugins-gmp-license-info"),
                value=COPY(source, "gmp_license_info"),
            ),
            FTL.Message(
                id=FTL.Identifier("plugins-gmp-privacy-info"),
                value=COPY(source, "gmp_privacy_info"),
            ),
            FTL.Message(
                id=FTL.Identifier("plugins-openh264-name"),
                value=COPY(source, "openH264_name"),
            ),
            FTL.Message(
                id=FTL.Identifier("plugins-openh264-description"),
                value=COPY(source, "openH264_description2"),
            ),
            FTL.Message(
                id=FTL.Identifier("plugins-widevine-name"),
                value=COPY(source, "widevine_description"),
            ),
            FTL.Message(
                id=FTL.Identifier("plugins-widevine-description"),
                value=COPY(source, "cdm_description2"),
            ),
        ],
    )
Exemplo n.º 15
0
def migrate(ctx):
    """Migrate bedrock/firefox/templates/firefox/whatsnew/index.html, part {index}."""

    ctx.add_transforms(
        "firefox/whatsnew/whatsnew-s2d.ftl",
        "firefox/whatsnew/whatsnew-s2d.ftl", [
            FTL.Message(
                id=FTL.Identifier("whatsnew-s2d-download-firefox-for-android"),
                value=REPLACE(
                    whatsnew, "Download Firefox for Android and iOS", {
                        "Firefox": TERM_REFERENCE("brand-name-firefox"),
                        "Android": TERM_REFERENCE("brand-name-android"),
                        "iOS": TERM_REFERENCE("brand-name-ios"),
                    })),
        ] + transforms_from("""
whatsnew-s2d-want-privacy-on-every-device = {COPY(whatsnew, "Want privacy on every device?",)}
""",
                            whatsnew=whatsnew) +
        [
            FTL.Message(
                id=FTL.Identifier("whatsnew-s2d-you-got-it-get-firefox-for"),
                value=REPLACE(
                    whatsnew,
                    "You got it. Get Firefox for mobile.", {
                        "Firefox": TERM_REFERENCE("brand-name-firefox"),
                    })),
            FTL.Message(
                id=FTL.Identifier("whatsnew-s2d-send-firefox-to-your-phone"),
                value=REPLACE(
                    whatsnew,
                    "Send Firefox to your phone<br> and unleash your Internet.",
                    {"Firefox": TERM_REFERENCE("brand-name-firefox")})),
            FTL.Message(
                id=FTL.Identifier("whatsnew-s2d-download-firefox-for-your"),
                value=REPLACE(
                    whatsnew,
                    "Download Firefox for your smartphone and tablet.", {
                        "Firefox": TERM_REFERENCE("brand-name-firefox"),
                    })),
        ])
Exemplo n.º 16
0
def migrate(ctx):
    """Migrate about:dialog, part {index}"""

    ctx.add_transforms('browser/about_dialog.ftl', 'about_dialog.ftl', [
        FTL.Message(id=FTL.Identifier('update-failed'),
                    value=CONCAT(
                        COPY('browser/chrome/browser/aboutDialog.dtd',
                             'update.failed.start'), FTL.TextElement('<a>'),
                        COPY('browser/chrome/browser/aboutDialog.dtd',
                             'update.failed.linkText'),
                        FTL.TextElement('</a>'),
                        COPY('browser/chrome/browser/aboutDialog.dtd',
                             'update.failed.end'))),
        FTL.Message(id=FTL.Identifier('channel-description'),
                    value=CONCAT(
                        COPY('browser/chrome/browser/aboutDialog.dtd',
                             'channel.description.start'),
                        FTL.Placeable(EXTERNAL_ARGUMENT('channelname')),
                        COPY('browser/chrome/browser/aboutDialog.dtd',
                             'channel.description.end'))),
        FTL.Message(
            id=FTL.Identifier('community'),
            value=CONCAT(
                REPLACE('browser/chrome/browser/aboutDialog.dtd',
                        'community.start2', {
                            '&brandShortName;':
                            MESSAGE_REFERENCE('brand-short-name')
                        }), FTL.TextElement('<a>'),
                REPLACE('browser/chrome/browser/aboutDialog.dtd',
                        'community.mozillaLink', {
                            '&vendorShortName;':
                            MESSAGE_REFERENCE('vendor-short-name')
                        }), FTL.TextElement('</a>'),
                COPY('browser/chrome/browser/aboutDialog.dtd',
                     'community.middle2'), FTL.TextElement('<a>'),
                COPY('browser/chrome/browser/aboutDialog.dtd',
                     'community.creditsLink'), FTL.TextElement('</a>'),
                COPY('browser/chrome/browser/aboutDialog.dtd',
                     'community.end3'))),
    ])
def migrate(ctx):
    """Bug 1517508 - Migrate panicButton to use Fluent for localization, part {index}."""

    ctx.add_transforms(
        "browser/browser/panicButton.ftl", "browser/browser/panicButton.ftl",
        transforms_from("""
panic-button-open-new-window = { COPY("browser/chrome/browser/browser.dtd", "panicButton.view.openNewWindow") }
panic-button-undo-warning = { COPY("browser/chrome/browser/browser.dtd", "panicButton.view.undoWarning") }
panic-button-forget-button =
    .label = { COPY("browser/chrome/browser/browser.dtd", "panicButton.view.forgetButton") }
panic-main-timeframe-desc = { COPY("browser/chrome/browser/browser.dtd", "panicButton.view.mainTimeframeDesc") }
panic-button-5min =
    .label = { COPY("browser/chrome/browser/browser.dtd", "panicButton.view.5min") }
panic-button-2hr =
    .label = { COPY("browser/chrome/browser/browser.dtd", "panicButton.view.2hr") }
panic-button-day =
    .label = { COPY("browser/chrome/browser/browser.dtd", "panicButton.view.day") }
panic-button-action-desc = { COPY("browser/chrome/browser/browser.dtd", "panicButton.view.mainActionDesc") }
"""))

    ctx.add_transforms(
        "browser/browser/panicButton.ftl", "browser/browser/panicButton.ftl", [
            FTL.Message(
                id=FTL.Identifier("panic-button-delete-cookies"),
                value=REPLACE("browser/chrome/browser/browser.dtd",
                              "panicButton.view.deleteCookies",
                              {"html:strong>": FTL.TextElement('strong>')})),
            FTL.Message(
                id=FTL.Identifier("panic-button-delete-history"),
                value=REPLACE("browser/chrome/browser/browser.dtd",
                              "panicButton.view.deleteHistory",
                              {"html:strong>": FTL.TextElement('strong>')})),
            FTL.Message(
                id=FTL.Identifier("panic-button-delete-tabs-and-windows"),
                value=REPLACE("browser/chrome/browser/browser.dtd",
                              "panicButton.view.deleteTabsAndWindows",
                              {"html:strong>": FTL.TextElement('strong>')}))
        ])
Exemplo n.º 18
0
def migrate(ctx):
    """Bug 1732151 - Convert dataReportingNotification to Fluent, part {index}."""

    source = "browser/chrome/browser/browser.properties"
    target = "browser/browser/browser.ftl"
    ctx.add_transforms(
        target,
        target,
        [
            FTL.Message(
                id=FTL.Identifier("data-reporting-notification-message"),
                value=REPLACE(
                    source,
                    "dataReportingNotification.message",
                    {
                        "%1$S": TERM_REFERENCE("brand-short-name"),
                        "%2$S": TERM_REFERENCE("vendor-short-name"),
                    },
                ),
            ),
            FTL.Message(
                id=FTL.Identifier("data-reporting-notification-button"),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("label"),
                        value=COPY(source,
                                   "dataReportingNotification.button.label"),
                    ),
                    FTL.Attribute(
                        id=FTL.Identifier("accesskey"),
                        value=COPY(
                            source,
                            "dataReportingNotification.button.accessKey"),
                    ),
                ],
            ),
        ],
    )
def migrate(ctx):
    """Bug 1451992 - Migrate Preferences::Subdialogs::Select Bookmark to Fluent, part {index}."""

    ctx.add_transforms(
        'browser/browser/preferences/selectBookmark.ftl',
        'browser/browser/preferences/selectBookmark.ftl', [
            FTL.Message(
                id=FTL.Identifier('select-bookmark-window'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('title'),
                        COPY(
                            'browser/chrome/browser/preferences/selectBookmark.dtd',
                            'selectBookmark.title')),
                    FTL.Attribute(FTL.Identifier('style'),
                                  CONCAT(FTL.TextElement('width: 32em;')))
                ]),
            FTL.Message(
                id=FTL.Identifier('select-bookmark-desc'),
                value=COPY(
                    'browser/chrome/browser/preferences/selectBookmark.dtd',
                    'selectBookmark.label'))
        ])
Exemplo n.º 20
0
def migrate(ctx):
    """Migrate bedrock/mozorg/templates/mozorg/about/governance/policies/community-hotline.html, part {index}."""

    ctx.add_transforms(
        "mozorg/about/governance/policies/community-hotline.ftl",
        "mozorg/about/governance/policies/community-hotline.ftl",
        transforms_from("""
community-hotline-community-participation = {COPY(community_hotline, "Community Participation Guidelines - How to Report",)}
community-hotline-community-participation = {COPY(community_hotline, "Community Participation Guidelines Hotline",)}
""", community_hotline=community_hotline) + [
            FTL.Message(
                id=FTL.Identifier("community-hotline-the-heart-of-mozilla"),
                value=REPLACE(
                    community_hotline,
                    "The heart of Mozilla is people. We put people first and do our best to recognize, appreciate and respect the diversity of our global contributors. The Mozilla Project welcomes contributions from everyone who shares our goals and wants to contribute in a healthy and constructive manner within our community.",
                    {
                        "Mozilla": TERM_REFERENCE("brand-name-mozilla"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("community-hotline-to-report-violations"),
                value=REPLACE(
                    community_hotline,
                    "To report violations of the Community Participation Guidelines <strong>in Mozilla’s communities</strong>, please click the “Report” button below. For more information on how to take and give a report, please read “<a href=\"%(howto)s\">How to Report</a>”.",
                    {
                        "%%": "%",
                        "%(howto)s": VARIABLE_REFERENCE("howto"),
                        "Mozilla": TERM_REFERENCE("brand-name-mozilla"),
                    }
                )
            ),
        ] + transforms_from("""
community-hotline-report = {COPY(community_hotline, "Report",)}
""", community_hotline=community_hotline)
        )
Exemplo n.º 21
0
def migrate(ctx):
    """Bug 1728460  - Migrate appmenu-viewcache.inc.xhtml to Fluent, part {index}."""
    ctx.add_transforms(
        "browser/browser/appmenu.ftl",
        "browser/browser/appmenu.ftl",
        transforms_from(
            """
appmenuitem-print =
    .label = { COPY(from_path, "printCmd.label") }
appmenuitem-downloads =
    .label = { COPY(from_path, "libraryDownloads.label") }
appmenuitem-history =
    .label = { COPY(from_path, "historyMenu.label") }
appmenuitem-zoom =
    .value = { COPY(from_path, "fullZoom.label") }
""",
            from_path="browser/chrome/browser/browser.dtd",
        ),
    )
    ctx.add_transforms(
        "browser/browser/sync.ftl",
        "browser/browser/sync.ftl",
        transforms_from(
            """
fxa-menu-send-tab-to-device-description = { COPY(from_path, "fxa.service.sendTab.description") }
fxa-menu-send-tab-to-device-syncnotready =
    .label = { COPY(from_path, "sendToDevice.syncNotReady.label") }
""",
            from_path="browser/chrome/browser/browser.dtd",
        ),
    )
    ctx.add_transforms(
        "browser/browser/appmenu.ftl",
        "browser/browser/appmenu.ftl",
        [
            FTL.Message(
                id=FTL.Identifier("appmenuitem-fxa-sign-in"),
                value=REPLACE(
                    "browser/chrome/browser/browser.dtd",
                    "fxa.menu.signin.label",
                    {
                        "&brandProductName;":
                        TERM_REFERENCE("brand-product-name"),
                    },
                ),
            ),
        ],
    )
Exemplo n.º 22
0
def migrate(ctx):
    """Bug 1645619 - Migrate address bar placeholder to Fluent, part {index}."""

    ctx.add_transforms(
        "browser/browser/browser.ftl", "browser/browser/browser.ftl", [
            FTL.Message(
                id=FTL.Identifier("urlbar-placeholder-with-name"),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("placeholder"),
                        value=REPLACE(
                            "browser/chrome/browser/browser.properties",
                            "urlbar.placeholder", {
                                "%1$S": VARIABLE_REFERENCE("name"),
                            },
                            normalize_printf=True)),
                ])
        ])
def migrate(ctx):
    """Bug 1703003 - Migrate remove/cancel button in Bookmark panel to Fluent - part {index}"""

    ctx.add_transforms(
        "browser/browser/browser.ftl",
        "browser/browser/browser.ftl",
        transforms_from(
            """
bookmark-panel-cancel =
    .label = { COPY(from_path, "editBookmarkPanel.cancel.label") }
    .accesskey = { COPY(from_path, "editBookmarkPanel.cancel.accesskey") }
""",
            from_path="browser/chrome/browser/browser.properties",
        ),
    )

    ctx.add_transforms(
        "browser/browser/browser.ftl",
        "browser/browser/browser.ftl",
        [
            FTL.Message(
                id=FTL.Identifier("bookmark-panel-remove"),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("label"),
                        value=PLURALS(
                            "browser/chrome/browser/browser.properties",
                            "editBookmark.removeBookmarks.label",
                            VARIABLE_REFERENCE("count"),
                            lambda text: REPLACE_IN_TEXT(
                                text, {"#1": VARIABLE_REFERENCE("count")}),
                        ),
                    ),
                    FTL.Attribute(
                        id=FTL.Identifier("accesskey"),
                        value=COPY(
                            "browser/chrome/browser/browser.properties",
                            "editBookmark.removeBookmarks.accesskey",
                        ),
                    ),
                ],
            )
        ],
    )
Exemplo n.º 24
0
def migrate(ctx):
    """Bug 1502396 - Convert change and remove master password dialogs in about:preferences to use Fluent"""

    ctx.add_transforms(
        "toolkit/toolkit/preferences/preferences.ftl",
        "toolkit/toolkit/preferences/preferences.ftl",
        transforms_from(
            """
set-password =
    .title = { COPY(from_path, "setPassword.title") }
set-password-old-password = { COPY(from_path, "setPassword.oldPassword.label") }
set-password-new-password = { COPY(from_path, "setPassword.newPassword.label") }
set-password-reenter-password = { COPY(from_path, "setPassword.reenterPassword.label") }
set-password-meter = { COPY(from_path, "setPassword.meter.label") }
set-password-meter-loading = { COPY(from_path, "setPassword.meter.loading") }
master-password-warning = { COPY(from_path, "masterPasswordWarning.label") }
""",
            from_path="toolkit/chrome/mozapps/preferences/changemp.dtd") +
        [
            FTL.Message(
                id=FTL.Identifier("master-password-description"),
                value=REPLACE(
                    "toolkit/chrome/mozapps/preferences/changemp.dtd",
                    "masterPasswordDescription.label",
                    {"&brandShortName;": TERM_REFERENCE("-brand-short-name")},
                    trim=True)),
        ])

    ctx.add_transforms(
        "toolkit/toolkit/preferences/preferences.ftl",
        "toolkit/toolkit/preferences/preferences.ftl",
        transforms_from(
            """
remove-password =
    .title = { COPY(from_path, "removePassword.title") }
remove-info =
    .value = { COPY(from_path, "removeInfo.label") }
remove-warning1 = { COPY(from_path, "removeWarning1.label") }
remove-warning2 = { COPY(from_path, "removeWarning2.label") }
remove-password-old-password =
    .value = { COPY(from_path, "setPassword.oldPassword.label") }
""",
            from_path="toolkit/chrome/mozapps/preferences/removemp.dtd"))
Exemplo n.º 25
0
def migrate(ctx):
    """Bug 1731381  - Migrate profileSelection conflict message from properties to Fluent, part {index}."""
    ctx.add_transforms(
        "toolkit/toolkit/global/profileSelection.ftl",
        "toolkit/toolkit/global/profileSelection.ftl",
        [
            FTL.Message(
                id=FTL.Identifier("profile-selection-conflict-message"),
                value=REPLACE(
                    "toolkit/chrome/mozapps/profile/profileSelection.properties",
                    "conflictMessage",
                    {
                        "%1$S": TERM_REFERENCE("brand-product-name"),
                        "%2$S": TERM_REFERENCE("brand-short-name"),
                    },
                ),
            ),
        ],
    )
Exemplo n.º 26
0
def migrate(ctx):
    """Migrate bedrock/base/templates/macros.html, part {index}."""

    ctx.add_transforms(
        "send_to_device.ftl",
        "send_to_device.ftl",
        [

            FTL.Message(
                id=FTL.Identifier("send-to-device-send-firefox"),
                value=REPLACE(
                    "firefox/sendto.lang",
                    "Send Firefox to your smartphone or tablet",
                    {
                        "Firefox": TERM_REFERENCE("brand-name-firefox"),
                    }
                )
            ),
        ]
    )

    ctx.add_transforms(
        "send_to_device.ftl",
        "send_to_device.ftl",
        transforms_from("""
send-to-device-your-download-link = {COPY(send_to, "Your download link was sent.",)}
send-to-device-sorry-we-cant-send = {COPY(send_to, "Sorry, we can’t send SMS messages to this phone number.",)}
send-to-device-sorry-this-number = {COPY(send_to, "Sorry. This number isn’t valid. Please enter a U.S. phone number.",)}
send-to-device-please-enter-an-email = {COPY(send_to, "Please enter an email address.",)}
send-to-device-an-error-occured = {COPY(send_to, "An error occurred in our system. Please try again later.",)}
send-to-device-enter-your-email = {COPY(send_to, "Enter your email",)}
send-to-device-enter-your-email-or-phone = {COPY(send_to, "Enter your email or phone number",)}
send-to-device-enter-your-email-or-phone-10-digit = {COPY(send_to, "Enter your email or 10-digit phone number",)}
send-to-device-send = {COPY(send_to, "Send",)}
send-to-device-sms-service-available-in-select = {COPY(send_to, "SMS service available in select countries only. SMS &amp; data rates may apply.",)}
send-to-device-sms-service-available-to-us = {COPY(send_to, "SMS service available to U.S. phone numbers only. SMS &amp; data rates may apply.",)}
send-to-device-intended-recipient-email-sms = {COPY(send_to, "The intended recipient of the email or SMS must have consented.",)}
send-to-device-intended-recipient-email = {COPY(send_to, "The intended recipient of the email must have consented.",)}
send-to-device-check-your-device-email-sms = {COPY(send_to, "Check your device for the email or text message!",)}
send-to-device-check-your-device-email = {COPY(send_to, "Check your device for the email!",)}
send-to-device-send-to-another= {COPY(send_to, "Send to another device",)}
""", send_to=send_to)
        )
def migrate(ctx):
    """Bug 1695707 - Migrate the DRM panel message to Fluent, part {index}"""
    ctx.add_transforms(
        "browser/browser/browser.ftl",
        "browser/browser/browser.ftl",
        [
            FTL.Message(
                id=FTL.Identifier("eme-notifications-drm-content-playing"),
                value=REPLACE(
                    "browser/chrome/browser/browser.properties",
                    "emeNotifications.drmContentPlaying.message2",
                    {
                        "%1$S": TERM_REFERENCE("brand-short-name"),
                    },
                    normalize_printf=True,
                ),
            ),
        ],
    )
Exemplo n.º 28
0
def migrate(ctx):
    """Bug 1504457 -  Migrate subscribe.js strings of about:devtools to Fluent, part {index}"""

    ctx.add_transforms(
        "devtools/startup/aboutDevTools.ftl",
        "devtools/startup/aboutDevTools.ftl",
        transforms_from("""
newsletter-error-unknown = { COPY("devtools/startup/aboutdevtools.properties", "newsletter.error.unknown")}
newsletter-error-timeout = { COPY("devtools/startup/aboutdevtools.properties", "newsletter.error.timeout")}
"""))

    ctx.add_transforms(
        "devtools/startup/aboutDevTools.ftl",
        "devtools/startup/aboutDevTools.ftl", [
            FTL.Message(id=FTL.Identifier("newsletter-error-common"),
                        value=REPLACE(
                            "devtools/startup/aboutdevtools.properties",
                            "newsletter.error.common",
                            {"%S": VARIABLE_REFERENCE("errorDescription")}))
        ])
Exemplo n.º 29
0
def build_ftl(messages, dtd, data):
    res = ast.Resource()

    for id_str in messages:
        msg = messages[id_str]
        l10n_id = ast.Identifier(id_str)
        val = None
        attrs = []
        if msg['value']:
            dtd_val = get_value_from_dtd(msg['value'], dtd)
            val = ast.Pattern([ast.TextElement(dtd_val)])
        for attr_name in msg['attrs']:
            dtd_val = get_value_from_dtd(msg['attrs'][attr_name], dtd)
            attr_val = ast.Pattern([ast.TextElement(dtd_val)])
            attrs.append(ast.Attribute(ast.Identifier(attr_name), attr_val))

        m = ast.Message(l10n_id, val, attrs)
        res.body.append(m)

    serializer = FluentSerializer()
    return serializer.serialize(res)
Exemplo n.º 30
0
def migrate(ctx):
    """Migrate bedrock/mozorg/templates/mozorg/about/manifesto.html, part {index}."""

    ctx.add_transforms("mozorg/about/shared.ftl", "mozorg/about/shared.ftl", [
        FTL.Message(id=FTL.Identifier("about-shared-about-mozilla"),
                    value=REPLACE(
                        main, "About Mozilla", {
                            "Mozilla": TERM_REFERENCE("brand-name-mozilla"),
                        })),
    ] + transforms_from("""
about-shared-mission = {COPY(main, "Mission",)}
about-shared-history = {COPY(main, "History",)}
about-shared-leadership = {COPY(main, "Leadership",)}
about-shared-governance = {COPY(main, "Governance",)}
about-shared-forums = {COPY(main, "Forums",)}
about-shared-patents = {COPY(main, "Patents",)}
about-shared-our-products = {COPY(main, "Our Products",)}
about-shared-software-innovations = {COPY(main, "Software and other innovations designed to advance our mission.",)}
about-shared-get-involved = {COPY(main, "Get Involved",)}
about-shared-volunteer = {COPY(main, "Become a volunteer contributor in a number of different areas.",)}
""",
                        main=main))