From 9ea69df45f3c4363eae46fc07c4544eb97d42f2c Mon Sep 17 00:00:00 2001 From: Eshaan Dabasiya <76681468+im3dabasia@users.noreply.github.com> Date: Thu, 13 Feb 2025 08:22:04 +0530 Subject: [PATCH] ESLint: Improve lint regex for preventing "toggle" word usage in translation ready functions (#68958) * fix: Improve lint regex for toggle word detection * fix: Change strings to use alternate word for toggle Co-authored-by: im3dabasia Co-authored-by: tyxla Co-authored-by: swissspidy Co-authored-by: afercia --- .eslintrc.js | 2 +- packages/block-editor/src/components/tool-selector/index.js | 2 +- packages/block-editor/src/hooks/layout.js | 2 +- .../components/src/mobile/bottom-sheet/switch-cell.native.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d1ee2e1b347df..402c16ec5c80f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -116,7 +116,7 @@ const restrictedSyntax = [ }, { selector: - 'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] > Literal[value=/^toggle\\b/i]', + 'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] > Literal[value=/toggle\\b/i]', message: "Avoid using the verb 'Toggle' in translatable strings", }, { diff --git a/packages/block-editor/src/components/tool-selector/index.js b/packages/block-editor/src/components/tool-selector/index.js index 8c4b5c86c4082..c4c216cbe68a7 100644 --- a/packages/block-editor/src/components/tool-selector/index.js +++ b/packages/block-editor/src/components/tool-selector/index.js @@ -95,7 +95,7 @@ function ToolSelector( props, ref ) {
{ __( - 'Tools provide different sets of interactions for blocks. Toggle between simplified content tools (Write) and advanced visual editing tools (Design).' + 'Tools provide different sets of interactions for blocks. Choose between simplified content tools (Write) and advanced visual editing tools (Design).' ) }
diff --git a/packages/block-editor/src/hooks/layout.js b/packages/block-editor/src/hooks/layout.js index 54a376a0c6a4f..003a680940b97 100644 --- a/packages/block-editor/src/hooks/layout.js +++ b/packages/block-editor/src/hooks/layout.js @@ -257,7 +257,7 @@ function LayoutPanelPure( { 'Nested blocks use content width with options for full and wide widths.' ) : __( - 'Nested blocks will fill the width of this container. Toggle to constrain.' + 'Nested blocks will fill the width of this container.' ) } /> diff --git a/packages/components/src/mobile/bottom-sheet/switch-cell.native.js b/packages/components/src/mobile/bottom-sheet/switch-cell.native.js index 3e00756b1a7dc..0ada3fafc5672 100644 --- a/packages/components/src/mobile/bottom-sheet/switch-cell.native.js +++ b/packages/components/src/mobile/bottom-sheet/switch-cell.native.js @@ -57,7 +57,7 @@ export default function BottomSheetSwitchCell( props ) { accessibilityRole="none" accessibilityHint={ /* translators: accessibility text (hint for switches) */ - __( 'Double tap to toggle setting' ) + __( 'Double tap to change setting' ) } onPress={ onPress } editable={ false }