Skip to content

Commit 714d948

Browse files
Make play/pause button text use translatable strings
1 parent 5af01c8 commit 714d948

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

assets-src/js/main/video-hero.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let videoHero = function () {
1313

1414
// Helper to update button text
1515
function updateButtonState(isPlaying) {
16-
const label = isPlaying ? "Pause" : "Play";
16+
const label = isPlaying ? heroVidControl.dataset.videoPause : heroVidControl.dataset.videoPlay;
1717
heroVidControl.querySelector("span").innerText = label;
1818
heroVidControl.classList.toggle("js-play-video", isPlaying);
1919
}

templates/components/styles/hero.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
{{ 'components.hero.video.not_supported'|trans({video_url: page.heroVideo[0].url}, 'w3c_website_templates_bundle') }}
2121
</video>
2222
</div>
23-
<button class="button" data-video-control="hero" hidden>
23+
<button class="button" hidden data-video-control="hero" data-video-play="{{ 'components.hero.video.play'|trans({}, 'w3c_website_templates_bundle') }}" data-video-pause="{{ 'components.hero.video.pause'|trans({}, 'w3c_website_templates_bundle') }}">
2424
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 640 640" height="20" width="20" aria-hidden="true" focusable="false">
2525
<!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
2626
<path class="play-icon" d="M187.2 100.9c-12.4-6.8-27.4-6.5-39.6.7-12.2 7.2-19.6 20.3-19.6 34.4v368c0 14.1 7.5 27.2 19.6 34.4 12.1 7.2 27.2 7.5 39.6.7l336-184c12.8-7 20.8-20.5 20.8-35.1 0-14.6-8-28.1-20.8-35.1l-336-184z"/>

0 commit comments

Comments
 (0)