Bug 1415733 - Migrate the "Search" section of Preferences to the new Localization API. r=flod,Gijs

MozReview-Commit-ID: ltXNOkdnOV

--HG--
extra : rebase_source : b75176b4e526ace545d1483606aa21dd8af76b58
This commit is contained in:
Zibi Braniecki 2018-03-12 17:17:13 -07:00
Родитель fbaf1d233a
Коммит 07171ff48a
9 изменённых файлов: 319 добавлений и 81 удалений

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

@ -37,7 +37,6 @@
<!ENTITY % clearSiteDataDTD SYSTEM <!ENTITY % clearSiteDataDTD SYSTEM
"chrome://browser/locale/preferences/clearSiteData.dtd" > "chrome://browser/locale/preferences/clearSiteData.dtd" >
<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd"> <!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
<!ENTITY % searchDTD SYSTEM "chrome://browser/locale/preferences/search.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd"> <!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
<!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd"> <!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd">
<!ENTITY % securityDTD SYSTEM <!ENTITY % securityDTD SYSTEM
@ -68,7 +67,6 @@
%siteDataSettingsDTD; %siteDataSettingsDTD;
%clearSiteDataDTD; %clearSiteDataDTD;
%privacyDTD; %privacyDTD;
%searchDTD;
%syncBrandDTD; %syncBrandDTD;
%syncDTD; %syncDTD;
%securityDTD; %securityDTD;

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

@ -356,12 +356,16 @@ var gSearchPane = {
// Notify the user if they have chosen an existing engine/bookmark keyword // Notify the user if they have chosen an existing engine/bookmark keyword
if (eduplicate || bduplicate) { if (eduplicate || bduplicate) {
let strings = document.getElementById("engineManagerBundle"); let msgids = [["search-keyword-warning-title"]];
let dtitle = strings.getString("duplicateTitle"); if (eduplicate) {
let bmsg = strings.getString("duplicateBookmarkMsg"); msgids.push(["search-keyword-warning-engine", { name: dupName }]);
let emsg = strings.getFormattedString("duplicateEngineMsg", [dupName]); } else {
msgids.push(["search-keyword-warning-bookmark"]);
}
Services.prompt.alert(window, dtitle, eduplicate ? emsg : bmsg); let [dtitle, msg] = await document.l10n.formatValues(msgids);
Services.prompt.alert(window, dtitle, msg);
return false; return false;
} }
} }

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

@ -1,29 +1,27 @@
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content/search.js"/> src="chrome://browser/content/preferences/in-content/search.js"/>
<stringbundle id="engineManagerBundle" src="chrome://browser/locale/engineManager.properties"/>
<hbox id="searchCategory" <hbox id="searchCategory"
class="subcategory" class="subcategory"
hidden="true" hidden="true"
data-category="paneSearch"> data-category="paneSearch">
<label class="header-name" flex="1">&paneSearch.title;</label> <label class="header-name" flex="1" data-l10n-id="pane-search-title" />
</hbox> </hbox>
<groupbox id="searchbarGroup" data-category="paneSearch"> <groupbox id="searchbarGroup" data-category="paneSearch">
<caption><label id="searchbarLabel">&searchBar.label;</label></caption> <caption><label id="searchbarLabel" data-l10n-id="search-bar-header" /></caption>
<radiogroup id="searchBarVisibleGroup" aria-labelledby="searchbarLabel" preference="browser.search.widget.inNavBar"> <radiogroup id="searchBarVisibleGroup" aria-labelledby="searchbarLabel" preference="browser.search.widget.inNavBar">
<radio id="searchBarHiddenRadio" value="false" label="&searchBar.hidden.label;"/> <radio id="searchBarHiddenRadio" value="false" data-l10n-id="search-bar-hidden"/>
<image class="searchBarImage searchBarHiddenImage" role="presentation"/> <image class="searchBarImage searchBarHiddenImage" role="presentation"/>
<radio id="searchBarShownRadio" value="true" label="&searchBar.shown.label;"/> <radio id="searchBarShownRadio" value="true" data-l10n-id="search-bar-shown"/>
<image class="searchBarImage searchBarShownImage" role="presentation"/> <image class="searchBarImage searchBarShownImage" role="presentation"/>
</radiogroup> </radiogroup>
</groupbox> </groupbox>
<!-- Default Search Engine --> <!-- Default Search Engine -->
<groupbox id="defaultEngineGroup" data-category="paneSearch"> <groupbox id="defaultEngineGroup" data-category="paneSearch">
<caption><label>&defaultSearchEngine.label;</label></caption> <caption><label data-l10n-id="search-engine-default-header" /></caption>
<description>&chooseYourDefaultSearchEngine2.label;</description> <description data-l10n-id="search-engine-default-desc" />
<hbox id="browserDefaultSearchExtensionContent" align="center" hidden="true"> <hbox id="browserDefaultSearchExtensionContent" align="center" hidden="true">
<description control="disableDefaultSearchExtension" flex="1"/> <description control="disableDefaultSearchExtension" flex="1"/>
@ -39,50 +37,46 @@
</hbox> </hbox>
<checkbox id="suggestionsInSearchFieldsCheckbox" <checkbox id="suggestionsInSearchFieldsCheckbox"
label="&provideSearchSuggestions.label;" data-l10n-id="search-suggestions-option"
accesskey="&provideSearchSuggestions.accesskey;"
preference="browser.search.suggest.enabled"/> preference="browser.search.suggest.enabled"/>
<vbox class="indent"> <vbox class="indent">
<checkbox id="urlBarSuggestion" label="&showURLBarSuggestions2.label;" <checkbox id="urlBarSuggestion" data-l10n-id="search-show-suggestions-url-bar-option" />
accesskey="&showURLBarSuggestions2.accesskey;"/>
<checkbox id="showSearchSuggestionsFirstCheckbox" <checkbox id="showSearchSuggestionsFirstCheckbox"
label="&showSearchSuggestionsAboveHistory.label;"/> data-l10n-id="search-show-suggestions-above-history-option"/>
<hbox id="urlBarSuggestionPermanentPBLabel" <hbox id="urlBarSuggestionPermanentPBLabel"
align="center" class="indent"> align="center" class="indent">
<label flex="1">&urlBarSuggestionsPermanentPB.label;</label> <label flex="1" data-l10n-id="search-suggestions-cant-show" />
</hbox> </hbox>
</vbox> </vbox>
</groupbox> </groupbox>
<groupbox id="oneClickSearchProvidersGroup" data-category="paneSearch"> <groupbox id="oneClickSearchProvidersGroup" data-category="paneSearch">
<caption><label>&oneClickSearchEngines.label;</label></caption> <caption><label data-l10n-id="search-one-click-header" /></caption>
<description>&chooseWhichOneToDisplay2.label;</description> <description data-l10n-id="search-one-click-desc" />
<tree id="engineList" flex="1" rows="8" hidecolumnpicker="true" editable="true" <tree id="engineList" flex="1" rows="8" hidecolumnpicker="true" editable="true"
seltype="single" allowunderflowscroll="true"> seltype="single" allowunderflowscroll="true">
<treechildren id="engineChildren" flex="1"/> <treechildren id="engineChildren" flex="1"/>
<treecols> <treecols>
<treecol id="engineShown" type="checkbox" editable="true" sortable="false"/> <treecol id="engineShown" type="checkbox" editable="true" sortable="false"/>
<treecol id="engineName" flex="4" label="&engineNameColumn.label;" sortable="false"/> <treecol id="engineName" flex="4" data-l10n-id="search-choose-engine-column" sortable="false"/>
<treecol id="engineKeyword" flex="1" label="&engineKeywordColumn.label;" editable="true" <treecol id="engineKeyword" flex="1" data-l10n-id="search-choose-keyword-column" editable="true"
sortable="false"/> sortable="false"/>
</treecols> </treecols>
</tree> </tree>
<hbox> <hbox>
<button id="restoreDefaultSearchEngines" <button id="restoreDefaultSearchEngines"
label="&restoreDefaultSearchEngines.label;" data-l10n-id="search-restore-default"
accesskey="&restoreDefaultSearchEngines.accesskey;"
/> />
<spacer flex="1"/> <spacer flex="1"/>
<button id="removeEngineButton" <button id="removeEngineButton"
class="searchEngineAction" class="searchEngineAction"
label="&removeEngine.label;" data-l10n-id="search-remove-engine"
accesskey="&removeEngine.accesskey;"
disabled="true" disabled="true"
/> />
</hbox> </hbox>
<hbox id="addEnginesBox" pack="start"> <hbox id="addEnginesBox" pack="start">
<label id="addEngines" class="text-link">&findMoreSearchEngines.label;</label> <label id="addEngines" class="text-link" data-l10n-id="search-find-more-link"></label>
</hbox> </hbox>
</groupbox> </groupbox>

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

@ -377,3 +377,59 @@ network-proxy-connection-learn-more = Learn More
network-proxy-connection-settings = network-proxy-connection-settings =
.label = Settings… .label = Settings…
.accesskey = e .accesskey = e
## Search Section
search-bar-header = Search Bar
search-bar-hidden =
.label = Use the address bar for search and navigation
search-bar-shown =
.label = Add search bar in toolbar
search-engine-default-header = Default Search Engine
search-engine-default-desc = Choose the default search engine to use in the address bar and search bar.
search-suggestions-option =
.label = Provide search suggestions
.accesskey = s
search-show-suggestions-url-bar-option =
.label = Show search suggestions in address bar results
.accesskey = l
# This string describes what the user will observe when the system
# prioritizes search suggestions over browsing history in the results
# that extend down from the address bar. In the original English string,
# "ahead" refers to location (appearing most proximate to), not time
# (appearing before).
search-show-suggestions-above-history-option =
.label = Show search suggestions ahead of browsing history in address bar results
search-suggestions-cant-show = Search suggestions will not be shown in location bar results because you have configured { -brand-short-name } to never remember history.
search-one-click-header = One-Click Search Engines
search-one-click-desc = Choose the alternative search engines that appear below the address bar and search bar when you start to enter a keyword.
search-choose-engine-column =
.label = Search Engine
search-choose-keyword-column =
.label = Keyword
search-restore-default =
.label = Restore Default Search Engines
.accesskey = D
search-remove-engine =
.label = Remove
.accesskey = R
search-find-more-link = Find more search engines
# This warning is displayed when the chosen keyword is already in use
# ('Duplicate' is an adjective)
search-keyword-warning-title = Duplicate Keyword
# Variables:
# $name (String) - Name of a search engine.
search-keyword-warning-engine = You have chosen a keyword that is currently in use by “{ $name }”. Please select another.
search-keyword-warning-bookmark = You have chosen a keyword that is currently in use by a bookmark. Please select another.

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

@ -1,7 +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/.
duplicateTitle=Duplicate Keyword
duplicateEngineMsg=You have chosen a keyword that is currently in use by “%S”. Please select another.
duplicateBookmarkMsg=You have chosen a keyword that is currently in use by a bookmark. Please select another.

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

@ -2,7 +2,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this - 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/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY paneSearch.title "Search">
<!ENTITY paneContainers.title "Container Tabs"> <!ENTITY paneContainers.title "Container Tabs">
<!ENTITY browserPrivacy.label "Browser Privacy"> <!ENTITY browserPrivacy.label "Browser Privacy">

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

@ -1,41 +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 searchBar.label "Search Bar">
<!ENTITY searchBar.hidden.label "Use the address bar for search and navigation">
<!ENTITY searchBar.shown.label "Add search bar in toolbar">
<!-- LOCALIZATION NOTE (showSearchSuggestionsAboveHistory.label): This string
describes what the user will observe when the system prioritizes search
suggestions over browsing history in the results that extend down from the
address bar. In the original English string, "ahead" refers to location
(appearing most proximate to), not time (appearing before). -->
<!ENTITY showSearchSuggestionsAboveHistory.label "Show search suggestions ahead of browsing history in address bar results">
<!ENTITY defaultSearchEngine.label "Default Search Engine">
<!ENTITY chooseYourDefaultSearchEngine2.label "Choose the default search engine to use in the address bar and search bar.">
<!ENTITY provideSearchSuggestions.label "Provide search suggestions">
<!ENTITY provideSearchSuggestions.accesskey "s">
<!ENTITY showURLBarSuggestions2.label "Show search suggestions in address bar results">
<!ENTITY showURLBarSuggestions2.accesskey "l">
<!ENTITY urlBarSuggestionsPermanentPB.label "Search suggestions will not be shown in location bar results because you have configured &brandShortName; to never remember history.">
<!ENTITY oneClickSearchEngines.label "One-Click Search Engines">
<!ENTITY chooseWhichOneToDisplay2.label "Choose the alternative search engines that appear below the address bar and search bar when you start to enter a keyword.">
<!ENTITY engineNameColumn.label "Search Engine">
<!ENTITY engineKeywordColumn.label "Keyword">
<!ENTITY restoreDefaultSearchEngines.label "Restore Default Search Engines">
<!ENTITY restoreDefaultSearchEngines.accesskey "d">
<!ENTITY removeEngine.label "Remove">
<!ENTITY removeEngine.accesskey "r">
<!ENTITY findMoreSearchEngines.label "Find more search engines">

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

@ -37,7 +37,6 @@
locale/browser/search.properties (%chrome/browser/search.properties) locale/browser/search.properties (%chrome/browser/search.properties)
locale/browser/siteData.properties (%chrome/browser/siteData.properties) locale/browser/siteData.properties (%chrome/browser/siteData.properties)
locale/browser/sitePermissions.properties (%chrome/browser/sitePermissions.properties) locale/browser/sitePermissions.properties (%chrome/browser/sitePermissions.properties)
locale/browser/engineManager.properties (%chrome/browser/engineManager.properties)
locale/browser/setDesktopBackground.dtd (%chrome/browser/setDesktopBackground.dtd) locale/browser/setDesktopBackground.dtd (%chrome/browser/setDesktopBackground.dtd)
locale/browser/shellservice.properties (%chrome/browser/shellservice.properties) locale/browser/shellservice.properties (%chrome/browser/shellservice.properties)
locale/browser/tabbrowser.properties (%chrome/browser/tabbrowser.properties) locale/browser/tabbrowser.properties (%chrome/browser/tabbrowser.properties)
@ -77,7 +76,6 @@
locale/browser/preferences/preferences.dtd (%chrome/browser/preferences/preferences.dtd) locale/browser/preferences/preferences.dtd (%chrome/browser/preferences/preferences.dtd)
locale/browser/preferences/preferences.properties (%chrome/browser/preferences/preferences.properties) locale/browser/preferences/preferences.properties (%chrome/browser/preferences/preferences.properties)
locale/browser/preferences/privacy.dtd (%chrome/browser/preferences/privacy.dtd) locale/browser/preferences/privacy.dtd (%chrome/browser/preferences/privacy.dtd)
locale/browser/preferences/search.dtd (%chrome/browser/preferences/search.dtd)
locale/browser/preferences/security.dtd (%chrome/browser/preferences/security.dtd) locale/browser/preferences/security.dtd (%chrome/browser/preferences/security.dtd)
locale/browser/preferences/selectBookmark.dtd (%chrome/browser/preferences/selectBookmark.dtd) locale/browser/preferences/selectBookmark.dtd (%chrome/browser/preferences/selectBookmark.dtd)
locale/browser/preferences/siteDataSettings.dtd (%chrome/browser/preferences/siteDataSettings.dtd) locale/browser/preferences/siteDataSettings.dtd (%chrome/browser/preferences/siteDataSettings.dtd)

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

@ -0,0 +1,237 @@
# 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 MESSAGE_REFERENCE, EXTERNAL_ARGUMENT
from fluent.migrate.transforms import REPLACE
from fluent.migrate import COPY
def migrate(ctx):
"""Bug 1415733 - Migrate the "Search" section of Preferences to the new Localization API, part {index}"""
ctx.add_transforms(
'browser/browser/preferences/preferences.ftl',
'browser/locales/en-US/browser/preferences/preferences.ftl',
[
FTL.Message(
id=FTL.Identifier('search-bar-header'),
value=COPY(
'browser/chrome/browser/preferences/search.dtd',
'searchBar.label'
)
),
FTL.Message(
id=FTL.Identifier('search-bar-hidden'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'searchBar.hidden.label'
)
)
]
),
FTL.Message(
id=FTL.Identifier('search-bar-shown'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'searchBar.shown.label'
)
)
]
),
FTL.Message(
id=FTL.Identifier('search-engine-default-header'),
value=COPY(
'browser/chrome/browser/preferences/search.dtd',
'defaultSearchEngine.label'
)
),
FTL.Message(
id=FTL.Identifier('search-engine-default-desc'),
value=COPY(
'browser/chrome/browser/preferences/search.dtd',
'chooseYourDefaultSearchEngine2.label'
)
),
FTL.Message(
id=FTL.Identifier('search-suggestions-option'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'provideSearchSuggestions.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'provideSearchSuggestions.accesskey'
)
)
]
),
FTL.Message(
id=FTL.Identifier('search-show-suggestions-url-bar-option'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'showURLBarSuggestions2.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'showURLBarSuggestions2.accesskey'
)
)
]
),
FTL.Message(
id=FTL.Identifier('search-show-suggestions-above-history-option'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'showSearchSuggestionsAboveHistory.label'
)
),
]
),
FTL.Message(
id=FTL.Identifier('search-suggestions-cant-show'),
value=REPLACE(
'browser/chrome/browser/preferences/search.dtd',
'urlBarSuggestionsPermanentPB.label',
{
'&brandShortName;': MESSAGE_REFERENCE(
'-brand-short-name'
)
}
),
),
FTL.Message(
id=FTL.Identifier('search-one-click-header'),
value=COPY(
'browser/chrome/browser/preferences/search.dtd',
'oneClickSearchEngines.label'
)
),
FTL.Message(
id=FTL.Identifier('search-one-click-desc'),
value=COPY(
'browser/chrome/browser/preferences/search.dtd',
'chooseWhichOneToDisplay2.label'
)
),
FTL.Message(
id=FTL.Identifier('search-choose-engine-column'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'engineNameColumn.label'
)
),
]
),
FTL.Message(
id=FTL.Identifier('search-choose-keyword-column'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'engineKeywordColumn.label'
)
),
]
),
FTL.Message(
id=FTL.Identifier('search-restore-default'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'restoreDefaultSearchEngines.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'restoreDefaultSearchEngines.accesskey'
)
)
]
),
FTL.Message(
id=FTL.Identifier('search-remove-engine'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'removeEngine.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/search.dtd',
'removeEngine.accesskey'
)
)
]
),
FTL.Message(
id=FTL.Identifier('search-find-more-link'),
value=COPY(
'browser/chrome/browser/preferences/search.dtd',
'findMoreSearchEngines.label'
)
),
FTL.Message(
id=FTL.Identifier('search-keyword-warning-title'),
value=COPY(
'browser/chrome/browser/engineManager.properties',
'duplicateTitle'
)
),
FTL.Message(
id=FTL.Identifier('search-keyword-warning-engine'),
value=REPLACE(
'browser/chrome/browser/engineManager.properties',
'duplicateEngineMsg',
{
'%S': EXTERNAL_ARGUMENT(
'name'
)
}
),
),
FTL.Message(
id=FTL.Identifier('search-keyword-warning-bookmark'),
value=COPY(
'browser/chrome/browser/engineManager.properties',
'duplicateBookmarkMsg'
)
),
]
)