Esempio n. 1
0
def MESSAGE_REFERENCE(name):
    """Create a MessageReference expression.

    If the passed name contains a `.`, we're generating
    a message reference with an attribute.
    """
    if '.' in name:
        name, attribute = name.split('.')
        attribute = FTL.Identifier(attribute)
    else:
        attribute = None

    return FTL.MessageReference(
        id=FTL.Identifier(name),
        attribute=attribute,
    )
Esempio n. 2
0
def migrate(ctx):
    """Bug 1568133 - Migrate remaining menubar from dtd to ftl, part {index}"""

    ctx.add_transforms(
        "browser/browser/menubar.ftl",
        "browser/browser/menubar.ftl",
        transforms_from(
            """
menu-application-services =
    .label = { COPY(base_path, "servicesMenuMac.label") }
menu-application-hide-other =
    .label = { COPY(base_path, "hideOtherAppsCmdMac.label") }
menu-application-show-all =
    .label = { COPY(base_path, "showAllAppsCmdMac.label") }
menu-application-touch-bar =
    .label = { COPY(base_path, "touchBarCmdMac.label") }

menu-quit =
    .label =
        { PLATFORM() ->
            [windows] { COPY(browser_path, "quitApplicationCmdWin2.label") }
           *[other] { COPY(browser_path, "quitApplicationCmd.label") }
        }
    .accesskey =
        { PLATFORM() ->
            [windows] { COPY(browser_path, "quitApplicationCmdWin2.accesskey") }
           *[other] { COPY(browser_path, "quitApplicationCmd.accesskey") }
        }

menu-quit-button =
    .label = { menu-quit.label }
""",
            base_path="browser/chrome/browser/baseMenuOverlay.dtd",
            browser_path="browser/chrome/browser/browser.dtd",
        ),
    )

    ctx.add_transforms(
        "browser/browser/menubar.ftl",
        "browser/browser/menubar.ftl",
        [
            FTL.Message(
                id=FTL.Identifier("menu-application-hide-this"),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("label"),
                        value=REPLACE(
                            "browser/chrome/browser/baseMenuOverlay.dtd",
                            "hideThisAppCmdMac2.label",
                            {
                                "&brandShorterName;": TERM_REFERENCE(
                                    "brand-shorter-name"
                                ),
                            },
                        ),
                    )
                ],
            ),
            FTL.Message(
                id=FTL.Identifier("menu-quit-mac"),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("label"),
                        value=REPLACE(
                            "browser/chrome/browser/browser.dtd",
                            "quitApplicationCmdMac2.label",
                            {
                                "&brandShorterName;": TERM_REFERENCE(
                                    "brand-shorter-name"
                                ),
                            },
                        ),
                    )
                ],
            ),
            FTL.Message(
                id=FTL.Identifier("menu-quit-button-win"),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("label"),
                        value=FTL.Pattern(
                            elements=[
                                FTL.Placeable(
                                    expression=FTL.MessageReference(
                                        id=FTL.Identifier("menu-quit"),
                                        attribute=FTL.Identifier("label"),
                                    )
                                )
                            ]
                        ),
                    ),
                    FTL.Attribute(
                        id=FTL.Identifier("tooltip"),
                        value=REPLACE(
                            "browser/chrome/browser/browser.dtd",
                            "quitApplicationCmdWin2.tooltip",
                            {
                                "&brandShorterName;": TERM_REFERENCE(
                                    "brand-shorter-name"
                                ),
                            },
                        ),
                    ),
                ],
            ),
            FTL.Message(
                id=FTL.Identifier("menu-about"),
                attributes=[
                    FTL.Attribute(
                        id=FTL.Identifier("label"),
                        value=REPLACE(
                            "browser/chrome/browser/baseMenuOverlay.dtd",
                            "aboutProduct2.label",
                            {
                                "&brandShorterName;": TERM_REFERENCE(
                                    "brand-shorter-name"
                                ),
                            },
                        ),
                    ),
                    FTL.Attribute(
                        id=FTL.Identifier("accesskey"),
                        value=COPY(
                            "browser/chrome/browser/baseMenuOverlay.dtd",
                            "aboutProduct2.accesskey",
                        ),
                    ),
                ],
            ),
        ],
    )
Esempio n. 3
0
def MESSAGE_REFERENCE(name):
    """Create a MessageReference expression."""

    return FTL.MessageReference(id=FTL.Identifier(name))