Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update percentage strings to be translatable #66323

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
__experimentalToggleGroupControl as ToggleGroupControl,
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -137,7 +137,11 @@ export default function ImageSizeControl( {
<ToggleGroupControlOption
key={ scale }
value={ scale }
label={ `${ scale }%` }
label={ sprintf(
/* translators: Percentage value. */
__( '%1$d%%' ),
scale
) }
/>
);
} ) }
Expand Down
8 changes: 6 additions & 2 deletions packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import { useEffect, useState, useRef, useMemo } from '@wordpress/element';
import {
TextControl,
Expand Down Expand Up @@ -148,7 +148,11 @@ function WidthPanel( { selectedWidth, setAttributes } ) {
<ToggleGroupControlOption
key={ widthValue }
value={ widthValue }
label={ `${ widthValue }%` }
label={ sprintf(
/* translators: Percentage value. */
__( '%1$d%%' ),
widthValue
) }
/>
);
} ) }
Expand Down
8 changes: 6 additions & 2 deletions packages/block-library/src/search/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';
import { Icon, search } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';

/**
Expand Down Expand Up @@ -470,7 +470,11 @@ export default function SearchEdit( {
<ToggleGroupControlOption
key={ widthValue }
value={ widthValue }
label={ `${ widthValue }%` }
label={ sprintf(
/* translators: Percentage value. */
__( '%1$d%%' ),
widthValue
) }
/>
);
} ) }
Expand Down
Loading