diff --git a/python/l10n/fluent_migrations/bug_1608197_create_profile_wizard.py b/python/l10n/fluent_migrations/bug_1608197_create_profile_wizard.py new file mode 100644 index 000000000000..d81dc3e1e4c8 --- /dev/null +++ b/python/l10n/fluent_migrations/bug_1608197_create_profile_wizard.py @@ -0,0 +1,149 @@ +# coding=utf8 + +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +from __future__ import absolute_import +import fluent.syntax.ast as FTL +from fluent.migrate.helpers import transforms_from +from fluent.migrate import COPY, REPLACE +from fluent.migrate.helpers import MESSAGE_REFERENCE, TERM_REFERENCE + +def migrate(ctx): + """Bug 1608197 - Migrate createProfileWizard to Fluent, part {index}.""" + + ctx.add_transforms( + "toolkit/toolkit/global/createProfileWizard.ftl", + "toolkit/toolkit/global/createProfileWizard.ftl", + transforms_from( +""" +create-profile-window = + .title = { COPY(from_path, "newprofile.title") } + .style = { COPY(from_path, "window.size") } +profile-creation-explanation-4 = { PLATFORM() -> + [macos] { COPY(from_path, "profileCreationExplanation_4Mac.text") } + *[other] { COPY(from_path, "profileCreationExplanation_4.text") } + } +profile-creation-intro = { COPY(from_path, "profileCreationIntro.text") } +profile-prompt = { COPY(from_path, "profilePrompt.label") } + .accesskey = { COPY(from_path, "profilePrompt.accesskey") } +profile-default-name = + .value = { COPY(from_path, "profileDefaultName") } +profile-directory-explanation = { COPY(from_path, "profileDirectoryExplanation.text") } +create-profile-choose-folder = + .label = { COPY(from_path, "button.choosefolder.label") } + .accesskey = { COPY(from_path, "button.choosefolder.accesskey") } +create-profile-use-default = + .label = { COPY(from_path, "button.usedefault.label") } + .accesskey = { COPY(from_path, "button.usedefault.accesskey") } +""", from_path="toolkit/chrome/mozapps/profile/createProfileWizard.dtd")) + ctx.add_transforms( + "toolkit/toolkit/global/createProfileWizard.ftl", + "toolkit/toolkit/global/createProfileWizard.ftl", + [ + FTL.Message( + id=FTL.Identifier("create-profile-first-page-header"), + value=FTL.Pattern( + elements=[ + FTL.Placeable( + expression=FTL.SelectExpression( + selector=FTL.FunctionReference( + id=FTL.Identifier(name="PLATFORM"), + arguments=FTL.CallArguments(positional=[], named=[]) + ), + variants=[ + FTL.Variant( + key=FTL.Identifier('macos'), + default=False, + value=COPY( + "toolkit/chrome/global/wizard.properties", + "default-first-title-mac", + ) + ), + FTL.Variant( + key=FTL.Identifier('other'), + default=True, + value=REPLACE( + "toolkit/chrome/global/wizard.properties", + "default-first-title", + { + "%1$S": MESSAGE_REFERENCE("create-profile-window.title"), + }, + normalize_printf=True + ) + ) + ] + ) + ) + ] + ) + ), + FTL.Message( + id=FTL.Identifier("profile-creation-explanation-1"), + value=REPLACE( + "toolkit/chrome/mozapps/profile/createProfileWizard.dtd", + "profileCreationExplanation_1.text", + { + "&brandShortName;": TERM_REFERENCE("brand-short-name") + } + ) + ), + FTL.Message( + id=FTL.Identifier("profile-creation-explanation-2"), + value=REPLACE( + "toolkit/chrome/mozapps/profile/createProfileWizard.dtd", + "profileCreationExplanation_2.text", + { + "&brandShortName;": TERM_REFERENCE("brand-short-name") + } + ) + ), + FTL.Message( + id=FTL.Identifier("profile-creation-explanation-3"), + value=REPLACE( + "toolkit/chrome/mozapps/profile/createProfileWizard.dtd", + "profileCreationExplanation_3.text", + { + "&brandShortName;": TERM_REFERENCE("brand-short-name") + } + ) + ), + FTL.Message( + id=FTL.Identifier("create-profile-last-page-header"), + value=FTL.Pattern( + elements=[ + FTL.Placeable( + expression=FTL.SelectExpression( + selector=FTL.FunctionReference( + id=FTL.Identifier(name="PLATFORM"), + arguments=FTL.CallArguments(positional=[], named=[]) + ), + variants=[ + FTL.Variant( + key=FTL.Identifier('macos'), + default=False, + value=COPY( + "toolkit/chrome/global/wizard.properties", + "default-last-title-mac", + ) + ), + FTL.Variant( + key=FTL.Identifier('other'), + default=True, + value=REPLACE( + "toolkit/chrome/global/wizard.properties", + "default-last-title", + { + "%1$S": MESSAGE_REFERENCE("create-profile-window.title"), + }, + normalize_printf=True + ) + ) + ] + ) + ) + ] + ) + ), + ] + ) diff --git a/toolkit/content/widgets/wizard.js b/toolkit/content/widgets/wizard.js index 5fd57ffc75a0..369dc131d6f9 100644 --- a/toolkit/content/widgets/wizard.js +++ b/toolkit/content/widgets/wizard.js @@ -108,6 +108,9 @@ } connectedCallback() { + if (document.l10n) { + document.l10n.connectRoot(this.shadowRoot); + } document.documentElement.setAttribute("role", "dialog"); this._maybeStartWizard(); @@ -419,6 +422,10 @@ } _adjustWizardHeader() { + if (document.l10n) { + this._adjustFluentHeaders(); + return; + } var label = this.currentPage.getAttribute("label"); if (!label && this.onFirstPage && this._bundle) { if (AppConstants.platform == "macosx") { @@ -448,6 +455,17 @@ } } + _adjustFluentHeaders() { + let value = this.currentPage.getAttribute("data-header-label-id"); + let label = this._wizardHeader.querySelector(".wizard-header-label"); + if (value) { + document.l10n.setAttributes(label, value); + } else { + label.removeAttribute("data-l10n-id"); + label.textContent = ""; + } + } + _hitEnter(evt) { if (!evt.defaultPrevented) { this.advance(); diff --git a/toolkit/locales/en-US/chrome/mozapps/profile/createProfileWizard.dtd b/toolkit/locales/en-US/chrome/mozapps/profile/createProfileWizard.dtd deleted file mode 100644 index 55384350acc7..000000000000 --- a/toolkit/locales/en-US/chrome/mozapps/profile/createProfileWizard.dtd +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/toolkit/locales/en-US/toolkit/global/createProfileWizard.ftl b/toolkit/locales/en-US/toolkit/global/createProfileWizard.ftl new file mode 100644 index 000000000000..9df6b44b87fb --- /dev/null +++ b/toolkit/locales/en-US/toolkit/global/createProfileWizard.ftl @@ -0,0 +1,53 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +create-profile-window = + .title = Create Profile Wizard + .style = width: 45em; height: 32em; + +## First wizard page + +create-profile-first-page-header = + { PLATFORM() -> + [macos] Introduction + *[other] Welcome to the { create-profile-window.title } + } + +profile-creation-explanation-1 = { -brand-short-name } stores information about your settings and preferences in your personal profile. + +profile-creation-explanation-2 = If you are sharing this copy of { -brand-short-name } with other users, you can use profiles to keep each user’s information separate. To do this, each user should create his or her own profile. + +profile-creation-explanation-3 = If you are the only person using this copy of { -brand-short-name }, you must have at least one profile. If you would like, you can create multiple profiles for yourself to store different sets of settings and preferences. For example, you may want to have separate profiles for business and personal use. + +profile-creation-explanation-4 = + { PLATFORM() -> + [macos] To begin creating your profile, click Continue. + *[other] To begin creating your profile, click Next. + } + +## Second wizard page + +create-profile-last-page-header = + { PLATFORM() -> + [macos] Conclusion + *[other] Completing the { create-profile-window.title } + } + +profile-creation-intro = If you create several profiles you can tell them apart by the profile names. You may use the name provided here or use one of your own. + +profile-prompt = Enter new profile name: + .accesskey = E + +profile-default-name = + .value = Default User + +profile-directory-explanation = Your user settings, preferences and other user-related data will be stored in: + +create-profile-choose-folder = + .label = Choose Folder… + .accesskey = C + +create-profile-use-default = + .label = Use Default Folder + .accesskey = U diff --git a/toolkit/locales/jar.mn b/toolkit/locales/jar.mn index d6bf9497a48d..8de2ac8da496 100644 --- a/toolkit/locales/jar.mn +++ b/toolkit/locales/jar.mn @@ -74,7 +74,6 @@ #endif locale/@AB_CD@/mozapps/handling/handling.dtd (%chrome/mozapps/handling/handling.dtd) locale/@AB_CD@/mozapps/handling/handling.properties (%chrome/mozapps/handling/handling.properties) - locale/@AB_CD@/mozapps/profile/createProfileWizard.dtd (%chrome/mozapps/profile/createProfileWizard.dtd) locale/@AB_CD@/mozapps/profile/profileSelection.properties (%chrome/mozapps/profile/profileSelection.properties) #ifdef MOZ_BLOCK_PROFILE_DOWNGRADE locale/@AB_CD@/mozapps/profile/profileDowngrade.dtd (%chrome/mozapps/profile/profileDowngrade.dtd) diff --git a/toolkit/profile/content/createProfileWizard.xhtml b/toolkit/profile/content/createProfileWizard.xhtml index e8d8bf48b9a7..e4a17ed54cc9 100644 --- a/toolkit/profile/content/createProfileWizard.xhtml +++ b/toolkit/profile/content/createProfileWizard.xhtml @@ -5,20 +5,21 @@ - -%brandDTD; - -%profileDTD; -]> + + data-l10n-attrs="style" + > + + + + +