From 7f7a27c82fbce25c9cc9bf2920a23bd076bbdab9 Mon Sep 17 00:00:00 2001 From: jb Date: Tue, 24 Dec 2024 12:13:22 +0100 Subject: [PATCH 1/3] Add translation string for Play Youtube Video button aria-label --- src/Assets.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Assets.php b/src/Assets.php index 0aa9830..10792be 100644 --- a/src/Assets.php +++ b/src/Assets.php @@ -267,6 +267,8 @@ public function getYoutubeThumbnailScript( $args = [] ) { } } + $button_aria_label = esc_attr__( 'play Youtube video', 'wp-rocket' ); + /** * Filters the patterns excluded from lazyload for youtube thumbnails. * @@ -280,7 +282,7 @@ public function getYoutubeThumbnailScript( $args = [] ) { $excluded_patterns = wp_json_encode( $excluded_patterns ); - return ""; + return ""; } /** From b9dab30e72575973c68923610a2b9bb9dcb318d8 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Tue, 24 Dec 2024 12:16:15 +0100 Subject: [PATCH 2/3] Update Assets.php --- src/Assets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Assets.php b/src/Assets.php index 10792be..2b19964 100644 --- a/src/Assets.php +++ b/src/Assets.php @@ -267,7 +267,7 @@ public function getYoutubeThumbnailScript( $args = [] ) { } } - $button_aria_label = esc_attr__( 'play Youtube video', 'wp-rocket' ); + $button_aria_label = esc_attr__( 'play Youtube video', 'rocket-lazyload-common' ); /** * Filters the patterns excluded from lazyload for youtube thumbnails. From 0a749a187d06f599edc85552f29c8ddfa7679507 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Tue, 14 Jan 2025 09:43:45 +0100 Subject: [PATCH 3/3] Pass button aria-label as a function argument for better i18n support. --- src/Assets.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Assets.php b/src/Assets.php index 2b19964..7473351 100644 --- a/src/Assets.php +++ b/src/Assets.php @@ -217,10 +217,11 @@ public function insertYoutubeThumbnailScript( $args = [] ) { */ public function getYoutubeThumbnailScript( $args = [] ) { $defaults = [ - 'resolution' => 'hqdefault', - 'lazy_image' => false, - 'native' => true, - 'extension' => 'jpg', + 'resolution' => 'hqdefault', + 'lazy_image' => false, + 'native' => true, + 'extension' => 'jpg', + 'button_aria_label' => 'play Youtube video', ]; $allowed_resolutions = [ @@ -267,7 +268,7 @@ public function getYoutubeThumbnailScript( $args = [] ) { } } - $button_aria_label = esc_attr__( 'play Youtube video', 'rocket-lazyload-common' ); + $button_aria_label = $args['button_arial_label']; /** * Filters the patterns excluded from lazyload for youtube thumbnails.