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
This commit is contained in:
audrasjb 2023-06-05 21:05:22 +00:00
parent fa14ed343d
commit 6279dc749b
6 changed files with 23 additions and 10 deletions

View File

@ -63,7 +63,14 @@ class Custom_Background {
* @since 3.0.0 * @since 3.0.0
*/ */
public function init() { 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 ) { if ( ! $page ) {
return; return;
} }

View File

@ -71,7 +71,13 @@ class Custom_Image_Header {
* @since 2.1.0 * @since 2.1.0
*/ */
public function init() { 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 ) { if ( ! $page ) {
return; return;

View File

@ -230,12 +230,12 @@ if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize' ) ) { if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize' ) ) {
$customize_header_url = add_query_arg( array( 'autofocus' => array( 'control' => 'header_image' ) ), $customize_url ); $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' ) ) { if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize' ) ) {
$customize_background_url = add_query_arg( array( 'autofocus' => array( 'control' => 'background_image' ) ), $customize_url ); $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 ); unset( $customize_url );

View File

@ -1052,7 +1052,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
array( array(
'parent' => 'appearance', 'parent' => 'appearance',
'id' => 'background', 'id' => 'background',
'title' => __( 'Background' ), 'title' => _x( 'Background', 'custom background' ),
'href' => admin_url( 'themes.php?page=custom-background' ), 'href' => admin_url( 'themes.php?page=custom-background' ),
'meta' => array( 'meta' => array(
'class' => 'hide-if-customize', 'class' => 'hide-if-customize',
@ -1066,7 +1066,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
array( array(
'parent' => 'appearance', 'parent' => 'appearance',
'id' => 'header', 'id' => 'header',
'title' => __( 'Header' ), 'title' => _x( 'Header', 'custom image header' ),
'href' => admin_url( 'themes.php?page=custom-header' ), 'href' => admin_url( 'themes.php?page=custom-header' ),
'meta' => array( 'meta' => array(
'class' => 'hide-if-customize', 'class' => 'hide-if-customize',

View File

@ -65,7 +65,7 @@ function get_allowed_block_template_part_areas() {
$default_area_definitions = array( $default_area_definitions = array(
array( array(
'area' => WP_TEMPLATE_PART_AREA_UNCATEGORIZED, 'area' => WP_TEMPLATE_PART_AREA_UNCATEGORIZED,
'label' => __( 'General' ), 'label' => _x( 'General', 'template part area' ),
'description' => __( 'description' => __(
'General templates often perform a specific role like displaying post content, and are not tied to any particular area.' '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( array(
'area' => WP_TEMPLATE_PART_AREA_HEADER, 'area' => WP_TEMPLATE_PART_AREA_HEADER,
'label' => __( 'Header' ), 'label' => _x( 'Header', 'template part area' ),
'description' => __( 'description' => __(
'The Header template defines a page area that typically contains a title, logo, and main navigation.' '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( array(
'area' => WP_TEMPLATE_PART_AREA_FOOTER, 'area' => WP_TEMPLATE_PART_AREA_FOOTER,
'label' => __( 'Footer' ), 'label' => _x( 'Footer', 'template part area' ),
'description' => __( 'description' => __(
'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.' 'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'
), ),

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.