def migrate(ctx): """Migrate bedrock/firefox/templates/firefox/features/fast.html, part {index}.""" ctx.add_transforms( "firefox/features/fast.ftl", "firefox/features/fast.ftl", transforms_from(""" features-fast-get-more-done-browse-faster = {COPY(fast, "Get more done. Browse faster and lighter with multiple tabs",)} features-fast-our-new-powerful-multi-process = {COPY(fast, "Our new, powerful multi-process platform handles all your tabs without slowing down your computer.",)} """, fast=fast) + [ FTL.Message( id=FTL.Identifier( "features-fast-firefox-is-now-faster-and-leaner"), value=REPLACE(fast, "Firefox is now faster and leaner", { "Firefox": TERM_REFERENCE("brand-name-firefox"), })), ] + transforms_from(""" features-fast-weve-been-working-out-so-you = {COPY(fast, "We’ve been working out, so you can get more done.",)} features-fast-use-less-memory = {COPY(fast, "Use less memory",)} """, fast=fast) + [ FTL.Message( id=FTL.Identifier("features-fast-no-one-likes-a-computer-hog"), value=REPLACE( fast, "No one likes a computer hog! Firefox is a lean, mean (actually we’re pretty nice) browsing machine. Since we use less RAM than Chrome, your other programs can keep running at top speed.", { "Firefox": TERM_REFERENCE("brand-name-firefox"), "Chrome": TERM_REFERENCE("brand-name-chrome"), })), ] + transforms_from(""" features-fast-get-all-the-tabs-without-lags = {COPY(fast, "Get all the tabs without lags",)} """, fast=fast) + [ FTL.Message( id=FTL.Identifier("features-fast-multi-tasking-with-multiple"), value=REPLACE( fast, "Multi-tasking with multiple tabs just got easier. Firefox is now a multi-process browser, which means that your tabs stay fresh and won’t take forever to reload. With 86% less hang time, switch quickly between tabs even as you open more.", { "Firefox": TERM_REFERENCE("brand-name-firefox"), })), ] + transforms_from(""" features-fast-level-up-browser-gameplay = {COPY(fast, "Level-up browser gameplay",)} """, fast=fast) + [ FTL.Message( id=FTL. Identifier("features-fast-we-led-the-tech-to-run-3d-games"), value=REPLACE( fast, "We led the tech to run 3D games at near-native speeds, and now Firefox is bringing better performance to online gaming. Our powerful browser reduces lags, speeds up ping times and optimizes overall gameplay through faster, leaner browsing.", { "Firefox": TERM_REFERENCE("brand-name-firefox"), })), ])
def migrate(ctx): """Bug 1658629 - Show proper action text when moving through local one-off search buttons, part {index}.""" ctx.add_transforms( "browser/browser/browser.ftl", "browser/browser/browser.ftl", [ FTL.Message( id=FTL.Identifier("urlbar-result-action-search-w-engine"), value=REPLACE("toolkit/chrome/global/autocomplete.properties", "searchWithEngine", {"%1$S": VARIABLE_REFERENCE("engine")}, normalize_printf=True)) ]) ctx.add_transforms( "browser/browser/browser.ftl", "browser/browser/browser.ftl", [ FTL.Message( id=FTL.Identifier( "urlbar-result-action-search-in-private-w-engine"), value=REPLACE("toolkit/chrome/global/autocomplete.properties", "searchInPrivateWindowWithEngine", {"%1$S": VARIABLE_REFERENCE("engine")}, normalize_printf=True)) ]) ctx.add_transforms( "browser/browser/browser.ftl", "browser/browser/browser.ftl", transforms_from( """ urlbar-result-action-switch-tab = { COPY(from_path, "switchToTab2") } urlbar-result-action-search-in-private = { COPY(from_path, "searchInPrivateWindow") } urlbar-result-action-visit = { COPY(from_path, "visit") } """, from_path="toolkit/chrome/global/autocomplete.properties"))
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)) ])
def migrate(ctx): """Bug 1727484 - Convert the 'Send Tab to Device' string in the tab context menu to title case, part {index}""" ctx.add_transforms( "browser/browser/tabContextMenu.ftl", "browser/browser/tabContextMenu.ftl", [ FTL.Message( id=FTL.Identifier("tab-context-send-tabs-to-device"), attributes=[ FTL.Attribute( id=FTL.Identifier("label"), value=PLURALS( "browser/chrome/browser/browser.properties", "sendTabsToDevice.label", VARIABLE_REFERENCE("tabCount"), lambda text: REPLACE_IN_TEXT( text, {"#1": VARIABLE_REFERENCE("tabCount")}), ), ), FTL.Attribute( id=FTL.Identifier("accesskey"), value=COPY( "browser/chrome/browser/browser.properties", "sendTabsToDevice.accesskey", ), ), ], ) ], )
def migrate(ctx): """Bug 1703012: fix control center and identity panel proton styling - part {index}""" ctx.add_transforms( "browser/browser/browser.ftl", "browser/browser/browser.ftl", [ FTL.Message( id=FTL.Identifier("identity-site-information"), value=REPLACE( "browser/chrome/browser/browser.properties", "identity.headerMainWithHost", { "%1$S": VARIABLE_REFERENCE("host"), }, ), ), FTL.Message( id=FTL.Identifier("identity-header-security-with-host"), attributes=[ FTL.Attribute( id=FTL.Identifier("title"), value=REPLACE( "browser/chrome/browser/browser.properties", "identity.headerSecurityWithHost", { "%1$S": VARIABLE_REFERENCE("host"), }, ), ), ], ), ], )
def to_entry(self): fp = FluentParser(False) # Handle standalone comments separately; they don't have any values or # attributes, just comment text. if self._type in [ast.ResourceComment, ast.GroupComment, ast.Comment]: return (self._type)(self.getnotes()) assert self.source is not None value = fp.maybe_get_pattern(FluentParserStream(self.source)) attributes = [ ast.Attribute( ast.Identifier(id), fp.maybe_get_pattern(FluentParserStream(value)), ) for (id, value) in self._attributes.items() ] comment = None if self.getnotes(): comment = ast.Comment(self.getnotes()) return (self._type if self._type is not None else ast.Message)( ast.Identifier(self.getid()), value=value, attributes=attributes, comment=comment, )
def migrate(ctx): """Migrate bedrock/base/templates/macros.html, part {index}.""" ctx.add_transforms("fxa_form.ftl", "fxa_form.ftl", [ FTL.Message( id=FTL.Identifier("fxa-form-enter-your-email"), value=REPLACE( "main.lang", "<strong>Enter your email</strong> to access Firefox Accounts.", { "Firefox Accounts": TERM_REFERENCE("brand-name-firefox-accounts"), })), FTL.Message( id=FTL.Identifier("fxa-form-by-proceeding"), value=REPLACE( "main.lang", "By proceeding, you agree to the <a href=\"%(url1)s\">Terms of Service</a> and <a href=\"%(url2)s\">Privacy Notice</a>.", { "%%": "%", "%(url1)s": VARIABLE_REFERENCE("url1"), "%(url2)s": VARIABLE_REFERENCE("url2"), })), ]) ctx.add_transforms( "fxa_form.ftl", "fxa_form.ftl", transforms_from(""" fxa-form-email-address = {COPY(main, "Email address",)} fxa-form-continue = {COPY(main, "Continue",)} fxa-form-create-account = {COPY(main, "Create account",)} fxa-form-get-the-app = {COPY(main, "Get the app",)} """, main=main))
def migrate(ctx): """Bug 1555438 - Migrate strings from pipnss.properties to aboutCertError.ftl""" ctx.add_transforms( 'browser/browser/aboutCertError.ftl', 'browser/browser/aboutCertError.ftl', [ FTL.Message( id=FTL.Identifier('cert-error-details-hsts-label'), value=REPLACE('browser/chrome/browser/browser.properties', 'certErrorDetailsHSTS.label', { "%1$S": VARIABLE_REFERENCE("hasHSTS"), }, normalize_printf=True), ), FTL.Message( id=FTL.Identifier('cert-error-details-key-pinning-label'), value=REPLACE('browser/chrome/browser/browser.properties', 'certErrorDetailsKeyPinning.label', { "%1$S": VARIABLE_REFERENCE("hasHPKP"), }, normalize_printf=True), ), ]) ctx.add_transforms( 'browser/browser/aboutCertError.ftl', 'browser/browser/aboutCertError.ftl', transforms_from(""" cert-error-details-cert-chain-label = { COPY(from_path, "certErrorDetailsCertChain.label") } """, from_path="browser/chrome/browser/browser.properties"))
def migrate(ctx): """Migrate bedrock/firefox/templates/firefox/firstrun/firstrun.html, part {index}.""" ctx.add_transforms( "firefox/firstrun.ftl", "firefox/firstrun.ftl", transforms_from(""" firstrun-firefox-browser = { -brand-name-firefox-browser } """, quantum=quantum) + [ FTL.Message( id=FTL.Identifier("firstrun-welcome-to-firefox"), value=REPLACE( quantum, "Welcome to Firefox", { "Firefox": TERM_REFERENCE("brand-name-firefox"), } ) ), FTL.Message( id=FTL.Identifier("firstrun-take-firefox-with-you"), value=REPLACE( quantum, "Take Firefox with You", { "Firefox": TERM_REFERENCE("brand-name-firefox"), } ) ), FTL.Message( id=FTL.Identifier("firstrun-already-using-firefox"), value=REPLACE( quantum, "Already using Firefox?", { "Firefox": TERM_REFERENCE("brand-name-firefox"), } ) ), ] + transforms_from(""" firstrun-get-your-bookmarks-history = {COPY(quantum, "Get your bookmarks, history, passwords and other settings on all your devices.",)} """, quantum=quantum) + [ FTL.Message( id=FTL.Identifier("firstrun-sign-in-to-your-account"), value=REPLACE( quantum, "Sign in to your account and we’ll sync the bookmarks, passwords and other great things you’ve saved to Firefox on other devices.", { "Firefox": TERM_REFERENCE("brand-name-firefox"), } ) ), ] + transforms_from(""" firstrun-already-have-an-account = {COPY(quantum, "Already have an account?",)} firstrun-sign-in = {COPY(quantum, "Sign In",)} """, quantum=quantum) )
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"))
def migrate(ctx): """Bug 1608188 - Migrate blocklist.dtd to Fluent, part {index}.""" ctx.add_transforms( "toolkit/toolkit/extensions/blocklist.ftl", "toolkit/toolkit/extensions/blocklist.ftl", transforms_from( """ blocklist-window = .title = { COPY(from_path, "blocklist.title", trim:"True") } .style = { COPY(from_path, "blocklist.style", trim:"True") } blocklist-soft-and-hard = { COPY(from_path, "blocklist.softandhard", trim:"True") } blocklist-hard-blocked = { COPY(from_path, "blocklist.hardblocked", trim:"True") } blocklist-soft-blocked = { COPY(from_path, "blocklist.softblocked", trim:"True") } blocklist-more-information = .value = { COPY(from_path, "blocklist.moreinfo", trim:"True") } blocklist-blocked = .label = { COPY(from_path, "blocklist.blocked.label", trim:"True") } blocklist-checkbox = .label = { COPY(from_path, "blocklist.checkbox.label", trim:"True") } """, from_path="toolkit/chrome/mozapps/extensions/blocklist.dtd")) ctx.add_transforms( "toolkit/toolkit/extensions/blocklist.ftl", "toolkit/toolkit/extensions/blocklist.ftl", [ FTL.Message( id=FTL.Identifier("blocklist-accept"), attributes=[ FTL.Attribute( id=FTL.Identifier("label"), value=REPLACE( "toolkit/chrome/mozapps/extensions/blocklist.dtd", "blocklist.accept.label", { "&brandShortName;": TERM_REFERENCE("brand-short-name") }, trim=True, )), FTL.Attribute( id=FTL.Identifier("accesskey"), value=COPY( "toolkit/chrome/mozapps/extensions/blocklist.dtd", "blocklist.accept.accesskey", trim=True, )), ]), FTL.Message( id=FTL.Identifier("blocklist-label-summary"), value=REPLACE( "toolkit/chrome/mozapps/extensions/blocklist.dtd", "blocklist.summary", {"&brandShortName;": TERM_REFERENCE("brand-short-name")}, trim=True, )), ])
def migrate(ctx): """Migrate bedrock/firefox/templates/firefox/welcome/page3.html, part {index}.""" ctx.add_transforms("firefox/welcome/page3.ftl", "firefox/welcome/page3.ftl", [ FTL.Message( id=FTL.Identifier("welcome-page3-get-the-free-account-that"), value=REPLACE( page3, "Get the free account that protects your privacy. Join Firefox.", { "Firefox": TERM_REFERENCE("brand-name-firefox"), })), ] + transforms_from( """ welcome-page3-no-account-required-but-you = {COPY(page3, "No account required. But you might want one.",)} """, page3=page3 ) + [ FTL.Message( id=FTL.Identifier("welcome-page3-the-firefox-browser-collects"), value=REPLACE( page3, "The Firefox browser collects so little data about you, we don’t even require your email address. But when you use it to create a Firefox account, we can protect your privacy across more of your online life.", { "Firefox": TERM_REFERENCE("brand-name-firefox"), "Firefox account": TERM_REFERENCE("brand-name-firefox-account"), })), ] + transforms_from( """ welcome-page3-firefox-monitor = { -brand-name-firefox-monitor } welcome-page3-have-at-least-one-company = {COPY(page3, "Have at least one company looking out for your data, instead of leaking it.",)} welcome-page3-firefox-lockwise = { -brand-name-firefox-lockwise } welcome-page3-never-forget-reset-or-travel = {COPY(page3, "Never forget, reset or travel without your passwords again.",)} welcome-page3-facebook-container = { -brand-name-facebook-container } """, page3=page3 ) + [ FTL.Message( id=FTL.Identifier( "welcome-page3-get-a-container-to-keep-facebook"), value=REPLACE( page3, "Get a container to keep Facebook out of your business.", { "Facebook": TERM_REFERENCE("brand-name-facebook"), })), ] + transforms_from(""" welcome-page3-pocket = { -brand-name-pocket } welcome-page3-trade-clickbait-and-fake-news = {COPY(page3, "Trade clickbait and fake news for quality content.",)} welcome-page3-firefox-send = { -brand-name-firefox-send } welcome-page3-send-huge-files-to-anyone = {COPY(page3, "Send huge files to anyone you want, with self-destructing links.",)} welcome-page3-why-am-i-seeing-this = {COPY(page3, "Why am I seeing this?",)} """, page3=page3))
def migrate(ctx): """Bug 1523736 - Migrate updates.dtd to Fluent, part {index}.""" ctx.add_transforms( "toolkit/toolkit/updates/elevation.ftl", "toolkit/toolkit/updates/elevation.ftl", transforms_from( """ elevation-update-wizard = .title = { COPY(from_path, "updateWizard.title") } elevation-details-link-label = .value = { COPY(from_path, "details.link") } elevation-finished-page = { COPY(from_path, "finishedPage.title") } elevation-finished-background = { COPY(from_path, "finishedBackground.name") } """,from_path="toolkit/chrome/mozapps/update/updates.dtd")) ctx.add_transforms( "toolkit/toolkit/updates/elevation.ftl", "toolkit/toolkit/updates/elevation.ftl", [ FTL.Message( id = FTL.Identifier("elevation-error-manual"), value = REPLACE( "toolkit/chrome/mozapps/update/updates.dtd", "errorManual.label", { "&brandShortName;": TERM_REFERENCE("brand-short-name") }, trim = True ) ), FTL.Message( id = FTL.Identifier("elevation-finished-background-page"), value = REPLACE( "toolkit/chrome/mozapps/update/updates.dtd", "finishedBackgroundPage.text", { "&brandShortName;": TERM_REFERENCE("brand-short-name") }, trim = True ) ), FTL.Message( id = FTL.Identifier("elevation-more-elevated"), value = REPLACE( "toolkit/chrome/mozapps/update/updates.dtd", "finishedBackground.moreElevated", { "&brandShortName;": TERM_REFERENCE("brand-short-name") }, trim = True ) ), ] )
def migrate(ctx): """Bug 1668284 - Unknown content type change settings label is no longer accurate, part {index}.""" ctx.add_transforms( "toolkit/toolkit/global/unknownContentType.ftl", "toolkit/toolkit/global/unknownContentType.ftl", [ FTL.Message( id=FTL.Identifier("unknowncontenttype-settingschange"), attributes=[ FTL.Attribute( id=FTL.Identifier("value"), value=FTL.Pattern( elements=[ FTL.Placeable( expression=FTL.SelectExpression( selector=MESSAGE_REFERENCE("PLATFORM()"), variants=[ FTL.Variant( key=FTL.Identifier("windows"), default=False, value=REPLACE( "toolkit/chrome/mozapps/downloads/settingsChange.dtd", "settingsChangeOptions.label", { "&brandShortName;": TERM_REFERENCE( "brand-short-name" ), }, ), ), FTL.Variant( key=FTL.Identifier("other"), default=True, value=REPLACE( "toolkit/chrome/mozapps/downloads/settingsChange.dtd", "settingsChangePreferences.label", { "&brandShortName;": TERM_REFERENCE( "brand-short-name" ), }, ), ), ], ) ) ] ), ) ], ) ], )
def migrate(ctx): """Bug 1580599 - Convert toolbox.properties to Fluent, part {index}.""" source = "devtools/client/toolbox.properties" target = "devtools/client/toolbox.ftl" ctx.add_transforms( target, target, [ FTL.Message( id=FTL.Identifier("toolbox-meatball-menu-dock-bottom-label"), value=COPY(source, "toolbox.meatballMenu.dock.bottom.label"), ), FTL.Message( id=FTL.Identifier("toolbox-meatball-menu-dock-left-label"), value=COPY(source, "toolbox.meatballMenu.dock.left.label"), ), FTL.Message( id=FTL.Identifier("toolbox-meatball-menu-dock-right-label"), value=COPY(source, "toolbox.meatballMenu.dock.right.label"), ), FTL.Message( id=FTL.Identifier( "toolbox-meatball-menu-dock-separate-window-label"), value=COPY(source, "toolbox.meatballMenu.dock.separateWindow.label"), ), FTL.Message( id=FTL.Identifier("toolbox-meatball-menu-splitconsole-label"), value=COPY(source, "toolbox.meatballMenu.splitconsole.label"), ), FTL.Message( id=FTL.Identifier("toolbox-meatball-menu-hideconsole-label"), value=COPY(source, "toolbox.meatballMenu.hideconsole.label"), ), FTL.Message( id=FTL.Identifier("toolbox-meatball-menu-noautohide-label"), value=COPY(source, "toolbox.meatballMenu.noautohide.label"), ), FTL.Message( id=FTL.Identifier("toolbox-meatball-menu-settings-label"), value=COPY(source, "toolbox.meatballMenu.settings.label"), ), FTL.Message( id=FTL.Identifier("toolbox-meatball-menu-documentation-label"), value=COPY(source, "toolbox.meatballMenu.documentation.label"), ), FTL.Message( id=FTL.Identifier("toolbox-meatball-menu-community-label"), value=COPY(source, "toolbox.meatballMenu.community.label"), ), ], )
def migrate(ctx): """Bug 1432338 - Introduce sync-brand.ftl, part {index}.""" ctx.add_transforms( 'browser/browser/branding/sync-brand.ftl', 'browser/locales/en-US/browser/branding/sync-brand.ftl', [ FTL.Term(id=FTL.Identifier('-sync-brand-short-name'), value=COPY('browser/chrome/browser/syncBrand.dtd', 'syncBrand.shortName.label')), FTL.Term(id=FTL.Identifier('-sync-brand-name'), value=COPY('browser/chrome/browser/syncBrand.dtd', 'syncBrand.fullName.label')), ])
def migrate(ctx): """Migrate bedrock/base/templates/404.html, part {index}.""" ctx.add_transforms( "404.ftl", "404.ftl", transforms_from(""" not-found-page-not-found-page-page-not-found = {COPY(not_found, "404: Page Not Found",)} not-found-page-sorry-we-cant-find-that-page = {COPY(not_found, "Sorry, we can’t find that page",)} not-found-page-were-all-about-a-healthy-internet = {COPY(not_found, "We’re all about a healthy internet but sometimes broken URLs happen.",)} not-found-page-go-back = {COPY(not_found, "Go Back",)} """, not_found=not_found) + [ FTL.Message( id=FTL.Identifier( "not-found-page-learn-about-mozilla-the-non"), value=REPLACE( not_found, "<a href=\"%(about)s\">Learn</a> about Mozilla, the non-profit behind Firefox.", { "%%": "%", "%(about)s": VARIABLE_REFERENCE("about"), "Mozilla": TERM_REFERENCE("brand-name-mozilla"), "Firefox": TERM_REFERENCE("brand-name-firefox"), })), FTL.Message( id=FTL.Identifier( "not-found-page-explore-the-entire-family-for"), value=REPLACE( not_found, "<a href=%(explore)s>Explore</a> the entire family for Firefox products designed to respect your privacy.", { "%%": "%", "%(explore)s": VARIABLE_REFERENCE("explore"), "Firefox": TERM_REFERENCE("brand-name-firefox"), })), FTL.Message( id=FTL.Identifier( "not-found-page-download-the-firefox-browser"), value=REPLACE( not_found, "<a href=%(download)s>Download</a> the Firefox browser for your mobile device or desktop", { "%%": "%", "%(download)s": VARIABLE_REFERENCE("download"), "Firefox": TERM_REFERENCE("brand-name-firefox"), })), ])
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, )
def migrate(ctx): """Migrate bedrock/newsletter/templates/newsletter/opt-out-confirmation.html, part {index}.""" ctx.add_transforms( "newsletter/opt-out-confirmation.ftl", "newsletter/opt-out-confirmation.ftl", transforms_from(""" opt-out-confirmation-cool-we-hear = {COPY(opt_out_confirmation, "Cool. We hear you.",)} opt-out-confirmation-youre-now-opted = {COPY(opt_out_confirmation, "You’re now opted out of a series of emails about setting up your account.",)} opt-out-confirmation-youll-continue = {COPY(opt_out_confirmation, "You’ll continue to receive other emails you’re subscribed to, along with occasional important updates about your account. To manage all your subscriptions, enter your email below — we need to make sure we’re talking to the right person.",)} opt-out-confirmation-your-email = {COPY(opt_out_confirmation, "Your email address:",)} opt-out-confirmation-yournameexamplecom = {COPY(opt_out_confirmation, "*****@*****.**",)} opt-out-confirmation-manage-preferences = {COPY(opt_out_confirmation, "Manage Preferences",)} opt-out-confirmation-prefer-to-get = {COPY(opt_out_confirmation, "Prefer to get information another way?",)} opt-out-confirmation-check-out-our = {COPY(opt_out_confirmation, "Check out our blogs",)} opt-out-confirmation-get-help = {COPY(opt_out_confirmation, "Get help",)} """, opt_out_confirmation=opt_out_confirmation) + [ FTL.Message( id=FTL.Identifier("opt-out-confirmation-subscribe-to"), value=REPLACE( opt_out_confirmation, "Subscribe to occasional newsletter updates from Firefox", { "Firefox": TERM_REFERENCE("brand-name-firefox"), })), ])
def migrate(ctx): """Bug 1552333 - Migrate strings from pipnss.properties to aboutCertError.ftl""" ctx.add_transforms( "browser/browser/aboutCertError.ftl", "browser/browser/aboutCertError.ftl", transforms_from( """ cert-error-symantec-distrust-admin = { COPY(from_path, "certErrorSymantecDistrustAdministrator") } """, 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-symantec-distrust-description"), value=REPLACE( "security/manager/chrome/pipnss/pipnss.properties", "certErrorSymantecDistrustDescription1", { "%1$S": VARIABLE_REFERENCE("hostname"), }, normalize_printf=True, ), ), ], )
def migrate(ctx): """Bug 1745932 - Move highlighters.properties to fluent, part {index}.""" ctx.add_transforms( "devtools/shared/highlighters.ftl", "devtools/shared/highlighters.ftl", transforms_from( """ gridtype-container = { COPY(from_path, "gridType.container") } gridtype-item = { COPY(from_path, "gridType.item") } gridtype-dual = { COPY(from_path, "gridType.dual") } flextype-container = { COPY(from_path, "flexType.container") } flextype-item = { COPY(from_path, "flexType.item") } flextype-dual = { COPY(from_path, "flexType.dual") } remote-node-picker-notice-action-desktop = { COPY(from_path, "remote-node-picker-notice-action-desktop") } remote-node-picker-notice-action-touch = { COPY(from_path, "remote-node-picker-notice-action-touch") } remote-node-picker-notice-hide-button = { COPY(from_path, "remote-node-picker-notice-hide-button") } """, from_path="devtools/shared/highlighters.properties", ), ) ctx.add_transforms( "devtools/shared/highlighters.ftl", "devtools/shared/highlighters.ftl", [ FTL.Message( id=FTL.Identifier("grid-row-column-positions"), value=REPLACE( "devtools/shared/highlighters.properties", "grid.rowColumnPositions", { "%1$S": VARIABLE_REFERENCE("row"), "%2$S": VARIABLE_REFERENCE("column"), }, ), ), FTL.Message( id=FTL.Identifier("remote-node-picker-notice"), value=REPLACE( "devtools/shared/highlighters.properties", "remote-node-picker-notice", {"%1$S": VARIABLE_REFERENCE("action")}, ), ), ], )
def migrate(ctx): """Migrate bedrock/privacy/templates/privacy/principles.html, part {index}.""" ctx.add_transforms( "privacy/principles.ftl", "privacy/principles.ftl", transforms_from(""" privacy-principles-data-privacy-principles = {COPY(principles, "Data Privacy Principles",)} """, principles=principles) + [ FTL.Message( id=FTL.Identifier( "privacy-principles-mozilla-is-an-open-source"), value=REPLACE( principles, "Mozilla is an open source project with a mission to improve your Internet experience. This is a driving force behind our privacy practices.", { "Mozilla": TERM_REFERENCE("brand-name-mozilla"), })), FTL.Message( id=FTL.Identifier( "privacy-principles-the-following-five-principles"), value=REPLACE( principles, "The following five principles stem from the <a href=\"%(link)s\">Mozilla Manifesto</a> and inform how we:", { "%%": "%", "%(link)s": VARIABLE_REFERENCE("link"), "Mozilla": TERM_REFERENCE("brand-name-mozilla"), })), ] + transforms_from(""" privacy-principles-develop-our-products = {COPY(principles, "develop our products and services",)} privacy-principles-manage-user-data-we-collect = {COPY(principles, "manage user data we collect",)} privacy-principles-select-and-interact-with = {COPY(principles, "select and interact with partners",)} privacy-principles-shape-our-public-policy = {COPY(principles, "shape our public policy and advocacy work",)} privacy-principles-no-surprises = {COPY(principles, "No surprises",)} privacy-principles-use-and-share-information = {COPY(principles, "Use and share information in a way that is transparent and benefits the user.",)} privacy-principles-user-control = {COPY(principles, "User control",)} privacy-principles-develop-products-and = {COPY(principles, "Develop products and advocate for best practices that put users in control of their data and online experiences.",)} privacy-principles-limited-data = {COPY(principles, "Limited data",)} privacy-principles-collect-what-we-need = {COPY(principles, "Collect what we need, de-identify where we can and delete when no longer necessary.",)} privacy-principles-sensible-settings = {COPY(principles, "Sensible settings",)} privacy-principles-design-for-a-thoughtful = {COPY(principles, "Design for a thoughtful balance of safety and user experience.",)} privacy-principles-defense-in-depth = {COPY(principles, "Defense in depth",)} privacy-principles-maintain-multi-layered = {COPY(principles, "Maintain multi-layered security controls and practices, many of which are publicly verifiable.",)} """, principles=principles))
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()
def migrate(ctx): """Bug 1445084 - Migrate search results pane of Preferences to Fluent, part {index}.""" ctx.add_transforms( 'browser/browser/preferences/preferences.ftl', 'browser/browser/preferences/preferences.ftl', [ FTL.Message( id=FTL.Identifier('search-input-box'), attributes=[ FTL.Attribute( FTL.Identifier('style'), CONCAT( FTL.TextElement('width: '), COPY( 'browser/chrome/browser/preferences/preferences.dtd', 'searchField.width')), ), FTL.Attribute( FTL.Identifier('placeholder'), FTL.Pattern([ FTL.Placeable( FTL.SelectExpression( expression=FTL.CallExpression( callee=FTL.Function('PLATFORM')), variants=[ FTL.Variant( key=FTL.VariantName('windows'), default=False, value=COPY( 'browser/chrome/browser/preferences/preferences.properties', 'searchInput.labelWin')), FTL.Variant( key=FTL.VariantName('other'), default=True, value=COPY( 'browser/chrome/browser/preferences/preferences.properties', 'searchInput.labelUnix')) ])) ])), ]), FTL.Message( id=FTL.Identifier('search-results-header'), value=COPY( 'browser/chrome/browser/preferences/preferences.dtd', 'paneSearchResults.title')), ])
def 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)
def migrate(ctx): """Bug 1645619 - Migrate address bar placeholder to Fluent, part {index}.""" ctx.add_transforms( "browser/browser/browser.ftl", "browser/browser/browser.ftl", [ FTL.Message( id=FTL.Identifier("urlbar-placeholder-with-name"), attributes=[ FTL.Attribute( id=FTL.Identifier("placeholder"), value=REPLACE( "browser/chrome/browser/browser.properties", "urlbar.placeholder", { "%1$S": VARIABLE_REFERENCE("name"), }, normalize_printf=True)), ]) ])
def migrate(ctx): """Bug 1703003 - Migrate remove/cancel button in Bookmark panel to Fluent - part {index}""" ctx.add_transforms( "browser/browser/browser.ftl", "browser/browser/browser.ftl", transforms_from( """ bookmark-panel-cancel = .label = { COPY(from_path, "editBookmarkPanel.cancel.label") } .accesskey = { COPY(from_path, "editBookmarkPanel.cancel.accesskey") } """, from_path="browser/chrome/browser/browser.properties", ), ) ctx.add_transforms( "browser/browser/browser.ftl", "browser/browser/browser.ftl", [ FTL.Message( id=FTL.Identifier("bookmark-panel-remove"), attributes=[ FTL.Attribute( id=FTL.Identifier("label"), value=PLURALS( "browser/chrome/browser/browser.properties", "editBookmark.removeBookmarks.label", VARIABLE_REFERENCE("count"), lambda text: REPLACE_IN_TEXT( text, {"#1": VARIABLE_REFERENCE("count")}), ), ), FTL.Attribute( id=FTL.Identifier("accesskey"), value=COPY( "browser/chrome/browser/browser.properties", "editBookmark.removeBookmarks.accesskey", ), ), ], ) ], )
def migrate(ctx): """Bug 1453800 - Migrate Container removal strings to Fluent, part {index}.""" ctx.add_transforms( 'browser/browser/preferences/preferences.ftl', 'browser/browser/preferences/preferences.ftl', [ FTL.Message( id=FTL.Identifier('containers-remove-alert-title'), value=COPY( 'browser/chrome/browser/preferences/preferences.properties', 'removeContainerAlertTitle', ), ), FTL.Message( id=FTL.Identifier('containers-remove-alert-msg'), value=PLURALS( 'browser/chrome/browser/preferences/preferences.properties', 'removeContainerMsg', EXTERNAL_ARGUMENT('count'), lambda text: REPLACE_IN_TEXT( text, { '#S': EXTERNAL_ARGUMENT('count') } ) ) ), FTL.Message( id=FTL.Identifier('containers-remove-ok-button'), value=COPY( 'browser/chrome/browser/preferences/preferences.properties', 'removeContainerOkButton', ), ), FTL.Message( id=FTL.Identifier('containers-remove-cancel-button'), value=COPY( 'browser/chrome/browser/preferences/preferences.properties', 'removeContainerButton2', ), ), ] )
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 1424683 - Migrate brand-short-name to Fluent, part {index}.""" ctx.add_transforms( 'browser/branding/official/brand.ftl', 'browser/branding/official/brand.ftl', [ FTL.Term(id=FTL.Identifier('-brand-short-name'), value=COPY('browser/branding/official/brand.dtd', 'brandShortName')), ])