зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1608923 - use fluent for PiP button accessible labels, r=mconley,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D60200 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
399ccaf394
Коммит
c84869e219
|
@ -0,0 +1,31 @@
|
|||
# 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
|
||||
|
||||
|
||||
def migrate(ctx):
|
||||
"""Bug 1608923 - add accessible labels to PiP controls, part {index}."""
|
||||
|
||||
ctx.add_transforms(
|
||||
'toolkit/toolkit/pictureinpicture/pictureinpicture.ftl',
|
||||
'toolkit/toolkit/pictureinpicture/pictureinpicture.ftl',
|
||||
transforms_from(
|
||||
"""
|
||||
pictureinpicture-pause =
|
||||
.aria-label = { COPY(from_path, "playButton.pauseLabel") }
|
||||
pictureinpicture-play =
|
||||
.aria-label = { COPY(from_path, "playButton.playLabel") }
|
||||
|
||||
pictureinpicture-mute =
|
||||
.aria-label = { COPY(from_path, "muteButton.muteLabel") }
|
||||
pictureinpicture-unmute =
|
||||
.aria-label = { COPY(from_path, "muteButton.unmuteLabel") }
|
||||
""", from_path="toolkit/chrome/global/videocontrols.dtd")
|
||||
)
|
||||
|
||||
|
|
@ -278,9 +278,8 @@ let Player = {
|
|||
this._isPlaying = isPlaying;
|
||||
this.controls.classList.toggle("playing", isPlaying);
|
||||
const playButton = document.getElementById("playpause");
|
||||
let attrName = isPlaying ? "pauselabel" : "playlabel";
|
||||
let accessibleLabel = playButton.getAttribute(attrName);
|
||||
playButton.setAttribute("aria-label", accessibleLabel);
|
||||
let strId = "pictureinpicture-" + (isPlaying ? "pause" : "play");
|
||||
document.l10n.setAttributes(playButton, strId);
|
||||
},
|
||||
|
||||
_isMuted: false,
|
||||
|
@ -301,9 +300,8 @@ let Player = {
|
|||
this._isMuted = isMuted;
|
||||
this.controls.classList.toggle("muted", isMuted);
|
||||
const audioButton = document.getElementById("audio");
|
||||
let attrName = isMuted ? "unmutelabel" : "mutelabel";
|
||||
let accessibleLabel = audioButton.getAttribute(attrName);
|
||||
audioButton.setAttribute("aria-label", accessibleLabel);
|
||||
let strId = "pictureinpicture-" + (isMuted ? "unmute" : "mute");
|
||||
document.l10n.setAttributes(audioButton, strId);
|
||||
},
|
||||
|
||||
recordEvent(type, args) {
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE system [
|
||||
<!ENTITY % videocontrolsDTD
|
||||
SYSTEM "chrome://global/locale/videocontrols.dtd">
|
||||
%videocontrolsDTD;
|
||||
]>
|
||||
<!DOCTYPE html>
|
||||
<!-- 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/. -->
|
||||
|
@ -31,12 +27,10 @@
|
|||
<button id="unpip" class="control-item" tabindex="2"></button>
|
||||
<div class="gap"></div>
|
||||
<button id="playpause" class="control-item" tabindex="1" autofocus="true"
|
||||
playlabel="&playButton.playLabel;"
|
||||
pauselabel="&playButton.pauseLabel;"/>
|
||||
data-l10n-id="pictureinpicture-pause"/>
|
||||
<div class="gap" hidden="true"></div>
|
||||
<button id="audio" class="control-item" hidden="true" tabindex="1"
|
||||
mutelabel="&muteButton.muteLabel;"
|
||||
unmutelabel="&muteButton.unmuteLabel;"/>
|
||||
data-l10n-id="pictureinpicture-mute"/>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -3,3 +3,14 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
pictureinpicture-player-title = Picture-in-Picture
|
||||
|
||||
pictureinpicture-pause =
|
||||
.aria-label = Pause
|
||||
pictureinpicture-play =
|
||||
.aria-label = Play
|
||||
|
||||
pictureinpicture-mute =
|
||||
.aria-label = Mute
|
||||
pictureinpicture-unmute =
|
||||
.aria-label = Unmute
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче