Skip to content

Commit 2e41f78

Browse files
committed
Misc i18n fixes
1 parent bf84ac6 commit 2e41f78

File tree

71 files changed

+193
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+193
-165
lines changed

packages/block-directory/src/components/downloadable-block-list-item/index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@ function getDownloadableBlockLabel(
3434
const stars = Math.round( rating / 0.5 ) * 0.5;
3535

3636
if ( ! isInstalled && hasNotice ) {
37-
/* translators: %1$s: block title */
37+
/* translators: %s: block title */
3838
return sprintf( 'Retry installing %s.', decodeEntities( title ) );
3939
}
4040

4141
if ( isInstalled ) {
42-
/* translators: %1$s: block title */
42+
/* translators: %s: block title */
4343
return sprintf( 'Add %s.', decodeEntities( title ) );
4444
}
4545

4646
if ( isInstalling ) {
47-
/* translators: %1$s: block title */
47+
/* translators: %s: block title */
4848
return sprintf( 'Installing %s.', decodeEntities( title ) );
4949
}
5050

5151
// No ratings yet, just use the title.
5252
if ( ratingCount < 1 ) {
53-
/* translators: %1$s: block title */
53+
/* translators: %s: block title */
5454
return sprintf( 'Install %s.', decodeEntities( title ) );
5555
}
5656

5757
return sprintf(
58-
/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */
58+
/* translators: 1: block title, 2: average rating, 3: total ratings count. */
5959
_n(
6060
'Install %1$s. %2$s stars with %3$s review.',
6161
'Install %1$s. %2$s stars with %3$s reviews.',
@@ -131,7 +131,7 @@ function DownloadableBlockListItem( { item, onClick } ) {
131131
<span className="block-directory-downloadable-block-list-item__title">
132132
{ createInterpolateElement(
133133
sprintf(
134-
/* translators: %1$s: block title, %2$s: author name. */
134+
/* translators: 1: block title. 2: author name. */
135135
__( '%1$s <span>by %2$s</span>' ),
136136
decodeEntities( title ),
137137
author

packages/block-editor/src/components/block-card/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
__experimentalVStack as VStack,
1414
} from '@wordpress/components';
1515
import { chevronLeft, chevronRight } from '@wordpress/icons';
16-
import { __, isRTL, sprintf } from '@wordpress/i18n';
16+
import { __, _x, isRTL, sprintf } from '@wordpress/i18n';
1717
import { useSelect, useDispatch } from '@wordpress/data';
1818

1919
/**
@@ -68,8 +68,8 @@ function BlockCard( { title, icon, description, blockType, className, name } ) {
6868
<h2 className="block-editor-block-card__title">
6969
{ name?.length
7070
? sprintf(
71-
// translators: %1$s: Custom block name. %2$s: Block title.
72-
__( '%1$s (%2$s)' ),
71+
// translators: 1: Custom block name. 2: Block title.
72+
_x( '%1$s (%2$s)', 'block label' ),
7373
name,
7474
title
7575
)

packages/block-editor/src/components/block-patterns-paging/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function Pagination( {
6262
</HStack>
6363
<Text variant="muted">
6464
{ sprintf(
65-
// translators: %1$s: Current page number, %2$s: Total number of pages.
65+
// translators: 1: Current page number. 2: Total number of pages.
6666
_x( '%1$s of %2$s', 'paging' ),
6767
currentPage,
6868
numPages

packages/block-editor/src/components/block-variation-transforms/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function VariationsButtons( {
4545
selectedValue === variation.name
4646
? variation.title
4747
: sprintf(
48-
/* translators: %s: Name of the block variation */
48+
/* translators: %s: Block or block variation name. */
4949
__( 'Transform to %s' ),
5050
variation.title
5151
)
@@ -127,7 +127,7 @@ function VariationsToggleGroupControl( {
127127
selectedValue === variation.name
128128
? variation.title
129129
: sprintf(
130-
/* translators: %s: Name of the block variation */
130+
/* translators: %s: Block or block variation name. */
131131
__( 'Transform to %s' ),
132132
variation.title
133133
)

packages/block-editor/src/components/inserter-button/index.native.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class MenuItem extends Component {
5454
const accessibilityLabelFormat = blockIsNew
5555
? // translators: Newly available block name. %s: The localized block name
5656
__( '%s block, newly available' )
57-
: // translators: Block name. %s: The localized block name
57+
: // translators: %s: Block name e.g. "Image block"
5858
__( '%s block' );
5959
const accessibilityLabel = sprintf(
6060
accessibilityLabelFormat,

packages/block-editor/src/components/spacing-sizes-control/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
__experimentalVStack as VStack,
88
} from '@wordpress/components';
99
import { useState } from '@wordpress/element';
10-
import { __, sprintf } from '@wordpress/i18n';
10+
import { _x, sprintf } from '@wordpress/i18n';
1111

1212
/**
1313
* Internal dependencies
@@ -89,8 +89,8 @@ export default function SpacingSizesControl( {
8989
ALL_SIDES.includes( view ) && showSideInLabel ? LABELS[ view ] : '';
9090

9191
const label = sprintf(
92-
// translators: 2. Type of spacing being modified (Padding, margin, etc). 1: The side of the block being modified (top, bottom, left etc.).
93-
__( '%1$s %2$s' ),
92+
// translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc).
93+
_x( '%1$s %2$s', 'spacing' ),
9494
labelProp,
9595
sideLabel
9696
).trim();

packages/block-editor/src/components/spacing-sizes-control/input-controls/spacing-input-control.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { useSelect } from '@wordpress/data';
1515
import { useState, useMemo } from '@wordpress/element';
1616
import { usePrevious } from '@wordpress/compose';
17-
import { __, sprintf } from '@wordpress/i18n';
17+
import { __, _x, sprintf } from '@wordpress/i18n';
1818
import { settings } from '@wordpress/icons';
1919

2020
/**
@@ -124,7 +124,7 @@ export default function SpacingInputControl( {
124124
...spacingSizes,
125125
{
126126
name: ! isMixed
127-
? // translators: A custom measurement, eg. a number followed by a unit like 12px.
127+
? // translators: %s: A custom measurement, e.g. a number followed by a unit like 12px.
128128
sprintf( __( 'Custom (%s)' ), value )
129129
: __( 'Mixed' ),
130130
slug: 'custom',
@@ -200,8 +200,8 @@ export default function SpacingInputControl( {
200200
const typeLabel = showSideInLabel ? type?.toLowerCase() : type;
201201

202202
const ariaLabel = sprintf(
203-
// translators: 1: The side of the block being modified (top, bottom, left, All sides etc.). 2. Type of spacing being modified (Padding, margin, etc)
204-
__( '%1$s %2$s' ),
203+
// translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc).
204+
_x( '%1$s %2$s', 'spacing' ),
205205
sideLabel,
206206
typeLabel
207207
).trim();

packages/block-editor/src/components/url-input/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class URLInput extends Component {
196196
if ( !! suggestions.length ) {
197197
this.props.debouncedSpeak(
198198
sprintf(
199-
/* translators: %s: number of results. */
199+
/* translators: %d: number of results. */
200200
_n(
201201
'%d result found, use up and down arrow keys to navigate.',
202202
'%d results found, use up and down arrow keys to navigate.',

packages/block-editor/src/components/use-block-commands/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const useTransformCommands = () => {
113113
const { name, title, icon } = transformation;
114114
return {
115115
name: 'core/block-editor/transform-to-' + name.replace( '/', '-' ),
116-
// translators: %s: block title/name.
116+
/* translators: %s: Block or block variation name. */
117117
label: sprintf( __( 'Transform to %s' ), title ),
118118
icon: <BlockIcon icon={ icon } />,
119119
callback: ( { close } ) => {

packages/block-editor/src/utils/get-font-styles-and-weights.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* WordPress dependencies
33
*/
4-
import { _x, __, sprintf } from '@wordpress/i18n';
4+
import { _x, sprintf } from '@wordpress/i18n';
55

66
/**
77
* Internal dependencies
@@ -173,7 +173,7 @@ export function getFontStylesAndWeights( fontFamilyFaces ) {
173173
? weightName
174174
: sprintf(
175175
/* translators: 1: Font weight name. 2: Font style name. */
176-
__( '%1$s %2$s' ),
176+
_x( '%1$s %2$s', 'font' ),
177177
weightName,
178178
styleName
179179
);

packages/block-library/src/avatar/hooks.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ export function useCommentAvatar( { commentId } ) {
4747
src: avatarUrls ? avatarUrls[ avatarUrls.length - 1 ] : defaultAvatar,
4848
minSize,
4949
maxSize,
50-
// translators: %s is the Author name.
5150
alt: authorName
52-
? // translators: %s is the Author name.
51+
? // translators: %s: Author name.
5352
sprintf( __( '%s Avatar' ), authorName )
5453
: __( 'Default Avatar' ),
5554
};
@@ -89,7 +88,7 @@ export function useUserAvatar( { userId, postId, postType } ) {
8988
minSize,
9089
maxSize,
9190
alt: authorDetails
92-
? // translators: %s is the Author name.
91+
? // translators: %s: Author name.
9392
sprintf( __( '%s Avatar' ), authorDetails?.name )
9493
: __( 'Default Avatar' ),
9594
};

packages/block-library/src/avatar/index.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function render_block_core_avatar( $attributes, $content, $block ) {
4646
}
4747

4848
$author_name = get_the_author_meta( 'display_name', $author_id );
49-
// translators: %s is the Author name.
49+
// translators: %s: Author name.
5050
$alt = sprintf( __( '%s Avatar' ), $author_name );
5151
$avatar_block = get_avatar(
5252
$author_id,
@@ -64,7 +64,7 @@ function render_block_core_avatar( $attributes, $content, $block ) {
6464
// translators: %s is the Author name.
6565
$label = 'aria-label="' . esc_attr( sprintf( __( '(%s author archive, opens in a new tab)' ), $author_name ) ) . '"';
6666
}
67-
// translators: %1$s: Author archive link. %2$s: Link target. %3$s Aria label. %4$s Avatar image.
67+
// translators: 1: Author archive link. 2: Link target. %3$s Aria label. %4$s Avatar image.
6868
$avatar_block = sprintf( '<a href="%1$s" target="%2$s" %3$s class="wp-block-avatar__link">%4$s</a>', esc_url( get_author_posts_url( $author_id ) ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block );
6969
}
7070
return sprintf( '<div %1s>%2s</div>', $wrapper_attributes, $avatar_block );
@@ -73,7 +73,7 @@ function render_block_core_avatar( $attributes, $content, $block ) {
7373
if ( ! $comment ) {
7474
return '';
7575
}
76-
/* translators: %s is the Comment Author name */
76+
/* translators: %s: Author name. */
7777
$alt = sprintf( __( '%s Avatar' ), $comment->comment_author );
7878
$avatar_block = get_avatar(
7979
$comment,
@@ -88,10 +88,9 @@ function render_block_core_avatar( $attributes, $content, $block ) {
8888
if ( isset( $attributes['isLink'] ) && $attributes['isLink'] && isset( $comment->comment_author_url ) && '' !== $comment->comment_author_url ) {
8989
$label = '';
9090
if ( '_blank' === $attributes['linkTarget'] ) {
91-
// translators: %s is the Comment Author name.
91+
// translators: %s: Comment author name.
9292
$label = 'aria-label="' . esc_attr( sprintf( __( '(%s website link, opens in a new tab)' ), $comment->comment_author ) ) . '"';
9393
}
94-
// translators: %1$s: Comment Author website link. %2$s: Link target. %3$s Aria label. %4$s Avatar image.
9594
$avatar_block = sprintf( '<a href="%1$s" target="%2$s" %3$s class="wp-block-avatar__link">%4$s</a>', esc_url( $comment->comment_author_url ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block );
9695
}
9796
return sprintf( '<div %1s>%2s</div>', $wrapper_attributes, $avatar_block );

packages/block-library/src/comment-author-avatar/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function render_block_core_comment_author_avatar( $attributes, $content, $block
4646
$styles = isset( $wrapper_attributes['style'] ) ? $wrapper_attributes['style'] : '';
4747
$classes = isset( $wrapper_attributes['class'] ) ? $wrapper_attributes['class'] : '';
4848

49-
/* translators: %s is the Comment Author name */
49+
/* translators: %s: Author name. */
5050
$alt = sprintf( __( '%s Avatar' ), $comment->comment_author );
5151

5252
$avatar_block = get_avatar(

packages/block-library/src/latest-posts/edit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
589589
{ displayAuthor && currentAuthor && (
590590
<div className="wp-block-latest-posts__post-author">
591591
{ sprintf(
592-
/* translators: byline. %s: current author. */
592+
/* translators: byline. %s: author. */
593593
__( 'by %s' ),
594594
currentAuthor.name
595595
) }

packages/block-library/src/latest-posts/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function render_block_core_latest_posts( $attributes ) {
123123
if ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) {
124124
$author_display_name = get_the_author_meta( 'display_name', $post->post_author );
125125

126-
/* translators: byline. %s: current author. */
126+
/* translators: byline. %s: author. */
127127
$byline = sprintf( __( 'by %s' ), $author_display_name );
128128

129129
if ( ! empty( $author_display_name ) ) {

packages/block-library/src/navigation/edit/menu-inspector-controls.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import LeafMoreMenu from './leaf-more-menu';
2626
import { updateAttributes } from '../../navigation-link/update-attributes';
2727
import { LinkUI } from '../../navigation-link/link-ui';
2828

29-
/* translators: %s: The name of a menu. */
30-
const actionLabel = __( "Switch to '%s'" );
29+
const actionLabel =
30+
/* translators: %s: The name of a menu. */ __( "Switch to '%s'" );
3131
const BLOCKS_WITH_LINK_UI_SUPPORT = [
3232
'core/navigation-link',
3333
'core/navigation-submenu',

packages/block-library/src/navigation/edit/navigation-menu-selector.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import useNavigationEntities from '../use-navigation-entities';
2121

2222
function buildMenuLabel( title, id, status ) {
2323
if ( ! title ) {
24-
/* translators: %s is the index of the menu in the list of menus. */
24+
/* translators: %s: the index of the menu in the list of menus. */
2525
return sprintf( __( '(no title %s)' ), id );
2626
}
2727

@@ -30,7 +30,7 @@ function buildMenuLabel( title, id, status ) {
3030
}
3131

3232
return sprintf(
33-
// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
33+
// translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).
3434
__( '%1$s (%2$s)' ),
3535
decodeEntities( title ),
3636
status

packages/block-library/src/post-featured-image/edit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export default function PostFeaturedImageEdit( {
207207
label={
208208
postType?.labels.singular_name
209209
? sprintf(
210-
// translators: %s: Name of the post type e.g: "Page".
210+
// translators: %s: Name of the post type e.g: "post".
211211
__( 'Link to %s' ),
212212
postType.labels.singular_name
213213
)

packages/block-library/src/post-time-to-read/edit.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ function PostTimeToReadEdit( { attributes, setAttributes, context } ) {
7171
);
7272

7373
return sprintf(
74-
/* translators: %d is the number of minutes the post will take to read. */
75-
_n( '%d minute', '%d minutes', minutesToRead ),
74+
/* translators: %s: the number of minutes to read the post. */
75+
_n( '%s minute', '%s minutes', minutesToRead ),
7676
minutesToRead
7777
);
7878
}, [ contentStructure, blocks ] );

packages/block-library/src/post-time-to-read/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function render_block_core_post_time_to_read( $attributes, $content, $block ) {
3232
$minutes_to_read = max( 1, (int) round( wp_word_count( $content, $word_count_type ) / $average_reading_rate ) );
3333

3434
$minutes_to_read_string = sprintf(
35-
/* translators: %s is the number of minutes the post will take to read. */
35+
/* translators: %s: the number of minutes to read the post. */
3636
_n( '%s minute', '%s minutes', $minutes_to_read ),
3737
$minutes_to_read
3838
);

packages/block-library/src/query-title/edit.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
HeadingLevelDropdown,
1616
} from '@wordpress/block-editor';
1717
import { ToggleControl, PanelBody } from '@wordpress/components';
18-
import { __, sprintf } from '@wordpress/i18n';
18+
import { __, _x, sprintf } from '@wordpress/i18n';
1919

2020
/**
2121
* Internal dependencies
@@ -60,7 +60,7 @@ export default function QueryTitleEdit( {
6060
if ( archiveNameLabel ) {
6161
title = sprintf(
6262
/* translators: 1: Archive type title e.g: "Category", 2: Label of the archive e.g: "Shoes" */
63-
__( '%1$s: %2$s' ),
63+
_x( '%1$s: %2$s', 'archive label' ),
6464
archiveTypeLabel,
6565
archiveNameLabel
6666
);

packages/block-library/src/query/edit/inspector-controls/order-control.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ const orderOptions = [
1414
value: 'date/asc',
1515
},
1616
{
17-
/* translators: label for ordering posts by title in ascending order */
17+
/* translators: Label for ordering posts by title in ascending order. */
1818
label: __( 'A → Z' ),
1919
value: 'title/asc',
2020
},
2121
{
22-
/* translators: label for ordering posts by title in descending order */
22+
/* translators: Label for ordering posts by title in descending order. */
2323
label: __( 'Z → A' ),
2424
value: 'title/desc',
2525
},

packages/block-library/src/rss/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function render_block_core_rss( $attributes ) {
6262
if ( is_object( $author ) ) {
6363
$author = $author->get_name();
6464
$author = '<span class="wp-block-rss__item-author">' . sprintf(
65-
/* translators: %s: the author. */
65+
/* translators: byline. %s: author. */
6666
__( 'by %s' ),
6767
esc_html( strip_tags( $author ) )
6868
) . '</span>';

packages/block-library/src/template-part/edit/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export default function TemplatePartEdit( {
214214
<TagName { ...blockProps }>
215215
<Warning>
216216
{ sprintf(
217-
/* translators: %s: Template part slug */
217+
/* translators: %s: Template part slug. */
218218
__(
219219
'Template part has been deleted or is unavailable: %s'
220220
),

packages/block-library/src/video/tracks-editor.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* WordPress dependencies
33
*/
4-
import { __, sprintf } from '@wordpress/i18n';
4+
import { __, _x, sprintf } from '@wordpress/i18n';
55
import {
66
NavigableMenu,
77
MenuItem,
@@ -63,7 +63,7 @@ function TrackList( { tracks, onEditPress } ) {
6363
onClick={ () => onEditPress( index ) }
6464
aria-label={ sprintf(
6565
/* translators: %s: Label of the video text track e.g: "French subtitles" */
66-
__( 'Edit %s' ),
66+
_x( 'Edit %s', 'text tracks' ),
6767
track.label
6868
) }
6969
>

0 commit comments

Comments
 (0)