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"
class="accessory-button"
data-l10n-id="choose-button"
searchkeywords="&languages.customize.Header;
&languages.customize2.description;
&languages.customize.moveUp.label;
&languages.customize.moveDown.label;
&languages.customize.deleteButton.label;
&languages.customize.selectLanguage.label;
&languages.customize.addButton.label;"/>
search-l10n-ids="
languages-window.title,
languages-description,
languages-customize-moveup.label,
languages-customize-movedown.label,
languages-customize-remove.label,
languages-customize-select-language.label,
languages-customize-add.label,
" />
</hbox>
</hbox>

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

@ -20,7 +20,6 @@
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % selectBookmarkDTD SYSTEM
"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 % passwordManagerDTD SYSTEM "chrome://passwordmgr/locale/passwordManager.dtd">
<!ENTITY % historyDTD SYSTEM "chrome://mozapps/locale/update/history.dtd">
@ -38,7 +37,6 @@
%aboutDialogDTD;
%brandDTD;
%selectBookmarkDTD;
%languagesDTD;
%permissionsDTD;
%passwordManagerDTD;
%historyDTD;
@ -73,6 +71,7 @@
<link rel="localization" href="browser/preferences/colors.ftl"/>
<link rel="localization" href="browser/preferences/connection.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>

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

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

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

@ -5,33 +5,29 @@
- 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 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://browser/skin/preferences/preferences.css"?>
<dialog id="LanguagesDialog" type="child" class="prefwindow"
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"
persist="lastSelected screenX screenY"
role="dialog"
onload="gLanguagesDialog.init();"
helpTopic="prefs-languages"
ondialoghelp="openPrefsHelp()"
style="width: &window.width;">
ondialoghelp="openPrefsHelp()">
<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://global/content/preferencesBindings.js"/>
<script type="application/javascript" src="chrome://browser/content/preferences/languages.js"/>
<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>
<vbox id="LanguagesDialogPane" class="prefpane largeDialogContainer">
@ -41,9 +37,9 @@
<stringbundle id="bundleAccepted" src="resource://gre/res/language.properties"/>
</stringbundleset>
<description>&languages.customize2.description;</description>
<description data-l10n-id="languages-description"/>
<checkbox id="spoofEnglish"
label="&languages.customize.spoofEnglish;"
data-l10n-id="languages-customize-spoof-english"
preference="privacy.spoof_english"
onsyncfrompreference="return gLanguagesDialog.readSpoofEnglish();"
onsynctopreference="return gLanguagesDialog.writeSpoofEnglish();"/>
@ -61,16 +57,13 @@
onsynctopreference="return gLanguagesDialog.writeAcceptLanguages();"/>
<vbox>
<button id="up" class="up" oncommand="gLanguagesDialog.moveUp();" disabled="true"
label="&languages.customize.moveUp.label;"
accesskey="&languages.customize.moveUp.accesskey;"
data-l10n-id="languages-customize-moveup"
preference="pref.browser.language.disable_button.up"/>
<button id="down" class="down" oncommand="gLanguagesDialog.moveDown();" disabled="true"
label="&languages.customize.moveDown.label;"
accesskey="&languages.customize.moveDown.accesskey;"
data-l10n-id="languages-customize-movedown"
preference="pref.browser.language.disable_button.down"/>
<button id="remove" oncommand="gLanguagesDialog.removeLanguage();" disabled="true"
label="&languages.customize.deleteButton.label;"
accesskey="&languages.customize.deleteButton.accesskey;"
data-l10n-id="languages-customize-remove"
preference="pref.browser.language.disable_button.remove"/>
</vbox>
</row>
@ -81,14 +74,12 @@
<!-- This <vbox> is needed to position search tooltips correctly. -->
<vbox>
<menulist id="availableLanguages" oncommand="gLanguagesDialog.onAvailableLanguageSelect();"
label="&languages.customize.selectLanguage.label;"
label2="&languages.customize.selectLanguage.label;">
data-l10n-id="languages-customize-select-language" data-l10n-attrs="placeholder">
<menupopup id="availableLanguagesPopup"/>
</menulist>
</vbox>
<button id="addButton" oncommand="gLanguagesDialog.addLanguage();" disabled="true"
label="&languages.customize.addButton.label;"
accesskey="&languages.customize.addButton.accesskey;"/>
data-l10n-id="languages-customize-add"/>
</row>
</rows>
</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/preferences/clearSiteData.properties (%chrome/browser/preferences/clearSiteData.properties)
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/preferences.properties (%chrome/browser/preferences/preferences.properties)
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'
)
)
]
)
]
)