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 ESLint rule to prevent usage of the verb 'toggle' in translatable strings #67741

Merged
Merged
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ const restrictedSyntax = [
message:
'Avoid truthy checks on length property rendering, as zero length is rendered verbatim.',
},
{
selector:
'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] > Literal[value=/^toggle\\b/i]',
message: "Avoid using the verb 'Toggle' in translatable strings",
},
];

/** `no-restricted-syntax` rules for components. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function ResponsiveBlockControl( props ) {
);

const toggleHelpText = __(
'Toggle between using the same value for all screen sizes or using a unique value per screen size.'
'Choose whether to use the same value for all screen sizes or a unique value for each screen size.'
);

const defaultControl = renderDefaultControl(
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/table-of-contents/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default function TableOfContentsEdit( {
'Only including headings from the current page (if the post is paginated).'
)
: __(
'Toggle to only include headings from the current page (if the post is paginated).'
'Include headings from all pages (if the post is paginated).'
)
}
/>
Expand Down
Loading