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

Add context for the All translatable string and enforce l10n best practices #58196

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,16 @@ export function PatternsFilter( {
() => [
{
value: 'all',
label: _x( 'All', 'Option that shows all patterns' ),
label: _x( 'All', 'patterns' ),
},
{
value: INSERTER_SYNC_TYPES.full,
label: _x(
'Synced',
'Option that shows all synchronized patterns'
),
label: _x( 'Synced', 'patterns' ),
disabled: shouldDisableSyncFilter,
},
{
value: INSERTER_SYNC_TYPES.unsynced,
label: _x(
'Not synced',
'Option that shows all patterns that are not synchronized'
),
label: _x( 'Not synced', 'patterns' ),
disabled: shouldDisableSyncFilter,
},
],
Expand All @@ -85,7 +79,7 @@ export function PatternsFilter( {
() => [
{
value: 'all',
label: __( 'All' ),
label: _x( 'All', 'patterns' ),
disabled: shouldDisableNonUserSources,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* WordPress dependencies
*/

import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';

export const INSERTER_PATTERN_TYPES = {
user: 'user',
Expand All @@ -17,7 +17,7 @@ export const INSERTER_SYNC_TYPES = {

export const allPatternsCategory = {
name: 'allPatterns',
label: __( 'All' ),
label: _x( 'All', 'patterns' ),
};

export const myPatternsCategory = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { __, _x, sprintf } from '@wordpress/i18n';
import { Fragment } from '@wordpress/element';
import { ToggleControl } from '@wordpress/components';

Expand All @@ -26,8 +26,7 @@ function ResponsiveBlockControl( props ) {
isResponsive = false,
defaultLabel = {
id: 'all',
/* translators: 'Label. Used to signify a layout property (eg: margin, padding) will apply uniformly to all screensizes.' */
label: __( 'All' ),
label: _x( 'All', 'screen sizes' ),
},
viewports = [
{
Expand All @@ -52,12 +51,11 @@ function ResponsiveBlockControl( props ) {
const toggleControlLabel =
toggleLabel ||
sprintf(
/* translators: 'Toggle control label. Should the property be the same across all screen sizes or unique per screen size.'. %s property value for the control (eg: margin, padding...etc) */
/* translators: %s: Property value for the control (eg: margin, padding, etc.). */
__( 'Use the same %s on all screensizes.' ),
property
);

/* translators: 'Help text for the responsive mode toggle control.' */
const toggleHelpText = __(
'Toggle between using the same value for all screen sizes or using a unique value per screen size.'
);
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/query-controls/index.native.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';
import { useCallback, memo } from '@wordpress/element';

/**
Expand All @@ -23,12 +23,12 @@ const options = [
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',
},
Expand Down Expand Up @@ -76,7 +76,7 @@ const QueryControls = memo(
<CategorySelect
categoriesList={ categoriesList }
label={ __( 'Category' ) }
noOptionLabel={ __( 'All' ) }
noOptionLabel={ _x( 'All', 'categories' ) }
selectedCategoryId={ selectedCategoryId }
onChange={ onCategoryChange }
hideCancelButton={ true }
Expand Down
10 changes: 5 additions & 5 deletions packages/components/src/query-controls/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -96,12 +96,12 @@ export function QueryControls( {
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' ),
carolinan marked this conversation as resolved.
Show resolved Hide resolved
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',
},
Expand Down Expand Up @@ -137,7 +137,7 @@ export function QueryControls( {
key="query-controls-category-select"
categoriesList={ props.categoriesList }
label={ __( 'Category' ) }
noOptionLabel={ __( 'All' ) }
noOptionLabel={ _x( 'All', 'categories' ) }
selectedCategoryId={ props.selectedCategoryId }
onChange={ props.onCategoryChange }
/>
Expand Down Expand Up @@ -174,7 +174,7 @@ export function QueryControls( {
key="query-controls-author-select"
authorList={ authorList }
label={ __( 'Author' ) }
noOptionLabel={ __( 'All' ) }
noOptionLabel={ _x( 'All', 'authors' ) }
selectedAuthorId={ selectedAuthorId }
onChange={ onAuthorChange }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
Notice,
} from '@wordpress/components';
import { debounce } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';
import { search, closeSmall } from '@wordpress/icons';

/**
Expand All @@ -34,7 +34,7 @@ import { downloadFontFaceAsset } from './utils';

const DEFAULT_CATEGORY = {
slug: 'all',
name: __( 'All' ),
name: _x( 'All', 'font categories' ),
};
function FontCollection( { slug } ) {
const requiresPermission = slug === 'default-font-collection';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function LibraryFontCard( { font, ...props } ) {
font.source
).length;
const variantsText = sprintf(
/* translators: %1$d: Active font variants, %2$d: Total font variants */
/* translators: 1: Active font variants, 2: Total font variants. */
__( '%1$s/%2$s variants active' ),
variantsActive,
variantsInstalled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';
import {
__experimentalToggleGroupControl as ToggleGroupControl,
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
Expand Down Expand Up @@ -67,9 +67,7 @@ function ScreenTypographyElement( { element } ) {
>
<ToggleGroupControlOption
value="heading"
/* translators: 'All' refers to selecting all heading levels
and applying the same style to h1-h6. */
label={ __( 'All' ) }
label={ _x( 'All', 'heading levels' ) }
/>
<ToggleGroupControlOption
value="h1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';
import { trash } from '@wordpress/icons';

/**
Expand Down Expand Up @@ -49,7 +49,7 @@ const DEFAULT_PAGE_BASE = {
export const DEFAULT_VIEWS = {
page: [
{
title: __( 'All' ),
title: _x( 'All', 'pages' ),
slug: 'all',
view: DEFAULT_PAGE_BASE,
},
Expand Down
Loading