From 371497ed4902ad5c5ce9b8d0771c7393f9189efc Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 28 Oct 2024 01:05:35 +0100 Subject: [PATCH] Misc i18n fixes (#66510) Co-authored-by: swissspidy Co-authored-by: peterwilsoncc --- .../downloadable-block-list-item/index.js | 12 +++---- .../src/components/block-card/index.js | 6 ++-- .../components/block-patterns-paging/index.js | 2 +- .../block-variation-transforms/index.js | 4 +-- .../inserter-button/index.native.js | 2 +- .../components/spacing-sizes-control/index.js | 6 ++-- .../input-controls/spacing-input-control.js | 8 ++--- .../src/components/url-input/index.js | 2 +- .../components/use-block-commands/index.js | 2 +- .../src/utils/get-font-styles-and-weights.js | 4 +-- packages/block-library/src/avatar/hooks.js | 5 ++- packages/block-library/src/avatar/index.php | 9 +++-- .../src/comment-author-avatar/index.php | 2 +- .../block-library/src/latest-posts/edit.js | 2 +- .../block-library/src/latest-posts/index.php | 2 +- .../edit/menu-inspector-controls.js | 4 +-- .../edit/navigation-menu-selector.js | 4 +-- .../src/post-featured-image/edit.js | 2 +- .../src/post-time-to-read/edit.js | 4 +-- .../src/post-time-to-read/index.php | 2 +- .../block-library/src/query-title/edit.js | 4 +-- .../edit/inspector-controls/order-control.js | 4 +-- packages/block-library/src/rss/index.php | 2 +- .../src/template-part/edit/index.js | 2 +- .../block-library/src/video/tracks-editor.js | 4 +-- .../border-control-dropdown/component.tsx | 36 ++++++++++++------- .../components/src/color-palette/index.tsx | 2 +- .../gradient-bar/control-points.tsx | 2 +- .../src/font-size-picker/index.native.js | 14 ++++---- .../index.native.js | 4 +-- .../mobile/bottom-sheet/range-cell.native.js | 2 +- .../bottom-sheet/stepper-cell/index.native.js | 2 +- .../tools-panel-header/component.tsx | 2 +- .../dataviews-selection-checkbox/index.tsx | 5 +-- .../dataviews-view-config/index.tsx | 4 +-- .../src/dataforms-layouts/panel/index.tsx | 4 +-- .../edit-post/src/components/layout/index.js | 2 +- .../src/components/add-new-post/index.js | 2 +- .../src/components/add-new-template/index.js | 2 +- .../src/components/add-new-template/utils.js | 21 ++++++----- .../edit-site/src/components/editor/index.js | 2 +- .../src/components/editor/use-editor-title.js | 6 ++-- .../screen-revisions/revisions-buttons.js | 4 +-- .../global-styles/variations/variation.js | 6 ++-- .../delete-category-menu-item.js | 8 ++--- .../src/components/pagination/index.js | 2 +- .../src/components/post-fields/index.js | 4 +-- .../src/components/save-panel/index.js | 2 +- .../use-navigation-menu-handlers.js | 4 +-- .../build-navigation-label.js | 8 ++--- .../index.js | 8 ++--- .../sidebar-navigation-screen/index.js | 3 +- .../src/components/editor-interface/index.js | 5 +-- .../src/components/page-attributes/parent.js | 10 +++--- .../src/components/post-author/panel.js | 6 ++-- .../post-content-information/index.js | 2 +- .../components/post-last-revision/index.js | 2 +- .../src/components/post-schedule/label.js | 2 +- .../hierarchical-term-selector.js | 4 +-- .../editor/src/components/post-url/panel.js | 6 ++-- .../editor/src/components/sidebar/header.js | 5 +-- .../editor/src/components/sidebar/index.js | 8 +++-- .../src/components/time-to-read/index.js | 6 ++-- .../actions/duplicate-template-part.tsx | 6 ++-- packages/editor/src/store/private-actions.js | 6 ++-- packages/fields/src/actions/delete-post.tsx | 13 ++++--- .../fields/src/actions/duplicate-post.tsx | 4 +-- .../src/actions/view-post-revisions.tsx | 2 +- .../components/interface-skeleton/index.js | 2 +- .../src/components/duplicate-pattern-modal.js | 6 ++-- .../pattern-overrides-block-controls.js | 2 +- 71 files changed, 193 insertions(+), 165 deletions(-) diff --git a/packages/block-directory/src/components/downloadable-block-list-item/index.js b/packages/block-directory/src/components/downloadable-block-list-item/index.js index 7a5f479174ab25..c04ea8ea1767bd 100644 --- a/packages/block-directory/src/components/downloadable-block-list-item/index.js +++ b/packages/block-directory/src/components/downloadable-block-list-item/index.js @@ -34,28 +34,28 @@ function getDownloadableBlockLabel( const stars = Math.round( rating / 0.5 ) * 0.5; if ( ! isInstalled && hasNotice ) { - /* translators: %1$s: block title */ + /* translators: %s: block title */ return sprintf( 'Retry installing %s.', decodeEntities( title ) ); } if ( isInstalled ) { - /* translators: %1$s: block title */ + /* translators: %s: block title */ return sprintf( 'Add %s.', decodeEntities( title ) ); } if ( isInstalling ) { - /* translators: %1$s: block title */ + /* translators: %s: block title */ return sprintf( 'Installing %s.', decodeEntities( title ) ); } // No ratings yet, just use the title. if ( ratingCount < 1 ) { - /* translators: %1$s: block title */ + /* translators: %s: block title */ return sprintf( 'Install %s.', decodeEntities( title ) ); } return sprintf( - /* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */ + /* translators: 1: block title, 2: average rating, 3: total ratings count. */ _n( 'Install %1$s. %2$s stars with %3$s review.', 'Install %1$s. %2$s stars with %3$s reviews.', @@ -131,7 +131,7 @@ function DownloadableBlockListItem( { item, onClick } ) { { createInterpolateElement( sprintf( - /* translators: %1$s: block title, %2$s: author name. */ + /* translators: 1: block title. 2: author name. */ __( '%1$s by %2$s' ), decodeEntities( title ), author diff --git a/packages/block-editor/src/components/block-card/index.js b/packages/block-editor/src/components/block-card/index.js index 4d40fe07d55471..c8a12a3be5ef6a 100644 --- a/packages/block-editor/src/components/block-card/index.js +++ b/packages/block-editor/src/components/block-card/index.js @@ -13,7 +13,7 @@ import { __experimentalVStack as VStack, } from '@wordpress/components'; import { chevronLeft, chevronRight } from '@wordpress/icons'; -import { __, isRTL, sprintf } from '@wordpress/i18n'; +import { __, _x, isRTL, sprintf } from '@wordpress/i18n'; import { useSelect, useDispatch } from '@wordpress/data'; /** @@ -68,8 +68,8 @@ function BlockCard( { title, icon, description, blockType, className, name } ) {

{ name?.length ? sprintf( - // translators: %1$s: Custom block name. %2$s: Block title. - __( '%1$s (%2$s)' ), + // translators: 1: Custom block name. 2: Block title. + _x( '%1$s (%2$s)', 'block label' ), name, title ) diff --git a/packages/block-editor/src/components/block-patterns-paging/index.js b/packages/block-editor/src/components/block-patterns-paging/index.js index e4d7ce49b90f3e..d4d513902ca705 100644 --- a/packages/block-editor/src/components/block-patterns-paging/index.js +++ b/packages/block-editor/src/components/block-patterns-paging/index.js @@ -62,7 +62,7 @@ export default function Pagination( { { sprintf( - // translators: %1$s: Current page number, %2$s: Total number of pages. + // translators: 1: Current page number. 2: Total number of pages. _x( '%1$s of %2$s', 'paging' ), currentPage, numPages diff --git a/packages/block-editor/src/components/block-variation-transforms/index.js b/packages/block-editor/src/components/block-variation-transforms/index.js index 5850fc52b37b68..f03e72843d4731 100644 --- a/packages/block-editor/src/components/block-variation-transforms/index.js +++ b/packages/block-editor/src/components/block-variation-transforms/index.js @@ -45,7 +45,7 @@ function VariationsButtons( { selectedValue === variation.name ? variation.title : sprintf( - /* translators: %s: Name of the block variation */ + /* translators: %s: Block or block variation name. */ __( 'Transform to %s' ), variation.title ) @@ -127,7 +127,7 @@ function VariationsToggleGroupControl( { selectedValue === variation.name ? variation.title : sprintf( - /* translators: %s: Name of the block variation */ + /* translators: %s: Block or block variation name. */ __( 'Transform to %s' ), variation.title ) diff --git a/packages/block-editor/src/components/inserter-button/index.native.js b/packages/block-editor/src/components/inserter-button/index.native.js index 7df5d450d1e629..d9147b2f4d95bd 100644 --- a/packages/block-editor/src/components/inserter-button/index.native.js +++ b/packages/block-editor/src/components/inserter-button/index.native.js @@ -54,7 +54,7 @@ class MenuItem extends Component { const accessibilityLabelFormat = blockIsNew ? // translators: Newly available block name. %s: The localized block name __( '%s block, newly available' ) - : // translators: Block name. %s: The localized block name + : // translators: %s: Block name e.g. "Image block" __( '%s block' ); const accessibilityLabel = sprintf( accessibilityLabelFormat, diff --git a/packages/block-editor/src/components/spacing-sizes-control/index.js b/packages/block-editor/src/components/spacing-sizes-control/index.js index 6ca143d14706ac..458b0abee60f2e 100644 --- a/packages/block-editor/src/components/spacing-sizes-control/index.js +++ b/packages/block-editor/src/components/spacing-sizes-control/index.js @@ -7,7 +7,7 @@ import { __experimentalVStack as VStack, } from '@wordpress/components'; import { useState } from '@wordpress/element'; -import { __, sprintf } from '@wordpress/i18n'; +import { _x, sprintf } from '@wordpress/i18n'; /** * Internal dependencies @@ -89,8 +89,8 @@ export default function SpacingSizesControl( { ALL_SIDES.includes( view ) && showSideInLabel ? LABELS[ view ] : ''; const label = sprintf( - // translators: 2. Type of spacing being modified (Padding, margin, etc). 1: The side of the block being modified (top, bottom, left etc.). - __( '%1$s %2$s' ), + // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc). + _x( '%1$s %2$s', 'spacing' ), labelProp, sideLabel ).trim(); diff --git a/packages/block-editor/src/components/spacing-sizes-control/input-controls/spacing-input-control.js b/packages/block-editor/src/components/spacing-sizes-control/input-controls/spacing-input-control.js index d00feed704d17a..f03af41bfbc00d 100644 --- a/packages/block-editor/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +++ b/packages/block-editor/src/components/spacing-sizes-control/input-controls/spacing-input-control.js @@ -14,7 +14,7 @@ import { import { useSelect } from '@wordpress/data'; import { useState, useMemo } from '@wordpress/element'; import { usePrevious } from '@wordpress/compose'; -import { __, sprintf } from '@wordpress/i18n'; +import { __, _x, sprintf } from '@wordpress/i18n'; import { settings } from '@wordpress/icons'; /** @@ -124,7 +124,7 @@ export default function SpacingInputControl( { ...spacingSizes, { name: ! isMixed - ? // translators: A custom measurement, eg. a number followed by a unit like 12px. + ? // translators: %s: A custom measurement, e.g. a number followed by a unit like 12px. sprintf( __( 'Custom (%s)' ), value ) : __( 'Mixed' ), slug: 'custom', @@ -200,8 +200,8 @@ export default function SpacingInputControl( { const typeLabel = showSideInLabel ? type?.toLowerCase() : type; const ariaLabel = sprintf( - // translators: 1: The side of the block being modified (top, bottom, left, All sides etc.). 2. Type of spacing being modified (Padding, margin, etc) - __( '%1$s %2$s' ), + // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc). + _x( '%1$s %2$s', 'spacing' ), sideLabel, typeLabel ).trim(); diff --git a/packages/block-editor/src/components/url-input/index.js b/packages/block-editor/src/components/url-input/index.js index cb058be5c932f6..4e7ac61e783661 100644 --- a/packages/block-editor/src/components/url-input/index.js +++ b/packages/block-editor/src/components/url-input/index.js @@ -196,7 +196,7 @@ class URLInput extends Component { if ( !! suggestions.length ) { this.props.debouncedSpeak( sprintf( - /* translators: %s: number of results. */ + /* translators: %d: number of results. */ _n( '%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', diff --git a/packages/block-editor/src/components/use-block-commands/index.js b/packages/block-editor/src/components/use-block-commands/index.js index c88ec4e5378926..e739729c8f9e84 100644 --- a/packages/block-editor/src/components/use-block-commands/index.js +++ b/packages/block-editor/src/components/use-block-commands/index.js @@ -113,7 +113,7 @@ export const useTransformCommands = () => { const { name, title, icon } = transformation; return { name: 'core/block-editor/transform-to-' + name.replace( '/', '-' ), - // translators: %s: block title/name. + /* translators: %s: Block or block variation name. */ label: sprintf( __( 'Transform to %s' ), title ), icon: , callback: ( { close } ) => { diff --git a/packages/block-editor/src/utils/get-font-styles-and-weights.js b/packages/block-editor/src/utils/get-font-styles-and-weights.js index dcb56fc86b2673..c832582fa524d5 100644 --- a/packages/block-editor/src/utils/get-font-styles-and-weights.js +++ b/packages/block-editor/src/utils/get-font-styles-and-weights.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { _x, __, sprintf } from '@wordpress/i18n'; +import { _x, sprintf } from '@wordpress/i18n'; /** * Internal dependencies @@ -173,7 +173,7 @@ export function getFontStylesAndWeights( fontFamilyFaces ) { ? weightName : sprintf( /* translators: 1: Font weight name. 2: Font style name. */ - __( '%1$s %2$s' ), + _x( '%1$s %2$s', 'font' ), weightName, styleName ); diff --git a/packages/block-library/src/avatar/hooks.js b/packages/block-library/src/avatar/hooks.js index 1f84b5c107682b..d73b604bdef22e 100644 --- a/packages/block-library/src/avatar/hooks.js +++ b/packages/block-library/src/avatar/hooks.js @@ -47,9 +47,8 @@ export function useCommentAvatar( { commentId } ) { src: avatarUrls ? avatarUrls[ avatarUrls.length - 1 ] : defaultAvatar, minSize, maxSize, - // translators: %s is the Author name. alt: authorName - ? // translators: %s is the Author name. + ? // translators: %s: Author name. sprintf( __( '%s Avatar' ), authorName ) : __( 'Default Avatar' ), }; @@ -89,7 +88,7 @@ export function useUserAvatar( { userId, postId, postType } ) { minSize, maxSize, alt: authorDetails - ? // translators: %s is the Author name. + ? // translators: %s: Author name. sprintf( __( '%s Avatar' ), authorDetails?.name ) : __( 'Default Avatar' ), }; diff --git a/packages/block-library/src/avatar/index.php b/packages/block-library/src/avatar/index.php index cc86052af4abe2..d4a01c1c3a1e77 100644 --- a/packages/block-library/src/avatar/index.php +++ b/packages/block-library/src/avatar/index.php @@ -46,7 +46,7 @@ function render_block_core_avatar( $attributes, $content, $block ) { } $author_name = get_the_author_meta( 'display_name', $author_id ); - // translators: %s is the Author name. + // translators: %s: Author name. $alt = sprintf( __( '%s Avatar' ), $author_name ); $avatar_block = get_avatar( $author_id, @@ -64,7 +64,7 @@ function render_block_core_avatar( $attributes, $content, $block ) { // translators: %s is the Author name. $label = 'aria-label="' . esc_attr( sprintf( __( '(%s author archive, opens in a new tab)' ), $author_name ) ) . '"'; } - // translators: %1$s: Author archive link. %2$s: Link target. %3$s Aria label. %4$s Avatar image. + // translators: 1: Author archive link. 2: Link target. %3$s Aria label. %4$s Avatar image. $avatar_block = sprintf( '%4$s', esc_url( get_author_posts_url( $author_id ) ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block ); } return sprintf( '
%2s
', $wrapper_attributes, $avatar_block ); @@ -73,7 +73,7 @@ function render_block_core_avatar( $attributes, $content, $block ) { if ( ! $comment ) { return ''; } - /* translators: %s is the Comment Author name */ + /* translators: %s: Author name. */ $alt = sprintf( __( '%s Avatar' ), $comment->comment_author ); $avatar_block = get_avatar( $comment, @@ -88,10 +88,9 @@ function render_block_core_avatar( $attributes, $content, $block ) { if ( isset( $attributes['isLink'] ) && $attributes['isLink'] && isset( $comment->comment_author_url ) && '' !== $comment->comment_author_url ) { $label = ''; if ( '_blank' === $attributes['linkTarget'] ) { - // translators: %s is the Comment Author name. + // translators: %s: Comment author name. $label = 'aria-label="' . esc_attr( sprintf( __( '(%s website link, opens in a new tab)' ), $comment->comment_author ) ) . '"'; } - // translators: %1$s: Comment Author website link. %2$s: Link target. %3$s Aria label. %4$s Avatar image. $avatar_block = sprintf( '%4$s', esc_url( $comment->comment_author_url ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block ); } return sprintf( '
%2s
', $wrapper_attributes, $avatar_block ); diff --git a/packages/block-library/src/comment-author-avatar/index.php b/packages/block-library/src/comment-author-avatar/index.php index 7c568fc3ded5e4..1568b6606669c4 100644 --- a/packages/block-library/src/comment-author-avatar/index.php +++ b/packages/block-library/src/comment-author-avatar/index.php @@ -46,7 +46,7 @@ function render_block_core_comment_author_avatar( $attributes, $content, $block $styles = isset( $wrapper_attributes['style'] ) ? $wrapper_attributes['style'] : ''; $classes = isset( $wrapper_attributes['class'] ) ? $wrapper_attributes['class'] : ''; - /* translators: %s is the Comment Author name */ + /* translators: %s: Author name. */ $alt = sprintf( __( '%s Avatar' ), $comment->comment_author ); $avatar_block = get_avatar( diff --git a/packages/block-library/src/latest-posts/edit.js b/packages/block-library/src/latest-posts/edit.js index 7914f10be6bde8..8116b5eecaebf0 100644 --- a/packages/block-library/src/latest-posts/edit.js +++ b/packages/block-library/src/latest-posts/edit.js @@ -589,7 +589,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) { { displayAuthor && currentAuthor && (
{ sprintf( - /* translators: byline. %s: current author. */ + /* translators: byline. %s: author. */ __( 'by %s' ), currentAuthor.name ) } diff --git a/packages/block-library/src/latest-posts/index.php b/packages/block-library/src/latest-posts/index.php index 85c7b58737a1cf..f8fd8ea27bc453 100644 --- a/packages/block-library/src/latest-posts/index.php +++ b/packages/block-library/src/latest-posts/index.php @@ -123,7 +123,7 @@ function render_block_core_latest_posts( $attributes ) { if ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) { $author_display_name = get_the_author_meta( 'display_name', $post->post_author ); - /* translators: byline. %s: current author. */ + /* translators: byline. %s: author. */ $byline = sprintf( __( 'by %s' ), $author_display_name ); if ( ! empty( $author_display_name ) ) { diff --git a/packages/block-library/src/navigation/edit/menu-inspector-controls.js b/packages/block-library/src/navigation/edit/menu-inspector-controls.js index 8f6c2e47fe7759..a2c6078d9fabe2 100644 --- a/packages/block-library/src/navigation/edit/menu-inspector-controls.js +++ b/packages/block-library/src/navigation/edit/menu-inspector-controls.js @@ -26,8 +26,8 @@ import LeafMoreMenu from './leaf-more-menu'; import { updateAttributes } from '../../navigation-link/update-attributes'; import { LinkUI } from '../../navigation-link/link-ui'; -/* translators: %s: The name of a menu. */ -const actionLabel = __( "Switch to '%s'" ); +const actionLabel = + /* translators: %s: The name of a menu. */ __( "Switch to '%s'" ); const BLOCKS_WITH_LINK_UI_SUPPORT = [ 'core/navigation-link', 'core/navigation-submenu', diff --git a/packages/block-library/src/navigation/edit/navigation-menu-selector.js b/packages/block-library/src/navigation/edit/navigation-menu-selector.js index 007220b1789131..dceabf063b26e8 100644 --- a/packages/block-library/src/navigation/edit/navigation-menu-selector.js +++ b/packages/block-library/src/navigation/edit/navigation-menu-selector.js @@ -21,7 +21,7 @@ import useNavigationEntities from '../use-navigation-entities'; function buildMenuLabel( title, id, status ) { if ( ! title ) { - /* translators: %s is the index of the menu in the list of menus. */ + /* translators: %s: the index of the menu in the list of menus. */ return sprintf( __( '(no title %s)' ), id ); } @@ -30,7 +30,7 @@ function buildMenuLabel( title, id, status ) { } return sprintf( - // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.). + // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). __( '%1$s (%2$s)' ), decodeEntities( title ), status diff --git a/packages/block-library/src/post-featured-image/edit.js b/packages/block-library/src/post-featured-image/edit.js index dff34379e4f3b4..95441a5a55cfd0 100644 --- a/packages/block-library/src/post-featured-image/edit.js +++ b/packages/block-library/src/post-featured-image/edit.js @@ -207,7 +207,7 @@ export default function PostFeaturedImageEdit( { label={ postType?.labels.singular_name ? sprintf( - // translators: %s: Name of the post type e.g: "Page". + // translators: %s: Name of the post type e.g: "post". __( 'Link to %s' ), postType.labels.singular_name ) diff --git a/packages/block-library/src/post-time-to-read/edit.js b/packages/block-library/src/post-time-to-read/edit.js index abfdce6630a67d..0533b99d3fd9d7 100644 --- a/packages/block-library/src/post-time-to-read/edit.js +++ b/packages/block-library/src/post-time-to-read/edit.js @@ -71,8 +71,8 @@ function PostTimeToReadEdit( { attributes, setAttributes, context } ) { ); return sprintf( - /* translators: %d is the number of minutes the post will take to read. */ - _n( '%d minute', '%d minutes', minutesToRead ), + /* translators: %s: the number of minutes to read the post. */ + _n( '%s minute', '%s minutes', minutesToRead ), minutesToRead ); }, [ contentStructure, blocks ] ); diff --git a/packages/block-library/src/post-time-to-read/index.php b/packages/block-library/src/post-time-to-read/index.php index f7abb1903f04df..eac79d11450b7d 100644 --- a/packages/block-library/src/post-time-to-read/index.php +++ b/packages/block-library/src/post-time-to-read/index.php @@ -32,7 +32,7 @@ function render_block_core_post_time_to_read( $attributes, $content, $block ) { $minutes_to_read = max( 1, (int) round( wp_word_count( $content, $word_count_type ) / $average_reading_rate ) ); $minutes_to_read_string = sprintf( - /* translators: %s is the number of minutes the post will take to read. */ + /* translators: %s: the number of minutes to read the post. */ _n( '%s minute', '%s minutes', $minutes_to_read ), $minutes_to_read ); diff --git a/packages/block-library/src/query-title/edit.js b/packages/block-library/src/query-title/edit.js index 845809a9300137..21d23081837cdf 100644 --- a/packages/block-library/src/query-title/edit.js +++ b/packages/block-library/src/query-title/edit.js @@ -15,7 +15,7 @@ import { HeadingLevelDropdown, } from '@wordpress/block-editor'; import { ToggleControl, PanelBody } from '@wordpress/components'; -import { __, sprintf } from '@wordpress/i18n'; +import { __, _x, sprintf } from '@wordpress/i18n'; /** * Internal dependencies @@ -60,7 +60,7 @@ export default function QueryTitleEdit( { if ( archiveNameLabel ) { title = sprintf( /* translators: 1: Archive type title e.g: "Category", 2: Label of the archive e.g: "Shoes" */ - __( '%1$s: %2$s' ), + _x( '%1$s: %2$s', 'archive label' ), archiveTypeLabel, archiveNameLabel ); diff --git a/packages/block-library/src/query/edit/inspector-controls/order-control.js b/packages/block-library/src/query/edit/inspector-controls/order-control.js index 2f6fa0e589d473..23802f844359d7 100644 --- a/packages/block-library/src/query/edit/inspector-controls/order-control.js +++ b/packages/block-library/src/query/edit/inspector-controls/order-control.js @@ -14,12 +14,12 @@ const orderOptions = [ value: 'date/asc', }, { - /* translators: label for ordering posts by title in ascending order */ + /* translators: Label for ordering posts by title in ascending order. */ label: __( 'A → Z' ), value: 'title/asc', }, { - /* translators: label for ordering posts by title in descending order */ + /* translators: Label for ordering posts by title in descending order. */ label: __( 'Z → A' ), value: 'title/desc', }, diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php index 3e8231d259e700..32885863402d5e 100644 --- a/packages/block-library/src/rss/index.php +++ b/packages/block-library/src/rss/index.php @@ -62,7 +62,7 @@ function render_block_core_rss( $attributes ) { if ( is_object( $author ) ) { $author = $author->get_name(); $author = '' . sprintf( - /* translators: %s: the author. */ + /* translators: byline. %s: author. */ __( 'by %s' ), esc_html( strip_tags( $author ) ) ) . ''; diff --git a/packages/block-library/src/template-part/edit/index.js b/packages/block-library/src/template-part/edit/index.js index 951f875143b0f9..ae941c977e14fd 100644 --- a/packages/block-library/src/template-part/edit/index.js +++ b/packages/block-library/src/template-part/edit/index.js @@ -214,7 +214,7 @@ export default function TemplatePartEdit( { { sprintf( - /* translators: %s: Template part slug */ + /* translators: %s: Template part slug. */ __( 'Template part has been deleted or is unavailable: %s' ), diff --git a/packages/block-library/src/video/tracks-editor.js b/packages/block-library/src/video/tracks-editor.js index d01e365985bc96..10fb241a9ecb30 100644 --- a/packages/block-library/src/video/tracks-editor.js +++ b/packages/block-library/src/video/tracks-editor.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { __, sprintf } from '@wordpress/i18n'; +import { __, _x, sprintf } from '@wordpress/i18n'; import { NavigableMenu, MenuItem, @@ -63,7 +63,7 @@ function TrackList( { tracks, onEditPress } ) { onClick={ () => onEditPress( index ) } aria-label={ sprintf( /* translators: %s: Label of the video text track e.g: "French subtitles" */ - __( 'Edit %s' ), + _x( 'Edit %s', 'text tracks' ), track.label ) } > diff --git a/packages/components/src/border-control/border-control-dropdown/component.tsx b/packages/components/src/border-control/border-control-dropdown/component.tsx index 0223de66a4c78b..827e7973a90432 100644 --- a/packages/components/src/border-control/border-control-dropdown/component.tsx +++ b/packages/components/src/border-control/border-control-dropdown/component.tsx @@ -73,15 +73,19 @@ const getToggleAriaLabel = ( const ariaLabelValue = getAriaLabelColorValue( colorObject.color ); return style ? sprintf( - // translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g.: "#f00:". %3$s: The current border style selection e.g. "solid". - 'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s". The currently selected style is "%3$s".', + // translators: 1: The name of the color e.g. "vivid red". 2: The color's hex code e.g.: "#f00:". 3: The current border style selection e.g. "solid". + __( + 'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s". The currently selected style is "%3$s".' + ), colorObject.name, ariaLabelValue, style ) : sprintf( - // translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g.: "#f00:". - 'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s".', + // translators: 1: The name of the color e.g. "vivid red". 2: The color's hex code e.g.: "#f00:". + __( + 'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s".' + ), colorObject.name, ariaLabelValue ); @@ -91,14 +95,18 @@ const getToggleAriaLabel = ( const ariaLabelValue = getAriaLabelColorValue( colorValue ); return style ? sprintf( - // translators: %1$s: The color's hex code e.g.: "#f00:". %2$s: The current border style selection e.g. "solid". - 'Border color and style picker. The currently selected color has a value of "%1$s". The currently selected style is "%2$s".', + // translators: 1: The color's hex code e.g.: "#f00:". 2: The current border style selection e.g. "solid". + __( + 'Border color and style picker. The currently selected color has a value of "%1$s". The currently selected style is "%2$s".' + ), ariaLabelValue, style ) : sprintf( - // translators: %1$s: The color's hex code e.g: "#f00". - 'Border color and style picker. The currently selected color has a value of "%1$s".', + // translators: %s: The color's hex code e.g: "#f00". + __( + 'Border color and style picker. The currently selected color has a value of "%s".' + ), ariaLabelValue ); } @@ -108,8 +116,10 @@ const getToggleAriaLabel = ( if ( colorObject ) { return sprintf( - // translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g: "#f00". - 'Border color picker. The currently selected color is called "%1$s" and has a value of "%2$s".', + // translators: 1: The name of the color e.g. "vivid red". 2: The color's hex code e.g: "#f00". + __( + 'Border color picker. The currently selected color is called "%1$s" and has a value of "%2$s".' + ), colorObject.name, getAriaLabelColorValue( colorObject.color ) ); @@ -117,8 +127,10 @@ const getToggleAriaLabel = ( if ( colorValue ) { return sprintf( - // translators: %1$s: The color's hex code e.g: "#f00". - 'Border color picker. The currently selected color has a value of "%1$s".', + // translators: %s: The color's hex code e.g: "#f00". + __( + 'Border color picker. The currently selected color has a value of "%s".' + ), getAriaLabelColorValue( colorValue ) ); } diff --git a/packages/components/src/color-palette/index.tsx b/packages/components/src/color-palette/index.tsx index c744faee9b0c3f..a65508d8278c5f 100644 --- a/packages/components/src/color-palette/index.tsx +++ b/packages/components/src/color-palette/index.tsx @@ -233,7 +233,7 @@ function UnforwardedColorPalette( const displayValue = value?.replace( /^var\((.+)\)$/, '$1' ); const customColorAccessibleLabel = !! displayValue ? sprintf( - // translators: %1$s: The name of the color e.g: "vivid red". %2$s: The color's hex code e.g: "#f00". + // translators: 1: The name of the color e.g: "vivid red". 2: The color's hex code e.g: "#f00". __( 'Custom color picker. The currently selected color is called "%1$s" and has a value of "%2$s".' ), diff --git a/packages/components/src/custom-gradient-picker/gradient-bar/control-points.tsx b/packages/components/src/custom-gradient-picker/gradient-bar/control-points.tsx index a92e973d88c5a8..3911e21e0f9348 100644 --- a/packages/components/src/custom-gradient-picker/gradient-bar/control-points.tsx +++ b/packages/components/src/custom-gradient-picker/gradient-bar/control-points.tsx @@ -56,7 +56,7 @@ function ControlPointButton( { <>