Bug 1451992 - Migrate Preferences::Subdialogs::Languages to Fluent. r=gijs,flod

MozReview-Commit-ID: 96C1P3ZbJeH

--HG--
extra : amend_source : fbc969a6a5862f461bb4612c02030a0d50d8dab9
This commit is contained in:
Zibi Braniecki 2018-04-05 21:43:11 +02:00
Родитель 1f13efaede
Коммит 5f8d6040ce
8 изменённых файлов: 219 добавлений и 53 удалений

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

@ -301,13 +301,15 @@
<button id="chooseLanguage" <button id="chooseLanguage"
class="accessory-button" class="accessory-button"
data-l10n-id="choose-button" data-l10n-id="choose-button"
searchkeywords="&languages.customize.Header; search-l10n-ids="
&languages.customize2.description; languages-window.title,
&languages.customize.moveUp.label; languages-description,
&languages.customize.moveDown.label; languages-customize-moveup.label,
&languages.customize.deleteButton.label; languages-customize-movedown.label,
&languages.customize.selectLanguage.label; languages-customize-remove.label,
&languages.customize.addButton.label;"/> languages-customize-select-language.label,
languages-customize-add.label,
" />
</hbox> </hbox>
</hbox> </hbox>

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

@ -20,7 +20,6 @@
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd"> <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % selectBookmarkDTD SYSTEM <!ENTITY % selectBookmarkDTD SYSTEM
"chrome://browser/locale/preferences/selectBookmark.dtd"> "chrome://browser/locale/preferences/selectBookmark.dtd">
<!ENTITY % languagesDTD SYSTEM "chrome://browser/locale/preferences/languages.dtd">
<!ENTITY % permissionsDTD SYSTEM "chrome://browser/locale/preferences/permissions.dtd"> <!ENTITY % permissionsDTD SYSTEM "chrome://browser/locale/preferences/permissions.dtd">
<!ENTITY % passwordManagerDTD SYSTEM "chrome://passwordmgr/locale/passwordManager.dtd"> <!ENTITY % passwordManagerDTD SYSTEM "chrome://passwordmgr/locale/passwordManager.dtd">
<!ENTITY % historyDTD SYSTEM "chrome://mozapps/locale/update/history.dtd"> <!ENTITY % historyDTD SYSTEM "chrome://mozapps/locale/update/history.dtd">
@ -38,7 +37,6 @@
%aboutDialogDTD; %aboutDialogDTD;
%brandDTD; %brandDTD;
%selectBookmarkDTD; %selectBookmarkDTD;
%languagesDTD;
%permissionsDTD; %permissionsDTD;
%passwordManagerDTD; %passwordManagerDTD;
%historyDTD; %historyDTD;
@ -73,6 +71,7 @@
<link rel="localization" href="browser/preferences/colors.ftl"/> <link rel="localization" href="browser/preferences/colors.ftl"/>
<link rel="localization" href="browser/preferences/connection.ftl"/> <link rel="localization" href="browser/preferences/connection.ftl"/>
<link rel="localization" href="browser/preferences/fonts.ftl"/> <link rel="localization" href="browser/preferences/fonts.ftl"/>
<link rel="localization" href="browser/preferences/languages.ftl"/>
<script type="text/javascript" src="chrome://global/content/l10n.js"></script> <script type="text/javascript" src="chrome://global/content/l10n.js"></script>

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

@ -112,6 +112,7 @@ var gLanguagesDialog = {
menuitem.setAttribute("label", this._availableLanguagesList[i].name); menuitem.setAttribute("label", this._availableLanguagesList[i].name);
} }
} }
this._availableLanguages.setAttribute("label", this._availableLanguages.getAttribute("placeholder"));
}, },
readAcceptLanguages() { readAcceptLanguages() {
@ -187,8 +188,6 @@ var gLanguagesDialog = {
// Rebuild the available list with the added item removed... // Rebuild the available list with the added item removed...
this._buildAvailableLanguageList(); this._buildAvailableLanguageList();
this._availableLanguages.setAttribute("label", this._availableLanguages.getAttribute("label2"));
}, },
removeLanguage() { removeLanguage() {

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

@ -5,33 +5,29 @@
- 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/. -->
<!DOCTYPE dialog [
<!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
%preferencesDTD;
<!ENTITY % languagesDTD SYSTEM "chrome://browser/locale/preferences/languages.dtd">
%languagesDTD;
]>
<?xml-stylesheet href="chrome://global/skin/"?> <?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<dialog id="LanguagesDialog" type="child" class="prefwindow" <dialog id="LanguagesDialog" type="child" class="prefwindow"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&languages.customize.Header;" data-l10n-id="languages-window"
data-l10n-attrs="title, style"
buttons="accept,cancel,help" buttons="accept,cancel,help"
persist="lastSelected screenX screenY" persist="lastSelected screenX screenY"
role="dialog" role="dialog"
onload="gLanguagesDialog.init();" onload="gLanguagesDialog.init();"
helpTopic="prefs-languages" helpTopic="prefs-languages"
ondialoghelp="openPrefsHelp()" ondialoghelp="openPrefsHelp()">
style="width: &window.width;">
<link rel="localization" href="browser/preferences/languages.ftl"/>
<script type="application/javascript" src="chrome://global/content/l10n.js"></script>
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/> <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/javascript" src="chrome://global/content/preferencesBindings.js"/> <script type="application/javascript" src="chrome://global/content/preferencesBindings.js"/>
<script type="application/javascript" src="chrome://browser/content/preferences/languages.js"/> <script type="application/javascript" src="chrome://browser/content/preferences/languages.js"/>
<keyset> <keyset>
<key key="&windowClose.key;" modifiers="accel" oncommand="Preferences.close(event)"/> <key data-l10n-id="languages-close-key" modifiers="accel" oncommand="Preferences.close(event)"/>
</keyset> </keyset>
<vbox id="LanguagesDialogPane" class="prefpane largeDialogContainer"> <vbox id="LanguagesDialogPane" class="prefpane largeDialogContainer">
@ -41,9 +37,9 @@
<stringbundle id="bundleAccepted" src="resource://gre/res/language.properties"/> <stringbundle id="bundleAccepted" src="resource://gre/res/language.properties"/>
</stringbundleset> </stringbundleset>
<description>&languages.customize2.description;</description> <description data-l10n-id="languages-description"/>
<checkbox id="spoofEnglish" <checkbox id="spoofEnglish"
label="&languages.customize.spoofEnglish;" data-l10n-id="languages-customize-spoof-english"
preference="privacy.spoof_english" preference="privacy.spoof_english"
onsyncfrompreference="return gLanguagesDialog.readSpoofEnglish();" onsyncfrompreference="return gLanguagesDialog.readSpoofEnglish();"
onsynctopreference="return gLanguagesDialog.writeSpoofEnglish();"/> onsynctopreference="return gLanguagesDialog.writeSpoofEnglish();"/>
@ -61,16 +57,13 @@
onsynctopreference="return gLanguagesDialog.writeAcceptLanguages();"/> onsynctopreference="return gLanguagesDialog.writeAcceptLanguages();"/>
<vbox> <vbox>
<button id="up" class="up" oncommand="gLanguagesDialog.moveUp();" disabled="true" <button id="up" class="up" oncommand="gLanguagesDialog.moveUp();" disabled="true"
label="&languages.customize.moveUp.label;" data-l10n-id="languages-customize-moveup"
accesskey="&languages.customize.moveUp.accesskey;"
preference="pref.browser.language.disable_button.up"/> preference="pref.browser.language.disable_button.up"/>
<button id="down" class="down" oncommand="gLanguagesDialog.moveDown();" disabled="true" <button id="down" class="down" oncommand="gLanguagesDialog.moveDown();" disabled="true"
label="&languages.customize.moveDown.label;" data-l10n-id="languages-customize-movedown"
accesskey="&languages.customize.moveDown.accesskey;"
preference="pref.browser.language.disable_button.down"/> preference="pref.browser.language.disable_button.down"/>
<button id="remove" oncommand="gLanguagesDialog.removeLanguage();" disabled="true" <button id="remove" oncommand="gLanguagesDialog.removeLanguage();" disabled="true"
label="&languages.customize.deleteButton.label;" data-l10n-id="languages-customize-remove"
accesskey="&languages.customize.deleteButton.accesskey;"
preference="pref.browser.language.disable_button.remove"/> preference="pref.browser.language.disable_button.remove"/>
</vbox> </vbox>
</row> </row>
@ -81,14 +74,12 @@
<!-- This <vbox> is needed to position search tooltips correctly. --> <!-- This <vbox> is needed to position search tooltips correctly. -->
<vbox> <vbox>
<menulist id="availableLanguages" oncommand="gLanguagesDialog.onAvailableLanguageSelect();" <menulist id="availableLanguages" oncommand="gLanguagesDialog.onAvailableLanguageSelect();"
label="&languages.customize.selectLanguage.label;" data-l10n-id="languages-customize-select-language" data-l10n-attrs="placeholder">
label2="&languages.customize.selectLanguage.label;">
<menupopup id="availableLanguagesPopup"/> <menupopup id="availableLanguagesPopup"/>
</menulist> </menulist>
</vbox> </vbox>
<button id="addButton" oncommand="gLanguagesDialog.addLanguage();" disabled="true" <button id="addButton" oncommand="gLanguagesDialog.addLanguage();" disabled="true"
label="&languages.customize.addButton.label;" data-l10n-id="languages-customize-add"/>
accesskey="&languages.customize.addButton.accesskey;"/>
</row> </row>
</rows> </rows>
</grid> </grid>

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

@ -0,0 +1,34 @@
# 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/.
languages-window =
.title = Languages
.style = width: 30em
languages-close-key =
.key = w
languages-description = Web pages are sometimes offered in more than one language. Choose languages for displaying these web pages, in order of preference
languages-customize-spoof-english =
.label = Request English versions of web pages for enhanced privacy
languages-customize-moveup =
.label = Move Up
.accesskey = U
languages-customize-movedown =
.label = Move Down
.accesskey = D
languages-customize-remove =
.label = Remove
.accesskey = R
languages-customize-select-language =
.placeholder = Select a language to add…
languages-customize-add =
.label = Add
.accesskey = A

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

@ -1,18 +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 window.width "30em">
<!ENTITY languages.customize.Header "Languages">
<!ENTITY languages.customize2.description "Web pages are sometimes offered in more than one language. Choose languages for displaying these web pages, in order of preference">
<!ENTITY languages.customize.moveUp.label "Move Up">
<!ENTITY languages.customize.moveUp.accesskey "U">
<!ENTITY languages.customize.moveDown.label "Move Down">
<!ENTITY languages.customize.moveDown.accesskey "D">
<!ENTITY languages.customize.deleteButton.label "Remove">
<!ENTITY languages.customize.deleteButton.accesskey "R">
<!ENTITY languages.customize.selectLanguage.label "Select a language to add…">
<!ENTITY languages.customize.addButton.label "Add">
<!ENTITY languages.customize.addButton.accesskey "A">
<!ENTITY languages.customize.spoofEnglish "Request English versions of web pages for enhanced privacy">

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

@ -57,7 +57,6 @@
locale/browser/migration/migration.properties (%chrome/browser/migration/migration.properties) locale/browser/migration/migration.properties (%chrome/browser/migration/migration.properties)
locale/browser/preferences/clearSiteData.properties (%chrome/browser/preferences/clearSiteData.properties) locale/browser/preferences/clearSiteData.properties (%chrome/browser/preferences/clearSiteData.properties)
locale/browser/preferences/content.dtd (%chrome/browser/preferences/content.dtd) locale/browser/preferences/content.dtd (%chrome/browser/preferences/content.dtd)
locale/browser/preferences/languages.dtd (%chrome/browser/preferences/languages.dtd)
locale/browser/preferences/permissions.dtd (%chrome/browser/preferences/permissions.dtd) locale/browser/preferences/permissions.dtd (%chrome/browser/preferences/permissions.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)

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

@ -0,0 +1,160 @@
# 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
from fluent.migrate import COPY, CONCAT, REPLACE
def migrate(ctx):
"""Bug 1451992 - Migrate Preferences::Subdialogs::Languages to Fluent, part {index}."""
ctx.add_transforms(
'browser/browser/preferences/languages.ftl',
'browser/browser/preferences/languages.ftl',
[
FTL.Message(
id=FTL.Identifier('languages-window'),
attributes=[
FTL.Attribute(
FTL.Identifier('title'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.Header'
)
),
FTL.Attribute(
FTL.Identifier('style'),
CONCAT(
FTL.TextElement('width: '),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'window.width'
)
)
)
]
),
FTL.Message(
id=FTL.Identifier('languages-close-key'),
attributes=[
FTL.Attribute(
FTL.Identifier('key'),
COPY(
'toolkit/chrome/global/preferences.dtd',
'windowClose.key'
)
)
]
),
FTL.Message(
id=FTL.Identifier('languages-description'),
value=COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize2.description'
)
),
FTL.Message(
id=FTL.Identifier('languages-customize-spoof-english'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.spoofEnglish'
)
)
]
),
FTL.Message(
id=FTL.Identifier('languages-customize-moveup'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.moveUp.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.moveUp.accesskey'
)
)
]
),
FTL.Message(
id=FTL.Identifier('languages-customize-movedown'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.moveDown.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.moveDown.accesskey'
)
)
]
),
FTL.Message(
id=FTL.Identifier('languages-customize-remove'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.deleteButton.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.deleteButton.accesskey'
)
)
]
),
FTL.Message(
id=FTL.Identifier('languages-customize-select-language'),
attributes=[
FTL.Attribute(
FTL.Identifier('placeholder'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.selectLanguage.label'
)
),
]
),
FTL.Message(
id=FTL.Identifier('languages-customize-add'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.addButton.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/languages.dtd',
'languages.customize.addButton.accesskey'
)
)
]
)
]
)