Bug 1608199 - Port devtools/client/styleeditor.dtd to Fluent, r=fluent-reviewers,flod,Gijs,jdescottes

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Lifan Zeng lifanfzeng 2020-02-20 14:36:15 +00:00
parent ad58a97570
commit 425e2db10a
4 changed files with 112 additions and 76 deletions

View File

@ -1,54 +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/. -->
<!-- LOCALIZATION NOTE : FILE This file contains the Style Editor window strings -->
<!-- LOCALIZATION NOTE : FILE Do not translate commandkeys -->
<!-- LOCALIZATION NOTE : The correct localization of this file might be to keep
it in English, or another language commonly spoken among web developers.
You want to make that choice consistent across the developer tools.
A good criteria is the language in which you'd find the best documentation
on web development on the web. -->
<!ENTITY newButton.label "New">
<!ENTITY newButton.tooltip "Create and append a new style sheet to the document">
<!ENTITY newButton.accesskey "N">
<!ENTITY importButton.tooltip "Import and append an existing style sheet to the document">
<!ENTITY importButton.accesskey "I">
<!ENTITY visibilityToggle.tooltip "Toggle style sheet visibility">
<!ENTITY saveButton.label "Save">
<!ENTITY saveButton.tooltip "Save this style sheet to a file">
<!ENTITY saveButton.accesskey "S">
<!ENTITY optionsButton.tooltip "Style Editor options">
<!-- LOCALICATION NOTE (mediaRules.label): This is shown above the list of @media rules
in each stylesheet editor sidebar. -->
<!ENTITY mediaRules.label "Media Queries">
<!ENTITY editorTextbox.placeholder "Type CSS here.">
<!-- LOCALICATION NOTE (noStyleSheet.label): This is shown when a page has no
stylesheet. -->
<!ENTITY noStyleSheet.label "This page has no style sheet.">
<!-- LOCALICATION NOTE (noStyleSheet-tip-start.label): This is the start of a
tip sentence shown when there is no stylesheet. It suggests to create a new
stylesheet and provides an action link to do so. -->
<!ENTITY noStyleSheet-tip-start.label "Perhaps you'd like to ">
<!-- LOCALICATION NOTE (noStyleSheet-tip-action.label): This is text for the
link that triggers creation of a new stylesheet. -->
<!ENTITY noStyleSheet-tip-action.label "append a new style sheet">
<!-- LOCALICATION NOTE (noStyleSheet-tip-end.label): End of the tip sentence -->
<!ENTITY noStyleSheet-tip-end.label "?">
<!-- LOCALIZATION NOTE (openLinkNewTab.label): This is the text for the
context menu item that opens a stylesheet in a new tab -->
<!ENTITY openLinkNewTab.label "Open Link in New Tab">
<!-- LOCALIZATION NOTE (copyUrl.label): This is the text for the
context menu item that copies a stylesheet's URL -->
<!ENTITY copyUrl.label "Copy URL">

View File

@ -0,0 +1,27 @@
# 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/.
styleeditor-new-button =
.tooltiptext = Create and append a new style sheet to the document
.accesskey = N
styleeditor-import-button =
.tooltiptext = Import and append an existing style sheet to the document
.accesskey = I
styleeditor-visibility-toggle =
.tooltiptext = Toggle style sheet visibility
.accesskey = S
styleeditor-save-button = Save
.tooltiptext = Save this style sheet to a file
.accesskey = S
styleeditor-options-button =
.tooltiptext = Style Editor options
styleeditor-media-rules = Media Queries
styleeditor-editor-textbox =
.data-placeholder = Type CSS here.
styleeditor-no-stylesheet = This page has no style sheet.
styleeditor-no-stylesheet-tip = Perhaps youd like to <a data-l10n-name="append-new-stylesheet">append a new style sheet</a>?
styleeditor-open-link-new-tab =
.label = Open Link in New Tab
styleeditor-copy-url =
.label = Copy URL

View File

@ -3,8 +3,6 @@
- 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 window [
<!ENTITY % styleEditorDTD SYSTEM "chrome://devtools/locale/styleeditor.dtd" >
%styleEditorDTD;
<!ENTITY % editMenuStrings SYSTEM "chrome://global/locale/editMenuOverlay.dtd">
%editMenuStrings;
<!ENTITY % sourceEditorStrings SYSTEM "chrome://devtools/locale/sourceeditor.dtd">
@ -25,6 +23,7 @@
<linkset>
<html:link rel="localization" href="toolkit/global/textActions.ftl"/>
<html:link rel="localization" href="devtools/client/styleeditor.ftl"/>
</linkset>
<script src="chrome://devtools/content/shared/theme-switching.js"/>
@ -76,9 +75,9 @@
</menupopup>
<menupopup id="sidebar-context" incontentshell="false">
<menuitem id="context-openlinknewtab"
label="&openLinkNewTab.label;"/>
data-l10n-id="styleeditor-open-link-new-tab"/>
<menuitem id="context-copyurl"
label="&copyUrl.label;"/>
data-l10n-id="styleeditor-copy-url"/>
</menupopup>
</popupset>
@ -96,28 +95,28 @@
<toolbar class="devtools-toolbar">
<hbox class="devtools-toolbarbutton-group">
<toolbarbutton class="style-editor-newButton devtools-toolbarbutton"
accesskey="&newButton.accesskey;"
tooltiptext="&newButton.tooltip;"/>
data-l10n-id="styleeditor-new-button"/>
<toolbarbutton class="style-editor-importButton devtools-toolbarbutton"
accesskey="&importButton.accesskey;"
tooltiptext="&importButton.tooltip;"/>
data-l10n-id="styleeditor-import-button"/>
</hbox>
<spacer/>
<toolbarbutton id="style-editor-options"
class="devtools-toolbarbutton devtools-option-toolbarbutton"
tooltiptext="&optionsButton.tooltip;"/>
data-l10n-id="styleeditor-options-button"/>
</toolbar>
</box>
<box id="splitview-resizer-target" class="theme-sidebar splitview-nav-container"
persist="height">
<html:ol class="splitview-nav" tabindex="0"></html:ol>
<html:div class="splitview-nav placeholder empty">
<html:p><html:strong>&noStyleSheet.label;</html:strong></html:p>
<html:p>&noStyleSheet-tip-start.label;
<html:a href="#"
class="style-editor-newButton">&noStyleSheet-tip-action.label;</html:a>
&noStyleSheet-tip-end.label;</html:p>
</html:div>
<html:p><html:strong
data-l10n-id="styleeditor-no-stylesheet"
></html:strong></html:p>
<html:p
data-l10n-id="styleeditor-no-stylesheet-tip"><html:a class="style-editor-newButton"
data-l10n-name="append-new-stylesheet" href="#"/></html:p>
</html:div>
</box> <!-- .splitview-nav-container -->
</box> <!-- .splitview-controller -->
<splitter class="devtools-side-splitter devtools-invisible-splitter"/>
@ -126,8 +125,7 @@
<html:div id="splitview-templates" hidden="true">
<html:li id="splitview-tpl-summary-stylesheet" tabindex="0">
<label class="stylesheet-enabled" tabindex="0"
tooltiptext="&visibilityToggle.tooltip;"
accesskey="&saveButton.accesskey;"></label>
data-l10n-id="styleeditor-visibility-toggle"></label>
<html:hgroup class="stylesheet-info">
<html:h1><html:a class="stylesheet-name" tabindex="0"><label crop="center"/></html:a></html:h1>
<html:div class="stylesheet-more">
@ -136,8 +134,7 @@
<html:h3 class="stylesheet-rule-count"></html:h3>
<spacer/>
<html:h3><label class="stylesheet-saveButton"
tooltiptext="&saveButton.tooltip;"
accesskey="&saveButton.accesskey;">&saveButton.label;</label></html:h3>
data-l10n-id="styleeditor-save-button"></label></html:h3>
</html:div>
</html:hgroup>
</html:li>
@ -145,11 +142,11 @@
<box id="splitview-tpl-details-stylesheet" class="splitview-details">
<hbox class="stylesheet-details-container">
<box class="stylesheet-editor-input textbox"
data-placeholder="&editorTextbox.placeholder;"/>
data-l10n-id="styleeditor-editor-textbox"/>
<splitter class="devtools-side-splitter"/>
<vbox class="stylesheet-sidebar theme-sidebar" hidden="true">
<toolbar class="devtools-toolbar">
&mediaRules.label;
<toolbar class="devtools-toolbar"
data-l10n-id="styleeditor-media-rules">
</toolbar>
<vbox class="stylesheet-media-container" flex="1">
<html:div class="stylesheet-media-list" />

View File

@ -0,0 +1,66 @@
# 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 import CONCAT
from fluent.migrate.helpers import COPY, transforms_from
def migrate(ctx):
"""Bug 1608199 - Port devtools/client/styleeditor.dtd to Fluent, part {index}."""
ctx.add_transforms(
"devtools/client/styleeditor.ftl",
"devtools/client/styleeditor.ftl",
transforms_from(
"""
styleeditor-new-button =
.tooltiptext = { COPY(from_path, "newButton.tooltip") }
.accesskey = { COPY(from_path, "newButton.accesskey") }
styleeditor-import-button =
.tooltiptext = { COPY(from_path, "importButton.tooltip") }
.accesskey = { COPY(from_path, "importButton.accesskey") }
styleeditor-visibility-toggle =
.tooltiptext = { COPY(from_path, "visibilityToggle.tooltip")}
.accesskey = { COPY(from_path, "saveButton.accesskey") }
styleeditor-save-button = { COPY(from_path, "saveButton.label") }
.tooltiptext = { COPY(from_path, "saveButton.tooltip") }
.accesskey = { COPY(from_path, "saveButton.accesskey") }
styleeditor-options-button =
.tooltiptext = { COPY(from_path, "optionsButton.tooltip") }
styleeditor-media-rules = { COPY(from_path, "mediaRules.label") }
styleeditor-editor-textbox =
.data-placeholder = { COPY(from_path, "editorTextbox.placeholder") }
styleeditor-no-stylesheet = { COPY(from_path, "noStyleSheet.label") }
styleeditor-open-link-new-tab =
.label = { COPY(from_path, "openLinkNewTab.label") }
styleeditor-copy-url =
.label = { COPY(from_path, "copyUrl.label") }
""", from_path="devtools/client/styleeditor.dtd"))
ctx.add_transforms(
"devtools/client/styleeditor.ftl",
"devtools/client/styleeditor.ftl",
[
FTL.Message(
id=FTL.Identifier("styleeditor-no-stylesheet-tip"),
value=CONCAT(
COPY(
"devtools/client/styleeditor.dtd",
"noStyleSheet-tip-start.label",
),
FTL.TextElement('<a data-l10n-name="append-new-stylesheet">'),
COPY(
"devtools/client/styleeditor.dtd",
"noStyleSheet-tip-action.label",
),
FTL.TextElement("</a>"),
COPY("devtools/client/styleeditor.dtd",
"noStyleSheet-tip-end.label",
),
),
)
]
)