Bug 1505846 Migrate about:searchreset to Fluent r=jaws,flod,zbraniecki

Differential Revision: https://phabricator.services.mozilla.com/D11373

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Collin Wing 2018-11-26 17:05:18 +00:00
Родитель 8a1a16a9bd
Коммит 4e84891915
6 изменённых файлов: 147 добавлений и 53 удалений

Просмотреть файл

@ -15,9 +15,11 @@ const TELEMETRY_RESULT_ENUM = {
};
window.onload = function() {
let defaultEngine = document.getElementById("defaultEngine");
let defaultEngineParagraph = document.getElementById("defaultEngineParagraph");
let originalDefault = Services.search.originalDefaultEngine;
defaultEngine.textContent = originalDefault.name;
document.l10n.setAttributes(defaultEngineParagraph, "page-info-new-search-engine",
{ searchEngine: originalDefault.name });
let defaultEngine = document.getElementById("defaultEngine");
defaultEngine.style.backgroundImage =
'url("' + originalDefault.iconURI.spec + '")';

Просмотреть файл

@ -4,21 +4,12 @@
- 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/. -->
<!DOCTYPE html [
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % searchresetDTD SYSTEM "chrome://browser/locale/aboutSearchReset.dtd">
%searchresetDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
]>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<title>&searchreset.tabtitle;</title>
<title data-l10n-id="tab-title"/>
<link rel="stylesheet" type="text/css" media="all"
href="chrome://global/skin/in-content/info-pages.css"/>
<link rel="stylesheet" type="text/css" media="all"
@ -28,31 +19,35 @@
<script type="application/javascript"
src="chrome://browser/content/search/searchReset.js"/>
<link rel="localization" href="browser/aboutSearchReset.ftl"/>
<link rel="localization" href="branding/brand.ftl"/>
</head>
<body dir="&locale.dir;">
<body>
<div class="container">
<div class="title">
<h1 class="title-text">&searchreset.pageTitle;</h1>
<h1 class="title-text" data-l10n-id="page-title"/>
</div>
<div class="description">
<p>&searchreset.pageInfo1;</p>
<p>&searchreset.selector.label;<span id="defaultEngine"/></p>
<p data-l10n-id="page-info-outofdate"/>
<p id="defaultEngineParagraph">
<span id="defaultEngine" data-l10n-name="default-engine"/>
</p>
<p>&searchreset.beforelink.pageInfo2;<a id="linkSettingsPage" href="about:preferences#search">&searchreset.link.pageInfo2;</a>&searchreset.afterlink.pageInfo2;</p>
<p data-l10n-id="page-info-how-to-change">
<a id="linkSettingsPage" href="about:preferences#search" data-l10n-name="link"></a>
</p>
</div>
<div class="button-container">
<xul:button id="searchResetKeepCurrent"
label="&searchreset.noChangeButton;"
accesskey="&searchreset.noChangeButton.access;"
data-l10n-id="no-change-button"
oncommand="keepCurrentEngine();"/>
<xul:button class="primary"
id="searchResetChangeEngine"
label="&searchreset.changeEngineButton;"
accesskey="&searchreset.changeEngineButton.access;"
data-l10n-id="change-engine-button"
oncommand="changeSearchEngine();"/>
</div>
</div>

Просмотреть файл

@ -0,0 +1,17 @@
# 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/.
tab-title = Restore Search Settings
page-title = Restore your search settings?
page-info-outofdate = Your search settings might be out-of-date. { -brand-short-name } can help you restore the default search settings.
# Variables:
# $searchEngine (String) - Name of the default search engine e.g. Google
page-info-new-search-engine = This will set your default search engine to <span data-l10n-name="default-engine">{ $searchEngine }</span>
page-info-how-to-change = You can change these settings at any time from the <a data-l10n-name="link">Settings page</a>.
no-change-button =
.label = Dont Change
.accesskey = D
change-engine-button =
.label = Change Search Engine
.accesskey = C

Просмотреть файл

@ -1,30 +0,0 @@
<!-- 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/. -->
<!ENTITY searchreset.tabtitle "Restore Search Settings">
<!ENTITY searchreset.pageTitle "Restore your search settings?">
<!ENTITY searchreset.pageInfo1 "Your search settings might be out-of-date. &brandShortName; can help you restore the default search settings.">
<!-- LOCALIZATION NOTE (searchreset.selector.label): this string is
followed by a dropdown of all the built-in search engines. -->
<!ENTITY searchreset.selector.label "This will set your default search engine to">
<!-- LOCALIZATION NOTE (searchreset.beforelink.pageInfo,
searchreset.afterlink.pageInfo): these two string are used respectively
before and after the "Settings page" link (searchreset.link.pageInfo2).
Localizers can use one of them, or both, to better adapt this sentence to
their language. -->
<!ENTITY searchreset.beforelink.pageInfo2 "You can change these settings at any time from the ">
<!ENTITY searchreset.afterlink.pageInfo2 ".">
<!ENTITY searchreset.link.pageInfo2 "Settings page">
<!ENTITY searchreset.noChangeButton "Dont Change">
<!ENTITY searchreset.noChangeButton.access "D">
<!ENTITY searchreset.changeEngineButton "Change Search Engine">
<!ENTITY searchreset.changeEngineButton.access "C">

Просмотреть файл

@ -17,7 +17,6 @@
locale/browser/aboutPrivateBrowsing.dtd (%chrome/browser/aboutPrivateBrowsing.dtd)
locale/browser/aboutRobots.dtd (%chrome/browser/aboutRobots.dtd)
locale/browser/accounts.properties (%chrome/browser/accounts.properties)
locale/browser/aboutSearchReset.dtd (%chrome/browser/aboutSearchReset.dtd)
locale/browser/aboutTabCrashed.dtd (%chrome/browser/aboutTabCrashed.dtd)
locale/browser/browser.dtd (%chrome/browser/browser.dtd)
locale/browser/baseMenuOverlay.dtd (%chrome/browser/baseMenuOverlay.dtd)

Просмотреть файл

@ -0,0 +1,111 @@
# 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.helpers import TERM_REFERENCE
from fluent.migrate import COPY
from fluent.migrate import REPLACE
from fluent.migrate import CONCAT
def migrate(ctx):
"""Bug 1505846 Migrate about:searchreset to Fluent, part {index} """
ctx.add_transforms(
"browser/browser/aboutSearchReset.ftl",
"browser/browser/aboutSearchReset.ftl",
transforms_from(
"""
tab-title = { COPY("browser/chrome/browser/aboutSearchReset.dtd", "searchreset.tabtitle") }
page-title = { COPY("browser/chrome/browser/aboutSearchReset.dtd", "searchreset.pageTitle") }
"""
)
)
ctx.add_transforms(
"browser/browser/aboutSearchReset.ftl",
"browser/browser/aboutSearchReset.ftl",
[
FTL.Message(
id=FTL.Identifier("page-info-outofdate"),
value=REPLACE(
"browser/chrome/browser/aboutSearchReset.dtd",
"searchreset.pageInfo1",
{
"&brandShortName;": TERM_REFERENCE("-brand-short-name"),
}
)
),
FTL.Message(
id=FTL.Identifier("page-info-how-to-change"),
value=CONCAT(
COPY(
"browser/chrome/browser/aboutSearchReset.dtd",
"searchreset.beforelink.pageInfo2",
),
FTL.TextElement('<a data-l10n-name="link">'),
COPY(
"browser/chrome/browser/aboutSearchReset.dtd",
"searchreset.link.pageInfo2",
),
FTL.TextElement("</a>"),
COPY(
"browser/chrome/browser/aboutSearchReset.dtd",
"searchreset.afterlink.pageInfo2",
)
)
),
FTL.Message(
id=FTL.Identifier("no-change-button"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY(
"browser/chrome/browser/aboutSearchReset.dtd",
"searchreset.noChangeButton",
)
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY(
"browser/chrome/browser/aboutSearchReset.dtd",
"searchreset.noChangeButton.access",
)
),
]
),
FTL.Message(
id=FTL.Identifier("change-engine-button"),
attributes=[
FTL.Attribute(
id=FTL.Identifier("label"),
value=COPY(
"browser/chrome/browser/aboutSearchReset.dtd",
"searchreset.changeEngineButton",
)
),
FTL.Attribute(
id=FTL.Identifier("accesskey"),
value=COPY(
"browser/chrome/browser/aboutSearchReset.dtd",
"searchreset.changeEngineButton.access",
)
),
]
),
FTL.Message(
id=FTL.Identifier("page-info-new-search-engine"),
value=CONCAT(
COPY(
"browser/chrome/browser/aboutSearchReset.dtd",
"searchreset.selector.label",
),
FTL.TextElement(' <span data-l10n-name="default-engine">{ $searchEngine }</span>'),
)
)
]
)