From 6279dc749ba3a7725a6892bcd1b47e7cce4a06bd Mon Sep 17 00:00:00 2001 From: audrasjb Date: Mon, 5 Jun 2023 21:05:22 +0000 Subject: [PATCH] I18N: Provide `gettext` context to disambiguate various translation strings. This changeset adds context to various strings: - `'Background'` string when referring to Custom Background appearance screens - `'Header'` string when referring to Custom Header appearance screens - `'General'`, `'Header'` and `'Footer'` strings when referring to template part areas Props gonzomir, SergeyBiryukov, mukesh27, costdev, ankitmaru. Fixes #58424. Built from https://develop.svn.wordpress.org/trunk@55881 git-svn-id: http://core.svn.wordpress.org/trunk@55393 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-custom-background.php | 9 ++++++++- wp-admin/includes/class-custom-image-header.php | 8 +++++++- wp-admin/menu.php | 4 ++-- wp-includes/admin-bar.php | 4 ++-- wp-includes/block-template-utils.php | 6 +++--- wp-includes/version.php | 2 +- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/class-custom-background.php b/wp-admin/includes/class-custom-background.php index 4db2e1480e..e8aee43c2e 100644 --- a/wp-admin/includes/class-custom-background.php +++ b/wp-admin/includes/class-custom-background.php @@ -63,7 +63,14 @@ class Custom_Background { * @since 3.0.0 */ public function init() { - $page = add_theme_page( __( 'Background' ), __( 'Background' ), 'edit_theme_options', 'custom-background', array( $this, 'admin_page' ) ); + $page = add_theme_page( + _x( 'Background', 'custom background' ), + _x( 'Background', 'custom background' ), + 'edit_theme_options', + 'custom-background', + array( $this, 'admin_page' ) + ); + if ( ! $page ) { return; } diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php index 143a844cbe..630190ad88 100644 --- a/wp-admin/includes/class-custom-image-header.php +++ b/wp-admin/includes/class-custom-image-header.php @@ -71,7 +71,13 @@ class Custom_Image_Header { * @since 2.1.0 */ public function init() { - $page = add_theme_page( __( 'Header' ), __( 'Header' ), 'edit_theme_options', 'custom-header', array( $this, 'admin_page' ) ); + $page = add_theme_page( + _x( 'Header', 'custom image header' ), + _x( 'Header', 'custom image header' ), + 'edit_theme_options', + 'custom-header', + array( $this, 'admin_page' ) + ); if ( ! $page ) { return; diff --git a/wp-admin/menu.php b/wp-admin/menu.php index a9853e3969..75e3d7e065 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -230,12 +230,12 @@ if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize' ) ) { $customize_header_url = add_query_arg( array( 'autofocus' => array( 'control' => 'header_image' ) ), $customize_url ); - $submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' ); + $submenu['themes.php'][15] = array( _x( 'Header', 'custom image header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' ); } if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize' ) ) { $customize_background_url = add_query_arg( array( 'autofocus' => array( 'control' => 'background_image' ) ), $customize_url ); - $submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' ); + $submenu['themes.php'][20] = array( _x( 'Background', 'custom background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' ); } unset( $customize_url ); diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 4792822d59..ee0a88cb8e 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -1052,7 +1052,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) { array( 'parent' => 'appearance', 'id' => 'background', - 'title' => __( 'Background' ), + 'title' => _x( 'Background', 'custom background' ), 'href' => admin_url( 'themes.php?page=custom-background' ), 'meta' => array( 'class' => 'hide-if-customize', @@ -1066,7 +1066,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) { array( 'parent' => 'appearance', 'id' => 'header', - 'title' => __( 'Header' ), + 'title' => _x( 'Header', 'custom image header' ), 'href' => admin_url( 'themes.php?page=custom-header' ), 'meta' => array( 'class' => 'hide-if-customize', diff --git a/wp-includes/block-template-utils.php b/wp-includes/block-template-utils.php index a7071bed93..f3eaf7b95a 100644 --- a/wp-includes/block-template-utils.php +++ b/wp-includes/block-template-utils.php @@ -65,7 +65,7 @@ function get_allowed_block_template_part_areas() { $default_area_definitions = array( array( 'area' => WP_TEMPLATE_PART_AREA_UNCATEGORIZED, - 'label' => __( 'General' ), + 'label' => _x( 'General', 'template part area' ), 'description' => __( 'General templates often perform a specific role like displaying post content, and are not tied to any particular area.' ), @@ -74,7 +74,7 @@ function get_allowed_block_template_part_areas() { ), array( 'area' => WP_TEMPLATE_PART_AREA_HEADER, - 'label' => __( 'Header' ), + 'label' => _x( 'Header', 'template part area' ), 'description' => __( 'The Header template defines a page area that typically contains a title, logo, and main navigation.' ), @@ -83,7 +83,7 @@ function get_allowed_block_template_part_areas() { ), array( 'area' => WP_TEMPLATE_PART_AREA_FOOTER, - 'label' => __( 'Footer' ), + 'label' => _x( 'Footer', 'template part area' ), 'description' => __( 'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.' ), diff --git a/wp-includes/version.php b/wp-includes/version.php index 363f848bde..a1983364cc 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55880'; +$wp_version = '6.3-alpha-55881'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.