From f901995280a349d7c62ae07b45b613f22bba7797 Mon Sep 17 00:00:00 2001 From: Birgit Pauli-Haack Date: Wed, 29 Apr 2026 17:08:54 +0200 Subject: [PATCH] i18n: Localise label attribute of additional blocks Adds Navigation Link, Navigation Submenu, Home Link, Social Link, and Categories blocks to the list of blocks whose label attribute is escaped for translation on theme save. Continues the band-aid coverage approach tracked in #776. Fixes #825. --- includes/create-theme/theme-locale.php | 5 ++++ .../CbtThemeLocale/escapeBlockAttributes.php | 25 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/includes/create-theme/theme-locale.php b/includes/create-theme/theme-locale.php index 3016dd10..f2c112dd 100644 --- a/includes/create-theme/theme-locale.php +++ b/includes/create-theme/theme-locale.php @@ -146,6 +146,11 @@ private static function get_localizable_block_attributes( $block_name ) { case 'core/comments-pagination-previous': case 'core/comments-pagination-next': case 'core/post-navigation-link': + case 'core/navigation-link': + case 'core/navigation-submenu': + case 'core/home-link': + case 'core/social-link': + case 'core/categories': return array( 'label' ); case 'core/post-excerpt': return array( 'moreText' ); diff --git a/tests/CbtThemeLocale/escapeBlockAttributes.php b/tests/CbtThemeLocale/escapeBlockAttributes.php index b1ceb295..1b28682e 100644 --- a/tests/CbtThemeLocale/escapeBlockAttributes.php +++ b/tests/CbtThemeLocale/escapeBlockAttributes.php @@ -66,6 +66,31 @@ public function data_test_escape_block_attributes() { 'expected_markup' => '', ), + 'navigation-link with label' => array( + 'block_markup' => '', + 'expected_markup' => '', + ), + + 'navigation-submenu with label' => array( + 'block_markup' => '', + 'expected_markup' => '', + ), + + 'home-link with label' => array( + 'block_markup' => '', + 'expected_markup' => '', + ), + + 'social-link with label' => array( + 'block_markup' => '', + 'expected_markup' => '', + ), + + 'categories with label' => array( + 'block_markup' => '', + 'expected_markup' => '', + ), + 'search block with only some attributes' => array( 'block_markup' => '', 'expected_markup' => '',