def __call__(self, ctx):

        # Only replace placeables which are present in the translation.
        replacements = {
            key: evaluate(ctx, repl)
            for key, repl in self.replacements.iteritems()
            if key in self.value
        }

        # Order the original placeables by their position in the translation.
        keys_in_order = sorted(
            replacements.keys(),
            lambda x, y: self.value.find(x) - self.value.find(y)
        )

        # A list of PatternElements built from the legacy translation and the
        # FTL replacements. It may contain empty or adjacent TextElements.
        elements = []
        tail = self.value

        # Convert original placeables and text into FTL Nodes. For each
        # original placeable the translation will be partitioned around it and
        # the text before it will be converted into an `FTL.TextElement` and
        # the placeable will be replaced with its replacement.
        for key in keys_in_order:
            before, key, tail = tail.partition(key)
            elements.append(FTL.TextElement(before))
            elements.append(replacements[key])

        # Dont' forget about the tail after the loop ends.
        elements.append(FTL.TextElement(tail))

        elements = self.flatten_elements(elements)
        elements = self.prune_text_elements(elements)
        return FTL.Pattern(elements)
Пример #2
0
def migrate(ctx):
    """Bug 1663879 - convert full screen and pointer lock warnings to fluent, part {index}."""

    ctx.add_transforms(
        "browser/browser/browser.ftl", "browser/browser/browser.ftl", [
            FTL.Message(
                id=FTL.Identifier("fullscreen-warning-domain"),
                value=CONCAT_BEFORE_AFTER(
                    COPY("browser/chrome/browser/browser.dtd",
                         "fullscreenWarning.beforeDomain.label",
                         trim=True),
                    CONCAT(
                        FTL.TextElement('<span data-l10n-name="domain">'),
                        VARIABLE_REFERENCE('domain'),
                        FTL.TextElement('</span>'),
                    ),
                    COPY("browser/chrome/browser/browser.dtd",
                         "fullscreenWarning.afterDomain.label",
                         trim=True),
                ))
        ])

    ctx.add_transforms(
        "browser/browser/browser.ftl", "browser/browser/browser.ftl",
        transforms_from("""
fullscreen-warning-no-domain = { COPY(from_path, "fullscreenWarning.generic.label") }

fullscreen-exit-button = { COPY(from_path, "exitDOMFullscreen.button") }
fullscreen-exit-mac-button = { COPY(from_path, "exitDOMFullscreenMac.button") }
""",
                        from_path="browser/chrome/browser/browser.dtd"))

    ctx.add_transforms(
        "browser/browser/browser.ftl", "browser/browser/browser.ftl", [
            FTL.Message(
                id=FTL.Identifier("pointerlock-warning-domain"),
                value=CONCAT_BEFORE_AFTER(
                    COPY("browser/chrome/browser/browser.dtd",
                         "pointerlockWarning.beforeDomain.label",
                         trim=True),
                    CONCAT(
                        FTL.TextElement('<span data-l10n-name="domain">'),
                        VARIABLE_REFERENCE('domain'),
                        FTL.TextElement('</span>'),
                    ),
                    COPY("browser/chrome/browser/browser.dtd",
                         "pointerlockWarning.afterDomain.label",
                         trim=True),
                ))
        ])

    ctx.add_transforms(
        "browser/browser/browser.ftl", "browser/browser/browser.ftl",
        transforms_from("""
pointerlock-warning-no-domain = { COPY(from_path, "pointerlockWarning.generic.label") }
""",
                        from_path="browser/chrome/browser/browser.dtd"))
Пример #3
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",
                                         ),
                                    ),
            )
        ]
    )
def migrate(ctx):
    """Bug 863474 - Migrate search prompts to fluent, part {index}."""

    ctx.add_transforms(
        "browser/browser/search.ftl", "browser/browser/search.ftl",
        transforms_from("""
opensearch-error-duplicate-title = { COPY(from_path, "error_invalid_engine_title") }
""",
                        from_path="toolkit/chrome/search/search.properties"))

    ctx.add_transforms(
        "browser/browser/search.ftl", "browser/browser/search.ftl", [
            FTL.Message(id=FTL.Identifier("opensearch-error-duplicate-desc"),
                        value=REPLACE(
                            "toolkit/chrome/search/search.properties",
                            "error_duplicate_engine_msg", {
                                "%1$S": TERM_REFERENCE("brand-short-name"),
                                "%2$S": VARIABLE_REFERENCE("location-url"),
                            },
                            normalize_printf=True))
        ])

    ctx.add_transforms(
        "browser/browser/search.ftl", "browser/browser/search.ftl",
        transforms_from("""
opensearch-error-format-title = { COPY(from_path, "error_invalid_format_title") }
""",
                        from_path="toolkit/chrome/search/search.properties"))

    ctx.add_transforms(
        "browser/browser/search.ftl", "browser/browser/search.ftl", [
            FTL.Message(id=FTL.Identifier("opensearch-error-format-desc"),
                        value=REPLACE(
                            "toolkit/chrome/search/search.properties",
                            "error_invalid_engine_msg2", {
                                "%1$S": TERM_REFERENCE("brand-short-name"),
                                "%2$S": VARIABLE_REFERENCE("location-url"),
                            },
                            normalize_printf=True))
        ])

    ctx.add_transforms(
        "browser/browser/search.ftl", "browser/browser/search.ftl",
        transforms_from("""
opensearch-error-download-title = { COPY(from_path, "error_loading_engine_title") }
""",
                        from_path="toolkit/chrome/search/search.properties"))

    ctx.add_transforms(
        "browser/browser/search.ftl", "browser/browser/search.ftl", [
            FTL.Message(id=FTL.Identifier("opensearch-error-download-desc"),
                        value=REPLACE(
                            "toolkit/chrome/search/search.properties",
                            "error_loading_engine_msg2", {
                                "%1$S": TERM_REFERENCE("brand-short-name"),
                                "%2$S": VARIABLE_REFERENCE("location-url"),
                                "\n": FTL.TextElement(" "),
                            },
                            normalize_printf=True))
        ])
Пример #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()
Пример #6
0
        def replace(acc, cur):
            """Convert original placeables and text into FTL Nodes.

            For each original placeable the translation will be partitioned
            around it and the text before it will be converted into an
            `FTL.TextElement` and the placeable will be replaced with its
            replacement. The text following the placebale will be fed again to
            the `replace` function.
            """

            parts, rest = acc
            before, key, after = rest.value.partition(cur)

            placeable = FTL.Placeable(replacements[key])

            # Return the elements found and converted so far, and the remaining
            # text which hasn't been scanned for placeables yet.
            return (parts + [FTL.TextElement(before), placeable],
                    FTL.TextElement(after))
Пример #7
0
    def __call__(self, ctx):
        # For each specified replacement, find all indices of the original
        # placeable in the source translation. If missing, the list of indices
        # will be empty.
        value = self.element.value
        if self.normalize_printf:
            value = normalize_printf(value)
        key_indices = {
            key: [m.start() for m in re.finditer(re.escape(key), value)]
            for key in self.replacements.keys()
        }

        # Build a dict of indices to replacement keys.
        keys_indexed = {}
        for key, indices in key_indices.items():
            for index in indices:
                keys_indexed[index] = key

        # Order the replacements by the position of the original placeable in
        # the translation.
        replacements = (
            (key, ctx.evaluate(self.replacements[key]))
            for index, key in sorted(keys_indexed.items(), key=lambda x: x[0]))

        # A list of PatternElements built from the legacy translation and the
        # FTL replacements. It may contain empty or adjacent TextElements.
        elements = []
        tail = value

        # Convert original placeables and text into FTL Nodes. For each
        # original placeable the translation will be partitioned around it and
        # the text before it will be converted into an `FTL.TextElement` and
        # the placeable will be replaced with its replacement.
        for key, node in replacements:
            before, key, tail = tail.partition(key)
            elements.append(FTL.TextElement(before))
            elements.append(node)

        # Don't forget about the tail after the loop ends.
        elements.append(FTL.TextElement(tail))
        return Transform.pattern_of(*elements)
Пример #8
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)
Пример #9
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"),
                ),
            ),
        ])
Пример #10
0
    def __call__(self, ctx):
        element = super(PLURALS, self).__call__(ctx)
        selector = ctx.evaluate(self.selector)
        keys = ctx.plural_categories
        forms = [FTL.TextElement(part) for part in element.value.split(';')]

        # The default CLDR form should be the last we have in DEFAULT_ORDER,
        # usually `other`, but in some cases `many`. If we don't have a variant
        # for that, we'll append one, using the, in CLDR order, last existing
        # variant in the legacy translation. That may or may not be the last
        # variant.
        default_key = [
            key for key in reversed(self.DEFAULT_ORDER) if key in keys
        ][0]

        # Match keys to legacy forms in the order they are defined in Gecko's
        # PluralForm.jsm. Filter out empty forms.
        pairs = [(key, var) for key, var in zip(keys, forms) if var.value]

        # A special case for legacy translations which don't define any
        # plural forms.
        if len(pairs) == 0:
            return Transform.pattern_of()

        # A special case for languages with one plural category or one legacy
        # variant. We don't need to insert a SelectExpression for them.
        if len(pairs) == 1:
            _, only_form = pairs[0]
            only_variant = ctx.evaluate(self.foreach(only_form))
            return Transform.pattern_of(only_variant)

        # Make sure the default key is defined. If it's missing, use the last
        # form (in CLDR order) found in the legacy translation.
        pairs.sort(key=lambda pair: self.DEFAULT_ORDER.index(pair[0]))
        last_key, last_form = pairs[-1]
        if last_key != default_key:
            pairs.append((default_key, last_form))

        def createVariant(key, form):
            # Run the legacy plural form through `foreach` which returns an
            # `FTL.Node` describing the transformation required for each
            # variant. Then evaluate it to a migrated FTL node.
            value = ctx.evaluate(self.foreach(form))
            return FTL.Variant(key=FTL.Identifier(key),
                               value=value,
                               default=key == default_key)

        select = FTL.SelectExpression(
            selector=selector,
            variants=[createVariant(key, form) for key, form in pairs])

        return Transform.pattern_of(select)
Пример #11
0
    def pattern_of(*elements):
        normalized = []

        # Normalize text content: convert text content to TextElements, join
        # adjacent text and prune empty. Text content is either existing
        # TextElements or whitespace-only StringLiterals. This may result in
        # leading and trailing whitespace being put back into TextElements if
        # the new Pattern is built from existing Patterns (CONCAT(COPY...)).
        # The leading and trailing whitespace of the new Pattern will be
        # extracted later into new StringLiterals.
        for element in chain_elements(elements):
            if isinstance(element, FTL.TextElement):
                text_content = element.value
            elif isinstance(element, FTL.Placeable) \
                    and isinstance(element.expression, FTL.StringLiteral) \
                    and re.match(r'^ *$', element.expression.value):
                text_content = element.expression.value
            else:
                # The element does not contain text content which should be
                # normalized. It may be a number, a reference, or
                # a StringLiteral which should be preserved in the Pattern.
                normalized.append(element)
                continue

            previous = normalized[-1] if len(normalized) else None
            if isinstance(previous, FTL.TextElement):
                # Join adjacent TextElements.
                previous.value += text_content
            elif len(text_content) > 0:
                # Normalize non-empty text to a TextElement.
                normalized.append(FTL.TextElement(text_content))
            else:
                # Prune empty text.
                pass

        # Store empty values explicitly as {""}.
        if len(normalized) == 0:
            empty = FTL.Placeable(FTL.StringLiteral(''))
            return FTL.Pattern([empty])

        # Extract explicit leading whitespace into a StringLiteral.
        if isinstance(normalized[0], FTL.TextElement):
            ws, text = extract_whitespace(re_leading_ws, normalized[0])
            normalized[:1] = [ws, text]

        # Extract explicit trailing whitespace into a StringLiteral.
        if isinstance(normalized[-1], FTL.TextElement):
            ws, text = extract_whitespace(re_trailing_ws, normalized[-1])
            normalized[-1:] = [text, ws]

        return FTL.Pattern(
            [element for element in normalized if element is not None])
Пример #12
0
    def __call__(self, ctx):

        # Only replace placeable which are present in the translation.
        replacements = {
            key: evaluate(ctx, repl)
            for key, repl in self.replacements.iteritems()
            if key in self.value
        }

        # Order the original placeables by their position in the translation.
        keys_in_order = sorted(
            replacements.keys(),
            lambda x, y: self.value.find(x) - self.value.find(y)
        )

        # Used to reduce the `keys_in_order` list.
        def replace(acc, cur):
            """Convert original placeables and text into FTL Nodes.

            For each original placeable the translation will be partitioned
            around it and the text before it will be converted into an
            `FTL.TextElement` and the placeable will be replaced with its
            replacement. The text following the placebale will be fed again to
            the `replace` function.
            """

            parts, rest = acc
            before, key, after = rest.value.partition(cur)

            placeable = FTL.Placeable(replacements[key])

            # Return the elements found and converted so far, and the remaining
            # text which hasn't been scanned for placeables yet.
            return (
                parts + [FTL.TextElement(before), placeable],
                FTL.TextElement(after)
            )

        def is_non_empty(elem):
            """Used for filtering empty `FTL.TextElement` nodes out."""
            return not isinstance(elem, FTL.TextElement) or len(elem.value)

        # Start with an empty list of elements and the original translation.
        init = ([], FTL.TextElement(self.value))
        parts, tail = reduce(replace, keys_in_order, init)

        # Explicitly concat the trailing part to get the full list of elements
        # and filter out the empty ones.
        elements = filter(is_non_empty, parts + [tail])

        return FTL.Pattern(elements)
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>')}))
        ])
 def prune_text_elements(elements):
     '''Join adjacent TextElements and remove empty ones'''
     pruned = []
     # Group elements in contiguous sequences of the same type.
     for elem_type, elems in itertools.groupby(elements, key=type):
         if elem_type is FTL.TextElement:
             # Join adjacent TextElements.
             text = FTL.TextElement(''.join(elem.value for elem in elems))
             # And remove empty ones.
             if len(text.value) > 0:
                 pruned.append(text)
         else:
             pruned.extend(elems)
     return pruned
Пример #15
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')),
        ])
Пример #16
0
    def pattern_of(*elements):
        normalized = []

        # Normalize text content: convert all text to TextElements, join
        # adjacent text and prune empty.
        for current in chain_elements(elements):
            current_text = get_text(current)
            if current_text is None:
                normalized.append(current)
                continue

            previous = normalized[-1] if len(normalized) else None
            if isinstance(previous, FTL.TextElement):
                # Join adjacent TextElements
                previous.value += current_text
            elif len(current_text) > 0:
                # Normalize non-empty text to a TextElement
                normalized.append(FTL.TextElement(current_text))
            else:
                # Prune empty text
                pass

        # Handle empty values
        if len(normalized) == 0:
            empty = FTL.Placeable(FTL.StringLiteral(''))
            return FTL.Pattern([empty])

        # Handle explicit leading whitespace
        if isinstance(normalized[0], FTL.TextElement):
            ws, text = extract_whitespace(re_leading_ws, normalized[0])
            normalized[:1] = [ws, text]

        # Handle explicit trailing whitespace
        if isinstance(normalized[-1], FTL.TextElement):
            ws, text = extract_whitespace(re_trailing_ws, normalized[-1])
            normalized[-1:] = [text, ws]

        return FTL.Pattern(
            [element for element in normalized if element is not None])
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'))
        ])
Пример #18
0
def extract_whitespace(regex, element):
    '''Extract leading or trailing whitespace from a TextElement.

    Return a tuple of (Placeable, TextElement) in which the Placeable
    encodes the extracted whitespace as a StringLiteral and the
    TextElement has the same amount of whitespace removed. The
    Placeable with the extracted whitespace is always returned first.
    If the element starts or ends with a newline, add an empty
    StringLiteral.
    '''
    match = re.search(regex, element.value)
    if match:
        # If white-space is None, we're a newline. Add an
        # empty { "" }
        whitespace = match.group('whitespace') or ''
        placeable = FTL.Placeable(FTL.StringLiteral(whitespace))
        if whitespace == element.value:
            return placeable, None
        else:
            # Either text or block_text matched the rest.
            text = match.group('text') or match.group('block_text')
            return placeable, FTL.TextElement(text)
    else:
        return None, element
Пример #19
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 1438375 - Migrate Extension Controlled settings in Preferences to Fluent, part {index}."""

    ctx.add_transforms(
        'browser/browser/preferences/preferences.ftl',
        'browser/browser/preferences/preferences.ftl', [
            FTL.Message(
                id=FTL.Identifier('extension-controlled-homepage-override'),
                value=REPLACE(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'extensionControlled.homepage_override2', {
                        '%S':
                        CONCAT(
                            FTL.TextElement('<img data-l10n-name="icon"/> '),
                            EXTERNAL_ARGUMENT('name'))
                    })),
            FTL.Message(
                id=FTL.Identifier('extension-controlled-new-tab-url'),
                value=REPLACE(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'extensionControlled.newTabURL2', {
                        '%S':
                        CONCAT(
                            FTL.TextElement('<img data-l10n-name="icon"/> '),
                            EXTERNAL_ARGUMENT('name'))
                    })),
            FTL.Message(
                id=FTL.Identifier('extension-controlled-default-search'),
                value=REPLACE(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'extensionControlled.defaultSearch', {
                        '%S':
                        CONCAT(
                            FTL.TextElement('<img data-l10n-name="icon"/> '),
                            EXTERNAL_ARGUMENT('name'))
                    })),
            FTL.Message(
                id=FTL.Identifier('extension-controlled-privacy-containers'),
                value=REPLACE(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'extensionControlled.privacy.containers', {
                        '%S':
                        CONCAT(
                            FTL.TextElement('<img data-l10n-name="icon"/> '),
                            EXTERNAL_ARGUMENT('name'))
                    })),
            FTL.Message(
                id=FTL.Identifier(
                    'extension-controlled-websites-tracking-protection-mode'),
                value=REPLACE(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'extensionControlled.websites.trackingProtectionMode', {
                        '%S':
                        CONCAT(
                            FTL.TextElement('<img data-l10n-name="icon"/> '),
                            EXTERNAL_ARGUMENT('name'))
                    })),
            FTL.Message(
                id=FTL.Identifier('extension-controlled-proxy-config'),
                value=REPLACE(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'extensionControlled.proxyConfig', {
                        '%1$S':
                        CONCAT(
                            FTL.TextElement('<img data-l10n-name="icon"/> '),
                            EXTERNAL_ARGUMENT('name')),
                        '%2$S':
                        MESSAGE_REFERENCE('-brand-short-name'),
                    })),
            FTL.Message(
                id=FTL.Identifier('extension-controlled-enable'),
                value=REPLACE(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'extensionControlled.enable', {
                        '%1$S':
                        FTL.TextElement('<img data-l10n-name="addons-icon"/>'),
                        '%2$S':
                        FTL.TextElement('<img data-l10n-name="menu-icon"/>'),
                    })),
            FTL.Message(
                id=FTL.Identifier('network-proxy-connection-description'),
                value=REPLACE(
                    'browser/chrome/browser/preferences/preferences.properties',
                    'connectionDesc.label', {
                        '%S': MESSAGE_REFERENCE('-brand-short-name'),
                    })),
        ])
Пример #21
0
def migrate(ctx):
	"""Bug 1549561 - Migrate strings from pipnss.properties to aboutCertError.ftl"""
	ctx.add_transforms(
		'browser/browser/aboutCertError.ftl',
		'browser/browser/aboutCertError.ftl',
        transforms_from(
"""
cert-error-mitm-intro = { COPY(from_path, "certErrorMitM") }
cert-error-trust-unknown-issuer-intro = { COPY(from_path, "certErrorTrust_UnknownIssuer4") }
cert-error-trust-cert-invalid = { COPY(from_path, "certErrorTrust_CaInvalid") }
cert-error-trust-untrusted-issuer = { COPY(from_path, "certErrorTrust_Issuer") }
cert-error-trust-signature-algorithm-disabled = { COPY(from_path, "certErrorTrust_SignatureAlgorithmDisabled") }
cert-error-trust-expired-issuer = { COPY(from_path, "certErrorTrust_ExpiredIssuer") }
cert-error-trust-self-signed = { COPY(from_path, "certErrorTrust_SelfSigned") }
cert-error-trust-symantec = { COPY(from_path, "certErrorTrust_Symantec1") }
cert-error-untrusted-default = { COPY(from_path, "certErrorTrust_Untrusted") }
""", from_path="security/manager/chrome/pipnss/pipnss.properties"))
	ctx.add_transforms(
		'browser/browser/aboutCertError.ftl',
                'browser/browser/aboutCertError.ftl',
		[
			FTL.Message(
				id=FTL.Identifier('cert-error-intro'),
				value=REPLACE(
					'security/manager/chrome/pipnss/pipnss.properties',
					'certErrorIntro',
					{
						"%1$S": VARIABLE_REFERENCE("hostname"),
					},
					normalize_printf=True
				)
			),
			FTL.Message(
				id=FTL.Identifier('cert-error-mitm-mozilla'),
				value=REPLACE(
					'security/manager/chrome/pipnss/pipnss.properties',
					'certErrorMitM2',
					{
						"%1$S": TERM_REFERENCE("brand-short-name"),
					},
					normalize_printf=True
				)
			),
			FTL.Message(
				id=FTL.Identifier('cert-error-mitm-connection'),
				value=REPLACE(
					'security/manager/chrome/pipnss/pipnss.properties',
					'certErrorMitM3',
					{
						"%1$S": TERM_REFERENCE("brand-short-name"),
                                        },
                                        normalize_printf=True
                                )
                        ),
			FTL.Message(
				id=FTL.Identifier('cert-error-trust-unknown-issuer'),
				value=REPLACE(
					'security/manager/chrome/pipnss/pipnss.properties',
					'certErrorTrust_UnknownIssuer6',
					{
						"%1$S": TERM_REFERENCE("brand-short-name"),
						"%2$S": VARIABLE_REFERENCE("hostname"),
					},
					normalize_printf=True
                                )
                        ),
                        FTL.Message(
				id=FTL.Identifier('cert-error-domain-mismatch'),
				value=REPLACE(
					'security/manager/chrome/pipnss/pipnss.properties',
					'certErrorMismatch3',
					{
						"%1$S": TERM_REFERENCE("brand-short-name"),
                                                "%2$S": VARIABLE_REFERENCE("hostname"),
                                        },
                                        normalize_printf=True
                                )
                        ),
			FTL.Message(
                                id=FTL.Identifier('cert-error-domain-mismatch-single-nolink'),
				value=CONCAT(
					REPLACE(
						'security/manager/chrome/pipnss/pipnss.properties',
						'certErrorMismatchSinglePrefix3',
                                        	{
                                                	"%1$S": TERM_REFERENCE("brand-short-name"),
                                        	        "%2$S": VARIABLE_REFERENCE("hostname"),
                                        	},
                                        	normalize_printf=True
                                	),
					FTL.TextElement(' '),
					REPLACE(
						'security/manager/chrome/pipnss/pipnss.properties',
						'certErrorMismatchSinglePrefix',
						{
							"%1$S": VARIABLE_REFERENCE("alt-name"),
						},
						normalize_printf=True
                                        ),
                        	),
			),
			FTL.Message(
                                id=FTL.Identifier('cert-error-domain-mismatch-single'),
				value=CONCAT(
					REPLACE(
                                                'security/manager/chrome/pipnss/pipnss.properties',
                                                'certErrorMismatchSinglePrefix3',
                                                {
                                                        "%1$S": TERM_REFERENCE("brand-short-name"),
                                                        "%2$S": VARIABLE_REFERENCE("hostname"),
                                                },
                                                normalize_printf=True
                                        ),
					FTL.TextElement(' '),
					REPLACE(
                                                'security/manager/chrome/pipnss/pipnss.properties',
                                                'certErrorMismatchSinglePrefix',
                                                {
                                                        "%S": CONCAT(
								FTL.TextElement('<a data-l10n-name="domain-mismatch-link">'),
								VARIABLE_REFERENCE("alt-name"),
								FTL.TextElement('</a>'),
							),
                                                },
                                        ),
				),
			),
			FTL.Message(
                                id=FTL.Identifier('cert-error-domain-mismatch-multiple'),
				value=CONCAT(
					REPLACE(
						'security/manager/chrome/pipnss/pipnss.properties',
						'certErrorMismatchMultiple3',
						{
							"%1$S": TERM_REFERENCE("brand-short-name"),
                                                	"%2$S": VARIABLE_REFERENCE("hostname"),
						},
						normalize_printf=True
                                	),
					FTL.TextElement(' '),
					VARIABLE_REFERENCE("subject-alt-names"),
				),
			),
			FTL.Message(
                                id=FTL.Identifier('cert-error-expired-now'),
				value=REPLACE(
                                        'security/manager/chrome/pipnss/pipnss.properties',
					'certErrorExpiredNow3',
					{
						"%1$S": VARIABLE_REFERENCE("hostname"),
						"%2$S": VARIABLE_REFERENCE("not-after-local-time"),
					},
                                        normalize_printf=True
                                ),
                        ),
			FTL.Message(
                                id=FTL.Identifier('cert-error-not-yet-valid-now'),
				value=REPLACE(
                                        'security/manager/chrome/pipnss/pipnss.properties',
					'certErrorNotYetValidNow3',
					{
						"%1$S": VARIABLE_REFERENCE("hostname"),
                                                "%2$S": VARIABLE_REFERENCE("not-before-local-time"),
					},
                                        normalize_printf=True
                                ),
                        ),
			FTL.Message(
                                id=FTL.Identifier('cert-error-code-prefix-link'),
				value=REPLACE(
                                        'security/manager/chrome/pipnss/pipnss.properties',
					'certErrorCodePrefix3',
					{
						"%1$S": CONCAT(
							FTL.TextElement('<a data-l10n-name="error-code-link">'),
							VARIABLE_REFERENCE("error"),
							FTL.TextElement('</a>'),
						),
					},
					normalize_printf=True
				),
			),
		]
	)
Пример #22
0
def migrate(ctx):
    """Bug 1491672 - Migrate About Dialog to use Fluent for localization, part {index}."""

    ctx.add_transforms(
        "browser/browser/aboutDialog.ftl", "browser/browser/aboutDialog.ftl",
        transforms_from("""
releaseNotes-link = { COPY("browser/chrome/browser/aboutDialog.dtd", "releaseNotes.link") }

update-checkForUpdatesButton =
    .label = { COPY("browser/chrome/browser/aboutDialog.dtd", "update.checkForUpdatesButton.label") }
    .accesskey = { COPY("browser/chrome/browser/aboutDialog.dtd", "update.checkForUpdatesButton.accesskey") }

update-checkingForUpdates = { COPY("browser/chrome/browser/aboutDialog.dtd", "update.checkingForUpdates")}
update-applying = { COPY("browser/chrome/browser/aboutDialog.dtd", "update.applying")}

update-adminDisabled = { COPY("browser/chrome/browser/aboutDialog.dtd", "update.adminDisabled") }

update-restarting = { COPY("browser/chrome/browser/aboutDialog.dtd", "update.restarting") }

bottomLinks-license = { COPY("browser/chrome/browser/aboutDialog.dtd", "bottomLinks.license") }
bottomLinks-rights = { COPY("browser/chrome/browser/aboutDialog.dtd", "bottomLinks.rights") }
bottomLinks-privacy = { COPY("browser/chrome/browser/aboutDialog.dtd", "bottomLinks.privacy") }

aboutDialog-architecture-sixtyFourBit = { COPY("browser/chrome/browser/browser.properties", "aboutDialog.architecture.sixtyFourBit") }
aboutDialog-architecture-thirtyTwoBit = { COPY("browser/chrome/browser/browser.properties", "aboutDialog.architecture.thirtyTwoBit") }
"""))

    ctx.add_transforms(
        "browser/browser/aboutDialog.ftl", "browser/browser/aboutDialog.ftl", [
            FTL.Message(id=FTL.Identifier("aboutDialog-title"),
                        attributes=[
                            FTL.Attribute(
                                id=FTL.Identifier("title"),
                                value=REPLACE(
                                    "browser/chrome/browser/aboutDialog.dtd",
                                    "aboutDialog.title", {
                                        "&brandFullName;":
                                        TERM_REFERENCE("-brand-full-name")
                                    }))
                        ]),
            FTL.Message(
                id=FTL.Identifier("update-updateButton"),
                attributes=[
                    FTL.Attribute(id=FTL.Identifier("label"),
                                  value=REPLACE(
                                      "browser/chrome/browser/aboutDialog.dtd",
                                      "update.updateButton.label3", {
                                          "&brandShorterName;":
                                          TERM_REFERENCE("-brand-shorter-name")
                                      })),
                    FTL.Attribute(id=FTL.Identifier("accesskey"),
                                  value=COPY(
                                      "browser/chrome/browser/aboutDialog.dtd",
                                      "update.updateButton.accesskey"))
                ]),
            FTL.Message(id=FTL.Identifier("update-downloading"),
                        value=CONCAT(
                            FTL.TextElement('<img data-l10n-name="icon"/>'),
                            COPY("browser/chrome/browser/aboutDialog.dtd",
                                 "update.downloading.start"),
                            FTL.TextElement(
                                '<label data-l10n-name="download-status"/>'))),
            FTL.Message(
                id=FTL.Identifier("update-failed"),
                value=CONCAT(
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "update.failed.start"),
                    FTL.TextElement('<label data-l10n-name="failed-link">'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "update.failed.linkText"),
                    FTL.TextElement('</label>'))),
            FTL.Message(
                id=FTL.Identifier("update-failed-main"),
                value=CONCAT(
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "update.failed.start"),
                    FTL.TextElement('<a data-l10n-name="failed-link-main">'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "update.failed.linkText"), FTL.TextElement('</a>'))),
            FTL.Message(
                id=FTL.Identifier("update-noUpdatesFound"),
                value=REPLACE(
                    "browser/chrome/browser/aboutDialog.dtd",
                    "update.noUpdatesFound",
                    {"&brandShortName;": TERM_REFERENCE("-brand-short-name")
                     })),
            FTL.Message(
                id=FTL.Identifier("update-otherInstanceHandlingUpdates"),
                value=REPLACE(
                    "browser/chrome/browser/aboutDialog.dtd",
                    "update.otherInstanceHandlingUpdates",
                    {"&brandShortName;": TERM_REFERENCE("-brand-short-name")
                     })),
            FTL.Message(
                id=FTL.Identifier("update-manual"),
                value=CONCAT(
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "update.manual.start"),
                    FTL.TextElement('<label data-l10n-name="manual-link"/>'))),
            FTL.Message(id=FTL.Identifier("update-unsupported"),
                        value=CONCAT(
                            COPY("browser/chrome/browser/aboutDialog.dtd",
                                 "update.unsupported.start"),
                            FTL.TextElement(
                                '<label data-l10n-name="unsupported-link">'),
                            COPY("browser/chrome/browser/aboutDialog.dtd",
                                 "update.unsupported.linkText"),
                            FTL.TextElement('</label>'))),
            FTL.Message(
                id=FTL.Identifier("channel-description"),
                value=CONCAT(
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "channel.description.start"),
                    FTL.TextElement(
                        '<label data-l10n-name="current-channel"></label>'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "channel.description.end"))),
            FTL.Message(
                id=FTL.Identifier("warningDesc-version"),
                value=REPLACE(
                    "browser/chrome/browser/aboutDialog.dtd",
                    "warningDesc.version",
                    {"&brandShortName;": TERM_REFERENCE("-brand-short-name")
                     })),
            FTL.Message(
                id=FTL.Identifier("community-exp"),
                value=CONCAT(
                    FTL.TextElement(
                        '<label data-l10n-name="community-exp-mozillaLink">'),
                    REPLACE("browser/chrome/browser/aboutDialog.dtd",
                            "community.exp.mozillaLink", {
                                "&vendorShortName;":
                                TERM_REFERENCE("-vendor-short-name")
                            }), FTL.TextElement('</label>'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "community.exp.middle"),
                    FTL.TextElement(
                        '<label data-l10n-name="community-exp-creditsLink">'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "community.exp.creditsLink"),
                    FTL.TextElement('</label>'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "community.exp.end"))),
            FTL.Message(
                id=FTL.Identifier("community-2"),
                value=CONCAT(
                    REPLACE("browser/chrome/browser/aboutDialog.dtd",
                            "community.start2", {
                                "&brandShortName;":
                                TERM_REFERENCE("-brand-short-name")
                            }),
                    FTL.TextElement(
                        '<label data-l10n-name="community-mozillaLink">'),
                    REPLACE("browser/chrome/browser/aboutDialog.dtd",
                            "community.mozillaLink", {
                                "&vendorShortName;":
                                TERM_REFERENCE("-vendor-short-name")
                            }), FTL.TextElement('</label>'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "community.middle2"),
                    FTL.TextElement(
                        '<label data-l10n-name="community-creditsLink">'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "community.creditsLink"), FTL.TextElement('</label>'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "community.end3"))),
            FTL.Message(
                id=FTL.Identifier("helpus"),
                value=CONCAT(
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "helpus.start"),
                    FTL.TextElement(
                        '<label data-l10n-name="helpus-donateLink">'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "helpus.donateLink"), FTL.TextElement('</label>'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "helpus.middle"),
                    FTL.TextElement(
                        '<label data-l10n-name="helpus-getInvolvedLink">'),
                    COPY("browser/chrome/browser/aboutDialog.dtd",
                         "helpus.getInvolvedLink"),
                    FTL.TextElement('</label>'))),
        ])
    ctx.add_transforms(
        "browser/branding/official/brand.ftl",
        "browser/branding/official/brand.ftl",
        transforms_from("""
-brand-short-name = { COPY("browser/branding/official/brand.dtd", "brandShortName") }
-vendor-short-name = { COPY("browser/branding/official/brand.dtd", "vendorShortName") }
-brand-full-name = { COPY("browser/branding/official/brand.dtd", "brandFullName") }
-brand-shorter-name = { COPY("browser/branding/official/brand.dtd", "brandShorterName") }
trademarkInfo = { COPY("browser/branding/official/brand.dtd", "trademarkInfo.part1") }

"""))
Пример #23
0
def LITERAL(value):
    """Create a Pattern with a single TextElement."""
    elements = [FTL.TextElement(value)]
    return FTL.Pattern(elements)
Пример #24
0
def migrate(ctx):
    """Bug 1523734 - Move Strings from phishing-afterload-warning-message.dtd to Fluent, part {index}"""
    ctx.add_transforms(
        "browser/browser/safebrowsing/blockedSite.ftl",
        "browser/browser/safebrowsing/blockedSite.ftl",
        transforms_from(
"""
safeb-blocked-phishing-page-title = { COPY(from_path,"safeb.blocked.phishingPage.title3") }
safeb-blocked-malware-page-title = { COPY(from_path,"safeb.blocked.malwarePage.title2") }
safeb-blocked-unwanted-page-title = { COPY(from_path,"safeb.blocked.unwantedPage.title2") }
safeb-blocked-harmful-page-title = { COPY(from_path,"safeb.blocked.harmfulPage.title") }
safeb-palm-accept-label = { COPY(from_path,"safeb.palm.accept.label2") }
safeb-palm-see-details-label = { COPY(from_path,"safeb.palm.seedetails.label") }
safeb-palm-notdeceptive =
    .label = { COPY(from_path,"safeb.palm.notdeceptive.label") }
    .accesskey = { COPY(from_path,"safeb.palm.notdeceptive.accesskey") }
""", from_path="browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd"
        )
    )

    ctx.add_transforms(
        "browser/browser/safebrowsing/blockedSite.ftl",
        "browser/browser/safebrowsing/blockedSite.ftl",
        [
            FTL.Message(
                id=FTL.Identifier("safeb-palm-advisory-desc"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.palm.advisory.desc2",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "/>": FTL.TextElement(">{ $advisoryname }</a>"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-malware-page-short-desc"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.malwarePage.shortDesc2",
                    {
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-malware-page-error-desc-override"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.malwarePage.errorDesc.override",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "/>": FTL.TextElement(">{ $sitename }</span>"),
                        "malware_sitename": FTL.TextElement("sitename"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-malware-page-error-desc-no-override"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.malwarePage.errorDesc.noOverride",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "/>": FTL.TextElement(">{ $sitename }</span>"),
                        "malware_sitename": FTL.TextElement("sitename"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-malware-page-learn-more"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.malwarePage.learnMore",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-unwanted-page-short-desc"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.unwantedPage.shortDesc2",
                    {
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-unwanted-page-error-desc-override"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.unwantedPage.errorDesc.override",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "/>": FTL.TextElement(">{ $sitename }</span>"),
                        "unwanted_sitename": FTL.TextElement("sitename"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-unwanted-page-error-desc-no-override"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.unwantedPage.errorDesc.noOverride",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "/>": FTL.TextElement(">{ $sitename }</span>"),
                        "unwanted_sitename": FTL.TextElement("sitename"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-unwanted-page-learn-more"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.unwantedPage.learnMore",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-phishing-page-short-desc"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.phishingPage.shortDesc3",
                    {
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-phishing-page-error-desc-override"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.phishingPage.errorDesc.override",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "/>": FTL.TextElement(">{ $sitename }</span>"),
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                        "phishing_sitename": FTL.TextElement("sitename"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-phishing-page-error-desc-no-override"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.phishingPage.errorDesc.noOverride",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "/>": FTL.TextElement(">{ $sitename }</span>"),
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                        "phishing_sitename": FTL.TextElement("sitename"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-phishing-page-learn-more"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.phishingPage.learnMore",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-harmful-page-short-desc"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.harmfulPage.shortDesc2",
                    {
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-harmful-page-error-desc-override"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.harmfulPage.errorDesc.override",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "/>": FTL.TextElement(">{ $sitename }</span>"),
                        "harmful_sitename": FTL.TextElement("sitename"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-harmful-page-error-desc-no-override"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.harmfulPage.errorDesc.noOverride",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "/>": FTL.TextElement(">{ $sitename }</span>"),
                        "harmful_sitename": FTL.TextElement("sitename"),
                    }
                )
            ),
            FTL.Message(
                id=FTL.Identifier("safeb-blocked-harmful-page-learn-more"),
                value=REPLACE(
                    "browser/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd",
                    "safeb.blocked.harmfulPage.learnMore",
                    {
                        "id=": FTL.TextElement("data-l10n-name="),
                        "&brandShortName;": TERM_REFERENCE("brand-short-name"),
                    }
                )
            ),
        ]
    )
Пример #25
0
def migrate(ctx):
    """Bug 1517529 - Migrate safeMode from DTD to Fluent, part {index}."""

    ctx.add_transforms(
        'browser/browser/safeMode.ftl', 'browser/browser/safeMode.ftl', [
            FTL.Message(
                id=FTL.Identifier('safe-mode-window'),
                attributes=[
                    FTL.Attribute(FTL.Identifier('title'),
                                  value=REPLACE(
                                      'browser/chrome/browser/safeMode.dtd',
                                      'safeModeDialog.title', {
                                          "&brandShortName;":
                                          TERM_REFERENCE("brand-short-name")
                                      })),
                    FTL.Attribute(
                        FTL.Identifier('style'),
                        value=CONCAT(
                            FTL.TextElement('max-width: '),
                            COPY('browser/chrome/browser/safeMode.dtd',
                                 'window.maxWidth'), FTL.TextElement('px')))
                ]),
        ]),
    ctx.add_transforms(
        'browser/browser/safeMode.ftl', 'browser/browser/safeMode.ftl',
        transforms_from("""
start-safe-mode = 
    .label = { COPY("browser/chrome/browser/safeMode.dtd", "startSafeMode.label") }
""")),
    ctx.add_transforms(
        'browser/browser/safeMode.ftl', 'browser/browser/safeMode.ftl', [
            FTL.Message(id=FTL.Identifier('refresh-profile'),
                        attributes=[
                            FTL.Attribute(
                                FTL.Identifier('label'),
                                value=REPLACE(
                                    'browser/chrome/browser/safeMode.dtd',
                                    'refreshProfile.label', {
                                        "&brandShortName;":
                                        TERM_REFERENCE("brand-short-name")
                                    }))
                        ]),
            FTL.Message(
                id=FTL.Identifier('safe-mode-description'),
                value=REPLACE(
                    'browser/chrome/browser/safeMode.dtd',
                    'safeModeDescription3.label',
                    {"&brandShortName;": TERM_REFERENCE("brand-short-name")})),
            FTL.Message(
                id=FTL.Identifier('safe-mode-description-details'),
                value=REPLACE(
                    'browser/chrome/browser/safeMode.dtd',
                    'safeModeDescription5.label',
                    {"&brandShortName;": TERM_REFERENCE("brand-short-name")})),
            FTL.Message(
                id=FTL.Identifier('refresh-profile-instead'),
                value=REPLACE(
                    'browser/chrome/browser/safeMode.dtd',
                    'refreshProfileInstead.label',
                    {"&brandShortName;": TERM_REFERENCE("brand-short-name")})),
            FTL.Message(
                id=FTL.Identifier('auto-safe-mode-description'),
                value=REPLACE(
                    'browser/chrome/browser/safeMode.dtd',
                    'autoSafeModeDescription3.label',
                    {"&brandShortName;": TERM_REFERENCE("brand-short-name")}))
        ])
def migrate(ctx):
    """Bug 1451992 - Migrate Preferences::Subdialogs::Colors to Fluent, part {index}."""

    ctx.add_transforms(
        'browser/browser/preferences/colors.ftl',
        'browser/browser/preferences/colors.ftl', [
            FTL.Message(
                id=FTL.Identifier('colors-window'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('title'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'colorsDialog.title')),
                    FTL.Attribute(
                        FTL.Identifier('style'),
                        FTL.Pattern(elements=[
                            FTL.Placeable(expression=FTL.SelectExpression(
                                expression=FTL.CallExpression(
                                    callee=FTL.Function('PLATFORM')),
                                variants=[
                                    FTL.Variant(
                                        key=FTL.VariantName('macos'),
                                        default=False,
                                        value=CONCAT(
                                            FTL.TextElement('width: '),
                                            COPY(
                                                'browser/chrome/browser/preferences/colors.dtd',
                                                'window.macWidth'))),
                                    FTL.Variant(
                                        key=FTL.VariantName('other'),
                                        default=True,
                                        value=CONCAT(
                                            FTL.TextElement('width: '),
                                            COPY(
                                                'browser/chrome/browser/preferences/colors.dtd',
                                                'window.width')))
                                ]))
                        ]))
                ]),
            FTL.Message(id=FTL.Identifier('colors-close-key'),
                        attributes=[
                            FTL.Attribute(
                                FTL.Identifier('key'),
                                COPY('toolkit/chrome/global/preferences.dtd',
                                     'windowClose.key'))
                        ]),
            FTL.Message(
                id=FTL.Identifier('colors-page-override'),
                value=COPY('browser/chrome/browser/preferences/colors.dtd',
                           'overrideDefaultPageColors2.label'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('accesskey'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'overrideDefaultPageColors2.accesskey'))
                ]),
            FTL.Message(
                id=FTL.Identifier('colors-page-override-option-always'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('label'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'overrideDefaultPageColors.always.label'))
                ]),
            FTL.Message(
                id=FTL.Identifier('colors-page-override-option-auto'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('label'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'overrideDefaultPageColors.auto.label'))
                ]),
            FTL.Message(
                id=FTL.Identifier('colors-page-override-option-never'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('label'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'overrideDefaultPageColors.never.label'),
                    ),
                ],
            ),
            FTL.Message(id=FTL.Identifier('colors-text-and-background'),
                        value=COPY(
                            'browser/chrome/browser/preferences/colors.dtd',
                            'color')),
            FTL.Message(
                id=FTL.Identifier('colors-text-header'),
                value=COPY('browser/chrome/browser/preferences/colors.dtd',
                           'textColor2.label'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('accesskey'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'textColor2.accesskey'))
                ]),
            FTL.Message(
                id=FTL.Identifier('colors-background'),
                value=COPY('browser/chrome/browser/preferences/colors.dtd',
                           'backgroundColor2.label'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('accesskey'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'backgroundColor2.accesskey'))
                ]),
            FTL.Message(
                id=FTL.Identifier('colors-use-system'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('label'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'useSystemColors.label')),
                    FTL.Attribute(
                        FTL.Identifier('accesskey'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'useSystemColors.accesskey'))
                ]),
            FTL.Message(
                id=FTL.Identifier('colors-underline-links'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('label'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'underlineLinks.label')),
                    FTL.Attribute(
                        FTL.Identifier('accesskey'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'underlineLinks.accesskey'))
                ]),
            FTL.Message(id=FTL.Identifier('colors-links-header'),
                        value=COPY(
                            'browser/chrome/browser/preferences/colors.dtd',
                            'links')),
            FTL.Message(
                id=FTL.Identifier('colors-unvisited-links'),
                value=COPY('browser/chrome/browser/preferences/colors.dtd',
                           'linkColor2.label'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('accesskey'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'linkColor2.accesskey'))
                ]),
            FTL.Message(
                id=FTL.Identifier('colors-visited-links'),
                value=COPY('browser/chrome/browser/preferences/colors.dtd',
                           'visitedLinkColor2.label'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('accesskey'),
                        COPY('browser/chrome/browser/preferences/colors.dtd',
                             'visitedLinkColor2.accesskey'))
                ])
        ])
def pattern_from_text(value):
    return FTL.Pattern([
        FTL.TextElement(value)
    ])
Пример #28
0
def migrate(ctx):
    """Bug 1451992 - Migrate Preferences::Subdialogs::ClearSiteData to Fluent, part {index}."""

    ctx.add_transforms(
        'browser/browser/preferences/clearSiteData.ftl',
        'browser/browser/preferences/clearSiteData.ftl', [
            FTL.Message(
                id=FTL.Identifier('clear-site-data-window'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('title'),
                        COPY(
                            'browser/chrome/browser/preferences/clearSiteData.dtd',
                            'window.title')),
                    FTL.Attribute(
                        FTL.Identifier('style'),
                        CONCAT(
                            FTL.TextElement('width: '),
                            COPY(
                                'browser/chrome/browser/preferences/clearSiteData.dtd',
                                'window.width')))
                ]),
            FTL.Message(
                id=FTL.Identifier('clear-site-data-description'),
                value=REPLACE(
                    'browser/chrome/browser/preferences/clearSiteData.dtd',
                    'window.description', {
                        '&brandShortName;':
                        MESSAGE_REFERENCE('-brand-short-name')
                    })),
            FTL.Message(
                id=FTL.Identifier('clear-site-data-close-key'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('key'),
                        COPY(
                            'browser/chrome/browser/preferences/clearSiteData.dtd',
                            'windowClose.key'))
                ]),
            FTL.Message(
                id=FTL.Identifier('clear-site-data-cookies-info'),
                value=COPY(
                    'browser/chrome/browser/preferences/clearSiteData.dtd',
                    'clearSiteData.description')),
            FTL.Message(
                id=FTL.Identifier('clear-site-data-cache-info'),
                value=COPY(
                    'browser/chrome/browser/preferences/clearSiteData.dtd',
                    'clearCache.description')),
            FTL.Message(
                id=FTL.Identifier('clear-site-data-cancel'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('label'),
                        COPY(
                            'browser/chrome/browser/preferences/clearSiteData.dtd',
                            'button.cancel.label')),
                    FTL.Attribute(
                        FTL.Identifier('accesskey'),
                        COPY(
                            'browser/chrome/browser/preferences/clearSiteData.dtd',
                            'button.cancel.accesskey'))
                ]),
            FTL.Message(
                id=FTL.Identifier('clear-site-data-clear'),
                attributes=[
                    FTL.Attribute(
                        FTL.Identifier('label'),
                        COPY(
                            'browser/chrome/browser/preferences/clearSiteData.dtd',
                            'button.clear.label')),
                    FTL.Attribute(
                        FTL.Identifier('accesskey'),
                        COPY(
                            'browser/chrome/browser/preferences/clearSiteData.dtd',
                            'button.clear.accesskey'))
                ])
        ])
Пример #29
0
def migrate(ctx):
    """Bug 1615501 - Fluent migration recipe for Preferences Calendar Tab, part {index}."""

    ctx.add_transforms(
        "calendar/calendar/preferences.ftl",
        "calendar/calendar/preferences.ftl",
        transforms_from(
            """
calendar-title = { COPY(from_path, "panelHeader.title") }
calendar-title-reminder = { COPY(from_path, "panelReminder.title") }
calendar-title-category = { COPY(from_path, "panelCategory.title") }
""",
            from_path="calendar/chrome/calendar/preferences/preferences.dtd"))

    ctx.add_transforms(
        "calendar/calendar/preferences.ftl",
        "calendar/calendar/preferences.ftl",
        transforms_from(
            """
dateformat-label =
    .value = { COPY(from_path, "pref.dateformat.label") }
    .accesskey = { COPY(from_path, "pref.dateformat.accesskey") }

#   $date (String) - the formatted example date
dateformat-long =
    .label = { COPY(from_path, "pref.dateformat.long") }: { $date }

#   $date (String) - the formatted example date
dateformat-short =
    .label = { COPY(from_path, "pref.dateformat.short") }: { $date }

timezone-label =
    .value = { COPY(from_path, "pref.timezones.caption") }:

todaypane-legend = { COPY(from_path, "pref.calendar.todaypane.agenda.caption") }

soon-label =
    .value = { COPY(from_path, "pref.soondays2.label") }
    .accesskey = { COPY(from_path, "pref.soondays2.accesskey") }

event-task-legend = { COPY(from_path, "pref.eventsandtasks.label") }

default-length-label =
    .value = { COPY(from_path, "pref.default_event_task_length.label") }:
    .accesskey = { COPY(from_path, "pref.default_event_task_length.accesskey") }

task-start-1-label =
    .label = { COPY(from_path, "pref.default_task_none.label") }
task-start-2-label =
    .label = { COPY(from_path, "pref.default_task_start_of_day.label") }
task-start-3-label =
    .label = { COPY(from_path, "pref.default_task_end_of_day.label") }
task-start-4-label =
    .label = { COPY(from_path, "pref.default_task_tomorrow.label") }
task-start-5-label =
    .label = { COPY(from_path, "pref.default_task_next_week.label") }
task-start-6-label =
    .label = { COPY(from_path, "pref.default_task_offset_current.label") }
task-start-7-label =
    .label = { COPY(from_path, "pref.default_task_offset_start.label") }
task-start-8-label =
    .label = { COPY(from_path, "pref.default_task_offset_next_hour.label") }

edit-intab-label =
    .label = { COPY(from_path, "pref.editInTab.label") }
    .accesskey = { COPY(from_path, "pref.editInTab.accesskey") }

accessibility-legend = { COPY(from_path, "pref.accessibility.label") }

accessibility-colors-label =
    .label = { COPY(from_path, "pref.systemcolors.label") }
    .accesskey = { COPY(from_path, "pref.systemcolors.accesskey") }
""",
            from_path="calendar/chrome/calendar/preferences/general.dtd"))

    ctx.add_transforms(
        "calendar/calendar/preferences.ftl",
        "calendar/calendar/preferences.ftl",
        transforms_from(
            """
weekstart-label =
    .value = { COPY(from_path, "pref.weekstarts.label") }
    .accesskey = { COPY(from_path, "pref.weekstarts.accesskey") }

show-weeknumber-label =
    .label = { COPY(from_path, "pref.calendar.view-minimonth.showweeknumber.label") }
    .accesskey = { COPY(from_path, "pref.calendar.view-minimonth.showweeknumber.accesskey") }

workdays-label =
    .value = { COPY(from_path, "pref.workweekDays.label") }

dayweek-legend = { COPY(from_path, "pref.calendar.view.dayandweekviews.caption") }

visible-hours-label =
    .value = { COPY(from_path, "pref.calendar.view.visiblehours.label") }
    .accesskey = { COPY(from_path, "pref.calendar.view.visiblehours.accesskey") }

visible-hours-end-label =
    .value = { COPY(from_path, "pref.calendar.view.visiblehoursend.label") }

day-start-label =
    .value = { COPY(from_path, "pref.calendar.view.daystart.label") }
    .accesskey = { COPY(from_path, "pref.calendar.view.daystart.accesskey") }

day-end-label =
    .value = { COPY(from_path, "pref.calendar.view.dayend.label") }
    .accesskey = { COPY(from_path, "pref.calendar.view.dayend.accesskey") }

location-checkbox =
    .label = { COPY(from_path, "pref.showlocation.label") }
    .accesskey = { COPY(from_path, "pref.showlocation.accesskey") }

multiweek-legend = { COPY(from_path, "pref.calendar.view.multiweekview.caption") }

number-of-weeks-label =
    .value = { COPY(from_path, "pref.numberofweeks.label") }
    .accesskey = { COPY(from_path, "pref.numberofweeks.accesskey") }

week-0-label =
    .label = { COPY(from_path, "pref.numberofweeks.0") }
week-1-label =
    .label = { COPY(from_path, "pref.numberofweeks.1") }
week-2-label =
    .label = { COPY(from_path, "pref.numberofweeks.2") }
week-3-label =
    .label = { COPY(from_path, "pref.numberofweeks.3") }
week-4-label =
    .label = { COPY(from_path, "pref.numberofweeks.4") }
week-5-label =
    .label = { COPY(from_path, "pref.numberofweeks.5") }
week-6-label =
    .label = { COPY(from_path, "pref.numberofweeks.6") }

previous-weeks-label =
    .value = { COPY(from_path, "pref.numberofpreviousweeks.label") }
    .accesskey = { COPY(from_path, "pref.numberofpreviousweeks.accesskey") }
""",
            from_path="calendar/chrome/calendar/preferences/views.dtd"))

    ctx.add_transforms(
        "calendar/calendar/preferences.ftl",
        "calendar/calendar/preferences.ftl",
        transforms_from("""
day-1-name =
    .label = { COPY(from_path, "day.1.name") }
day-2-name =
    .label = { COPY(from_path, "day.2.name") }
day-3-name =
    .label = { COPY(from_path, "day.3.name") }
day-4-name =
    .label = { COPY(from_path, "day.4.name") }
day-5-name =
    .label = { COPY(from_path, "day.5.name") }
day-6-name =
    .label = { COPY(from_path, "day.6.name") }
day-7-name =
    .label = { COPY(from_path, "day.7.name") }

day-1-checkbox =
    .label = { COPY(from_path, "day.1.Ddd") }
    .accesskey = { COPY(from_path, "day.1.Ddd.accesskey") }
day-2-checkbox =
    .label = { COPY(from_path, "day.2.Ddd") }
    .accesskey = { COPY(from_path, "day.2.Ddd.accesskey") }
day-3-checkbox =
    .label = { COPY(from_path, "day.3.Ddd") }
    .accesskey = { COPY(from_path, "day.3.Ddd.accesskey") }
day-4-checkbox =
    .label = { COPY(from_path, "day.4.Ddd") }
    .accesskey = { COPY(from_path, "day.4.Ddd.accesskey") }
day-5-checkbox =
    .label = { COPY(from_path, "day.5.Ddd") }
    .accesskey = { COPY(from_path, "day.5.Ddd.accesskey") }
day-6-checkbox =
    .label = { COPY(from_path, "day.6.Ddd") }
    .accesskey = { COPY(from_path, "day.6.Ddd.accesskey") }
day-7-checkbox =
    .label = { COPY(from_path, "day.7.Ddd") }
    .accesskey = { COPY(from_path, "day.7.Ddd.accesskey") }

midnight-label =
    .label = { COPY(from_path, "time.midnight") }
noon-label =
    .label = { COPY(from_path, "time.noon") }
""",
                        from_path="calendar/chrome/calendar/global.dtd"))

    ctx.add_transforms(
        "calendar/calendar/preferences.ftl",
        "calendar/calendar/preferences.ftl",
        transforms_from(
            """
task-start-label =
    .value = { COPY(from_path, "read.only.task.start.label") }

task-due-label =
    .value = { COPY(from_path, "read.only.task.due.label") }
""",
            from_path="calendar/chrome/calendar/calendar-event-dialog.dtd"))

    ctx.add_transforms(
        "calendar/calendar/preferences.ftl",
        "calendar/calendar/preferences.ftl",
        transforms_from(
            """
reminder-legend = { COPY(from_path, "pref.alarmgoesoff.label") }

reminder-play-checkbox =
    .label = { COPY(from_path, "pref.playasound") }
    .accesskey = { COPY(from_path, "pref.calendar.alarms.playsound.accessKey") }

reminder-play-alarm-button =
    .label = { COPY(from_path, "pref.calendar.alarms.sound.play.label") }
    .accesskey = { COPY(from_path, "pref.calendar.alarms.sound.play.accessKey") }

reminder-default-sound-label =
    .label = { COPY(from_path, "pref.calendar.alarms.sound.useDefault.label") }
    .accesskey = { COPY(from_path, "pref.calendar.alarms.sound.useDefault.accessKey") }

reminder-custom-sound-label =
    .label = { COPY(from_path, "pref.calendar.alarms.sound.useCustom.label") }
    .accesskey = { COPY(from_path, "pref.calendar.alarms.sound.useCustom.accessKey") }

reminder-browse-sound-label =
    .label = { COPY(from_path, "pref.calendar.alarms.sound.browse.label") }
    .accesskey = { COPY(from_path, "pref.calendar.alarms.sound.browse.accessKey") }

reminder-dialog-label =
    .label = { COPY(from_path, "pref.showalarmbox") }
    .accesskey = { COPY(from_path, "pref.calendar.alarms.showAlarmBox.accessKey") }

missed-reminder-label =
    .label = { COPY(from_path, "pref.missedalarms2") }
    .accesskey = { COPY(from_path, "pref.calendar.alarms.missedAlarms.accessKey") }

reminder-default-legend = { COPY(from_path, "pref.calendar.alarms.defaults.label") }

default-snooze-label =
    .value = { COPY(from_path, "pref.defaultsnoozelength.label") }
    .accesskey = { COPY(from_path, "pref.defaultsnoozelength.accesskey") }

event-alarm-label =
    .value = { COPY(from_path, "pref.defalarm4events.label") }
    .accesskey = { COPY(from_path, "pref.defalarm4events.accesskey") }

alarm-on-label =
    .label = { COPY(from_path, "pref.alarm.on") }
alarm-off-label =
    .label = { COPY(from_path, "pref.alarm.off") }

task-alarm-label =
    .value = { COPY(from_path, "pref.defalarm4todos.label") }
    .accesskey = { COPY(from_path, "pref.defalarm4todos.accesskey") }

event-alarm-time-label =
    .value = { COPY(from_path, "pref.defalarmlen4events.label") }
    .accesskey = { COPY(from_path, "pref.defalarmlen4events.accesskey") }

task-alarm-time-label =
    .value = { COPY(from_path, "pref.defalarmlen4todos.label") }
    .accesskey = { COPY(from_path, "pref.defalarmlen4todos.accesskey") }
""",
            from_path="calendar/chrome/calendar/preferences/alarms.dtd"))

    ctx.add_transforms(
        "calendar/calendar/preferences.ftl",
        "calendar/calendar/preferences.ftl",
        transforms_from(
            """
category-new-label = { COPY(from_path, "pref.categories.new.title") }

category-edit-label = { COPY(from_path, "pref.categories.edit.title") }

category-overwrite-title = { COPY(from_path, "pref.categories.overwrite.title") }
category-blank-warning = { COPY(from_path, "pref.categories.noBlankCategories") }
""",
            from_path="calendar/chrome/calendar/preferences/categories.dtd"))

    ctx.add_transforms(
        "calendar/calendar/preferences.ftl",
        "calendar/calendar/preferences.ftl", [
            FTL.Message(
                id=FTL.Identifier("category-overwrite"),
                value=REPLACE(
                    "calendar/chrome/calendar/preferences/categories.dtd",
                    "pref.categories.overwrite",
                    {" \\n": FTL.TextElement("")},
                )),
        ])

    ctx.add_transforms(
        "calendar/calendar/category-dialog.ftl",
        "calendar/calendar/category-dialog.ftl",
        transforms_from(
            """
category-name-label = { COPY(from_path, "pref.categories.name.label") }

category-color-label =
    .label = { COPY(from_path, "pref.categories.usecolor.label") }
""",
            from_path="calendar/chrome/calendar/preferences/categories.dtd"))
Пример #30
0
def migrate(ctx):
    """Bug 1507595 - Migrate about:support messages to use Fluent for localization, part {index}."""

    ctx.add_transforms(
        "toolkit/toolkit/about/aboutSupport.ftl",
        "toolkit/toolkit/about/aboutSupport.ftl",
        transforms_from("""
page-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.pageTitle")}
crashes-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.crashes.title")}
crashes-id = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.crashes.id")}
crashes-send-date = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.crashes.sendDate")}
crashes-all-reports = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.crashes.allReports")}
crashes-no-config = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.crashes.noConfig")}
extensions-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.extensionsTitle")}
extensions-name = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.extensionName")}
extensions-enabled = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.extensionEnabled")}
extensions-version = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.extensionVersion")}
extensions-id = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.extensionId")}
security-software-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.securitySoftwareTitle")}
security-software-type = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.securitySoftwareType")}
security-software-name = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.securitySoftwareName")}
security-software-antivirus = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.securitySoftwareAntivirus")}
security-software-antispyware = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.securitySoftwareAntiSpyware")}
security-software-firewall = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.securitySoftwareFirewall")}
features-name = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.featureName")}
features-version = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.featureVersion")}
features-id = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.featureId")}
app-basics-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsTitle")}
app-basics-name = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsName")}
app-basics-version = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsVersion")}
app-basics-build-id = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsBuildID")}
app-basics-update-channel = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsUpdateChannel")}
app-basics-update-history = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsUpdateHistory")}
app-basics-show-update-history = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsShowUpdateHistory")}
app-basics-enabled-plugins = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsEnabledPlugins")}
app-basics-build-config = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsBuildConfig")}
app-basics-user-agent = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsUserAgent")}
app-basics-os = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsOS")}
app-basics-memory-use = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsMemoryUse")}
app-basics-performance = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsPerformance")}
app-basics-service-workers = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsServiceWorkers")}
app-basics-profiles = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsProfiles")}
app-basics-multi-process-support = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsMultiProcessSupport")}
app-basics-process-count = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsProcessCount")}
app-basics-enterprise-policies = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.enterprisePolicies")}
app-basics-location-service-key-google = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsLocationServiceKeyGoogle")}
app-basics-safebrowsing-key-google = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsSafebrowsingKeyGoogle")}
app-basics-key-mozilla = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsKeyMozilla")}
app-basics-safe-mode = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.appBasicsSafeMode")}
modified-key-prefs-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.modifiedKeyPrefsTitle")}
modified-prefs-name = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.modifiedPrefsName")}
modified-prefs-value = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.modifiedPrefsValue")}
user-js-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.userJSTitle")}
locked-key-prefs-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.lockedKeyPrefsTitle")}
locked-prefs-name = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.lockedPrefsName")}
locked-prefs-value = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.lockedPrefsValue")}
graphics-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.graphicsTitle")}
graphics-features-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.graphicsFeaturesTitle")}
graphics-diagnostics-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.graphicsDiagnosticsTitle")}
graphics-failure-log-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.graphicsFailureLogTitle")}
graphics-gpu1-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.graphicsGPU1Title")}
graphics-gpu2-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.graphicsGPU2Title")}
graphics-decision-log-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.graphicsDecisionLogTitle")}
graphics-crash-guards-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.graphicsCrashGuardsTitle")}
graphics-workarounds-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.graphicsWorkaroundsTitle")}
place-database-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.placeDatabaseTitle")}
place-database-integrity = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.placeDatabaseIntegrity")}
place-database-verify-integrity = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.placeDatabaseVerifyIntegrity")}
js-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.jsTitle")}
js-incremental-gc = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.jsIncrementalGC")}
a11y-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.a11yTitle")}
a11y-activated = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.a11yActivated")}
a11y-force-disabled = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.a11yForceDisabled")}
a11y-handler-used = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.a11yHandlerUsed")}
a11y-instantiator = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.a11yInstantiator")}
library-version-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.libraryVersionsTitle")}
copy-text-to-clipboard-label = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.copyTextToClipboard.label")}
copy-raw-data-to-clipboard-label = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.copyRawDataToClipboard.label")}
sandbox-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.sandboxTitle")}
sandbox-sys-call-log-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.sandboxSyscallLogTitle")}
sandbox-sys-call-index = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.sandboxSyscallIndex")}
sandbox-sys-call-age = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.sandboxSyscallAge")}
sandbox-sys-call-pid = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.sandboxSyscallPID")}
sandbox-sys-call-tid = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.sandboxSyscallTID")}
sandbox-sys-call-proc-type = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.sandboxSyscallProcType")}
sandbox-sys-call-number = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.sandboxSyscallNumber")}
sandbox-sys-call-args = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.sandboxSyscallArgs")}
safe-mode-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.safeModeTitle")}
restart-in-safe-mode-label = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.restartInSafeMode.label")}
media-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaTitle")}
media-output-devices-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaOutputDevicesTitle")}
media-input-devices-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaInputDevicesTitle")}
media-device-name = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaDeviceName")}
media-device-group = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaDeviceGroup")}
media-device-vendor = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaDeviceVendor")}
media-device-state = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaDeviceState")}
media-device-preferred = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaDevicePreferred")}
media-device-format = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaDeviceFormat")}
media-device-channels = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaDeviceChannels")}
media-device-rate = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaDeviceRate")}
media-device-latency = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.mediaDeviceLatency")}
intl-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.intlTitle")}
intl-app-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.intlAppTitle")}
intl-locales-requested = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.intlLocalesRequested")}
intl-locales-available = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.intlLocalesAvailable")}
intl-locales-supported = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.intlLocalesSupported")}
intl-locales-default = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.intlLocalesDefault")}
intl-os-title = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.intlOSTitle")}
intl-os-prefs-system-locales = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.intlOSPrefsSystemLocales")}
intl-regional-prefs = { COPY("toolkit/chrome/global/aboutSupport.dtd", "aboutSupport.intlRegionalPrefs")}
raw-data-copied = { COPY("toolkit/chrome/global/aboutSupport.properties", "rawDataCopied")}
text-copied = { COPY("toolkit/chrome/global/aboutSupport.properties", "textCopied")}
clear-type-parameters = { COPY("toolkit/chrome/global/aboutSupport.properties", "clearTypeParameters")}
compositing = { COPY("toolkit/chrome/global/aboutSupport.properties", "compositing")}
hardware-h264 = { COPY("toolkit/chrome/global/aboutSupport.properties", "hardwareH264")}
main-thread-no-omtc = { COPY("toolkit/chrome/global/aboutSupport.properties", "mainThreadNoOMTC")}
yes = { COPY("toolkit/chrome/global/aboutSupport.properties", "yes")}
no = { COPY("toolkit/chrome/global/aboutSupport.properties", "no")}
found = { COPY("toolkit/chrome/global/aboutSupport.properties", "found")}
missing = { COPY("toolkit/chrome/global/aboutSupport.properties", "missing")}
gpu-description = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuDescription")}
gpu-vendor-id = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuVendorID")}
gpu-device-id = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuDeviceID")}
gpu-subsys-id = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuSubsysID")}
gpu-drivers = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuDrivers")}
gpu-ram = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuRAM")}
gpu-driver-version = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuDriverVersion")}
gpu-driver-date = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuDriverDate")}
gpu-active = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuActive")}
webgl1-wsiinfo = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl1WSIInfo")}
webgl1-renderer = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl1Renderer")}
webgl1-version = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl1Version")}
webgl1-driver-extensions = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl1DriverExtensions")}
webgl1-extensions = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl1Extensions")}
webgl2-wsiinfo = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl2WSIInfo")}
webgl2-renderer = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl2Renderer")}
webgl2-version = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl2Version")}
webgl2-driver-extensions = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl2DriverExtensions")}
webgl2-extensions = { COPY("toolkit/chrome/global/aboutSupport.properties", "webgl2Extensions")}
blocklisted-bug = { COPY("toolkit/chrome/global/aboutSupport.properties", "blocklistedBug")}
d3d11layers-crash-guard = { COPY("toolkit/chrome/global/aboutSupport.properties", "d3d11layersCrashGuard")}
d3d11video-crash-guard = { COPY("toolkit/chrome/global/aboutSupport.properties", "d3d11videoCrashGuard")}
d3d9video-crash-buard = { COPY("toolkit/chrome/global/aboutSupport.properties", "d3d9videoCrashGuard")}
glcontext-crash-guard = { COPY("toolkit/chrome/global/aboutSupport.properties", "glcontextCrashGuard")}
reset-on-next-restart = { COPY("toolkit/chrome/global/aboutSupport.properties", "resetOnNextRestart")}
gpu-process-kill-button = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuProcessKillButton")}
gpu-device-reset-button = { COPY("toolkit/chrome/global/aboutSupport.properties", "gpuDeviceResetButton")}
uses-tiling = { COPY("toolkit/chrome/global/aboutSupport.properties", "usesTiling")}
content-uses-tiling = { COPY("toolkit/chrome/global/aboutSupport.properties", "contentUsesTiling")}
off-main-thread-paint-enabled = { COPY("toolkit/chrome/global/aboutSupport.properties", "offMainThreadPaintEnabled")}
off-main-thread-paint-worker-count = { COPY("toolkit/chrome/global/aboutSupport.properties", "offMainThreadPaintWorkerCount")}
audio-backend = { COPY("toolkit/chrome/global/aboutSupport.properties", "audioBackend")}
max-audio-channels = { COPY("toolkit/chrome/global/aboutSupport.properties", "maxAudioChannels")}
channel-layout = { COPY("toolkit/chrome/global/aboutSupport.properties", "channelLayout")}
sample-rate = { COPY("toolkit/chrome/global/aboutSupport.properties", "sampleRate")}
min-lib-versions = { COPY("toolkit/chrome/global/aboutSupport.properties", "minLibVersions")}
loaded-lib-versions = { COPY("toolkit/chrome/global/aboutSupport.properties", "loadedLibVersions")}
has-seccomp-bpf = { COPY("toolkit/chrome/global/aboutSupport.properties", "hasSeccompBPF")}
has-seccomp-tsync = { COPY("toolkit/chrome/global/aboutSupport.properties", "hasSeccompTSync")}
has-user-namespaces = { COPY("toolkit/chrome/global/aboutSupport.properties", "hasUserNamespaces")}
has-privileged-user-namespaces = { COPY("toolkit/chrome/global/aboutSupport.properties", "hasPrivilegedUserNamespaces")}
can-sandbox-content = { COPY("toolkit/chrome/global/aboutSupport.properties", "canSandboxContent")}
can-sandbox-media = { COPY("toolkit/chrome/global/aboutSupport.properties", "canSandboxMedia")}
content-sandbox-level = { COPY("toolkit/chrome/global/aboutSupport.properties", "contentSandboxLevel")}
effective-content-sandbox-level = { COPY("toolkit/chrome/global/aboutSupport.properties", "effectiveContentSandboxLevel")}
sandbox-proc-type-content = { COPY("toolkit/chrome/global/aboutSupport.properties", "sandboxProcType.content")}
sandbox-proc-type-file = { COPY("toolkit/chrome/global/aboutSupport.properties", "sandboxProcType.file")}
sandbox-proc-type-media-plugin = { COPY("toolkit/chrome/global/aboutSupport.properties", "sandboxProcType.mediaPlugin")}
multi-process-status-0 = { COPY("toolkit/chrome/global/aboutSupport.properties", "multiProcessStatus.0")}
multi-process-status-1 = { COPY("toolkit/chrome/global/aboutSupport.properties", "multiProcessStatus.1")}
multi-process-status-2 = { COPY("toolkit/chrome/global/aboutSupport.properties", "multiProcessStatus.2")}
multi-process-status-4 = { COPY("toolkit/chrome/global/aboutSupport.properties", "multiProcessStatus.4")}
multi-process-status-6 = { COPY("toolkit/chrome/global/aboutSupport.properties", "multiProcessStatus.6")}
multi-process-status-7 = { COPY("toolkit/chrome/global/aboutSupport.properties", "multiProcessStatus.7")}
multi-process-status-8 = { COPY("toolkit/chrome/global/aboutSupport.properties", "multiProcessStatus.8")}
multi-process-status-unknown = { COPY("toolkit/chrome/global/aboutSupport.properties", "multiProcessStatus.unknown")}
async-pan-zoom = { COPY("toolkit/chrome/global/aboutSupport.properties", "asyncPanZoom")}
apz-none = { COPY("toolkit/chrome/global/aboutSupport.properties", "apzNone")}
wheel-enabled = { COPY("toolkit/chrome/global/aboutSupport.properties", "wheelEnabled")}
touch-enabled = { COPY("toolkit/chrome/global/aboutSupport.properties", "touchEnabled")}
drag-enabled = { COPY("toolkit/chrome/global/aboutSupport.properties", "dragEnabled")}
keyboard-enabled = { COPY("toolkit/chrome/global/aboutSupport.properties", "keyboardEnabled")}
autoscroll-enabled = { COPY("toolkit/chrome/global/aboutSupport.properties", "autoscrollEnabled")}
policies-inactive = { COPY("toolkit/chrome/global/aboutSupport.properties", "policies.inactive")}
policies-active = { COPY("toolkit/chrome/global/aboutSupport.properties", "policies.active")}
policies-error = { COPY("toolkit/chrome/global/aboutSupport.properties", "policies.error")}
multi-process-windows = { $remoteWindows }/{ $totalWindows }
blocked-driver = { COPY("toolkit/chrome/global/aboutSupport.properties", "blockedDriver")}
blocked-gfx-card = { COPY("toolkit/chrome/global/aboutSupport.properties", "blockedGfxCard")}
blocked-os-version = { COPY("toolkit/chrome/global/aboutSupport.properties", "blockedOSVersion")}
blocked-mismatched-version = { COPY("toolkit/chrome/global/aboutSupport.properties", "blockedMismatchedVersion")}
"""))

    ctx.add_transforms(
        "toolkit/toolkit/about/aboutSupport.ftl",
        "toolkit/toolkit/about/aboutSupport.ftl", [
            FTL.Message(
                id=FTL.Identifier("page-subtitle"),
                value=REPLACE(
                    "toolkit/chrome/global/aboutSupport.dtd",
                    "aboutSupport.pageSubtitle", {
                        "&brandShortName;":
                        TERM_REFERENCE("-brand-short-name"),
                        "<a id='supportLink'>":
                        FTL.TextElement('<a data-l10n-name="support-link">'),
                    },
                    trim=True)),
            FTL.Message(id=FTL.Identifier("features-title"),
                        value=REPLACE(
                            "toolkit/chrome/global/aboutSupport.dtd",
                            "aboutSupport.featuresTitle",
                            {
                                "&brandShortName;":
                                TERM_REFERENCE("-brand-short-name"),
                            },
                        )),
            FTL.Message(
                id=FTL.Identifier("app-basics-profile-dir"),
                value=FTL.Pattern(elements=[
                    FTL.Placeable(expression=FTL.SelectExpression(
                        selector=FTL.CallExpression(
                            callee=FTL.Function("PLATFORM")),
                        variants=[
                            FTL.Variant(
                                key=FTL.Identifier("linux"),
                                default=False,
                                value=COPY(
                                    "toolkit/chrome/global/aboutSupport.dtd",
                                    "aboutSupport.appBasicsProfileDir")),
                            FTL.Variant(
                                key=FTL.Identifier("other"),
                                default=True,
                                value=COPY(
                                    "toolkit/chrome/global/aboutSupport.dtd",
                                    "aboutSupport.appBasicsProfileDirWinMac")),
                        ]))
                ])),
            FTL.Message(
                id=FTL.Identifier("show-dir-label"),
                value=FTL.Pattern(elements=[
                    FTL.Placeable(expression=FTL.SelectExpression(
                        selector=FTL.CallExpression(
                            callee=FTL.Function("PLATFORM")),
                        variants=[
                            FTL.Variant(
                                key=FTL.Identifier("macos"),
                                default=False,
                                value=COPY(
                                    "toolkit/chrome/global/aboutSupport.dtd",
                                    "aboutSupport.showMac.label")),
                            FTL.Variant(
                                key=FTL.Identifier("windows"),
                                default=False,
                                value=COPY(
                                    "toolkit/chrome/global/aboutSupport.dtd",
                                    "aboutSupport.showWin2.label")),
                            FTL.Variant(
                                key=FTL.Identifier("other"),
                                default=True,
                                value=COPY(
                                    "toolkit/chrome/global/aboutSupport.dtd",
                                    "aboutSupport.showDir.label")),
                        ]))
                ])),
            FTL.Message(
                id=FTL.Identifier("user-js-description"),
                value=REPLACE(
                    "toolkit/chrome/global/aboutSupport.dtd",
                    "aboutSupport.userJSDescription",
                    {
                        "<a id='prefs-user-js-link'>":
                        FTL.TextElement('<a data-l10n-name="user-js-link">'),
                        "&brandShortName;":
                        TERM_REFERENCE("-brand-short-name"),
                    },
                )),
            FTL.Message(id=FTL.Identifier("report-crash-for-days"),
                        value=PLURALS(
                            "toolkit/chrome/global/aboutSupport.properties",
                            "crashesTitle", VARIABLE_REFERENCE("days"),
                            lambda text: REPLACE_IN_TEXT(
                                text, {"#1": VARIABLE_REFERENCE("days")}))),
            FTL.Message(
                id=FTL.Identifier("crashes-time-minutes"),
                value=PLURALS(
                    "toolkit/chrome/global/aboutSupport.properties",
                    "crashesTimeMinutes", VARIABLE_REFERENCE("minutes"),
                    lambda text: REPLACE_IN_TEXT(
                        text, {"#1": VARIABLE_REFERENCE("minutes")}))),
            FTL.Message(id=FTL.Identifier("crashes-time-hours"),
                        value=PLURALS(
                            "toolkit/chrome/global/aboutSupport.properties",
                            "crashesTimeHours", VARIABLE_REFERENCE("hours"),
                            lambda text: REPLACE_IN_TEXT(
                                text, {"#1": VARIABLE_REFERENCE("hours")}))),
            FTL.Message(id=FTL.Identifier("crashes-time-days"),
                        value=PLURALS(
                            "toolkit/chrome/global/aboutSupport.properties",
                            "crashesTimeDays", VARIABLE_REFERENCE("days"),
                            lambda text: REPLACE_IN_TEXT(
                                text, {"#1": VARIABLE_REFERENCE("days")}))),
            FTL.Message(id=FTL.Identifier("pending-reports"),
                        value=PLURALS(
                            "toolkit/chrome/global/aboutSupport.properties",
                            "pendingReports", VARIABLE_REFERENCE("reports"),
                            lambda text: REPLACE_IN_TEXT(
                                text, {"#1": VARIABLE_REFERENCE("reports")}))),
            FTL.Message(id=FTL.Identifier("bug-link"),
                        value=REPLACE(
                            "toolkit/chrome/global/aboutSupport.properties",
                            "bugLink",
                            {
                                "%1$S": VARIABLE_REFERENCE("bugNumber"),
                            },
                        )),
            FTL.Message(id=FTL.Identifier("unknown-failure"),
                        value=REPLACE(
                            "toolkit/chrome/global/aboutSupport.properties",
                            "unknownFailure",
                            {
                                "%1$S": VARIABLE_REFERENCE("failureCode"),
                            },
                        )),
            FTL.Message(id=FTL.Identifier("wheel-warning"),
                        value=REPLACE(
                            "toolkit/chrome/global/aboutSupport.properties",
                            "wheelWarning",
                            {
                                "%S": VARIABLE_REFERENCE("preferenceKey"),
                            },
                        )),
            FTL.Message(id=FTL.Identifier("touch-warning"),
                        value=REPLACE(
                            "toolkit/chrome/global/aboutSupport.properties",
                            "touchWarning",
                            {
                                "%S": VARIABLE_REFERENCE("preferenceKey"),
                            },
                        )),
            FTL.Message(id=FTL.Identifier("try-newer-driver"),
                        value=REPLACE(
                            "toolkit/chrome/global/aboutSupport.properties",
                            "tryNewerDriver",
                            {
                                "%S": VARIABLE_REFERENCE("driverVersion"),
                            },
                        )),
        ])