From d2fd09d8bce1a4987bda0fcdfa176f95fccc3a7f Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:40:45 +1000 Subject: [PATCH 1/4] Patterns: Improve sentence case consistency of labels and notices --- .../src/components/inserter/block-patterns-tab.js | 2 +- .../list-reusable-blocks/src/components/import-form/index.js | 2 +- packages/patterns/src/components/pattern-convert-button.js | 4 ++-- packages/patterns/src/store/actions.js | 2 +- packages/reusable-blocks/src/store/actions.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/inserter/block-patterns-tab.js b/packages/block-editor/src/components/inserter/block-patterns-tab.js index 289ad4dfa47097..5d4b2684f1c70f 100644 --- a/packages/block-editor/src/components/inserter/block-patterns-tab.js +++ b/packages/block-editor/src/components/inserter/block-patterns-tab.js @@ -42,7 +42,7 @@ const noop = () => {}; export const allPatternsCategory = { name: 'allPatterns', - label: __( 'All Patterns' ), + label: __( 'All patterns' ), }; export const myPatternsCategory = { diff --git a/packages/list-reusable-blocks/src/components/import-form/index.js b/packages/list-reusable-blocks/src/components/import-form/index.js index 9ba1589e52f39b..57221d37d644c0 100644 --- a/packages/list-reusable-blocks/src/components/import-form/index.js +++ b/packages/list-reusable-blocks/src/components/import-form/index.js @@ -50,7 +50,7 @@ function ImportForm( { instanceId, onUpload } ) { uiMessage = __( 'Invalid JSON file' ); break; case 'Invalid Pattern JSON file': - uiMessage = __( 'Invalid Pattern JSON file' ); + uiMessage = __( 'Invalid pattern JSON file' ); break; default: uiMessage = __( 'Unknown error' ); diff --git a/packages/patterns/src/components/pattern-convert-button.js b/packages/patterns/src/components/pattern-convert-button.js index b29af99248f7db..002dbbd8c0181d 100644 --- a/packages/patterns/src/components/pattern-convert-button.js +++ b/packages/patterns/src/components/pattern-convert-button.js @@ -110,12 +110,12 @@ export default function PatternConvertButton( { clientIds, rootClientId } ) { pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced ? sprintf( // translators: %s: the name the user has given to the pattern. - __( 'Unsynced Pattern created: %s' ), + __( 'Unsynced pattern created: %s' ), pattern.title.raw ) : sprintf( // translators: %s: the name the user has given to the pattern. - __( 'Synced Pattern created: %s' ), + __( 'Synced pattern created: %s' ), pattern.title.raw ), { diff --git a/packages/patterns/src/store/actions.js b/packages/patterns/src/store/actions.js index 2861e4ce2dac06..dfa0326a709416 100644 --- a/packages/patterns/src/store/actions.js +++ b/packages/patterns/src/store/actions.js @@ -69,7 +69,7 @@ export const createPatternFromFile = ( parsedContent.syncStatus && typeof parsedContent.syncStatus !== 'string' ) ) { - throw new Error( 'Invalid Pattern JSON file' ); + throw new Error( 'Invalid pattern JSON file' ); } const pattern = await dispatch.createPattern( diff --git a/packages/reusable-blocks/src/store/actions.js b/packages/reusable-blocks/src/store/actions.js index 292a3082146aaa..85fe31138652a4 100644 --- a/packages/reusable-blocks/src/store/actions.js +++ b/packages/reusable-blocks/src/store/actions.js @@ -57,7 +57,7 @@ export const __experimentalConvertBlocksToReusable = : undefined; const reusableBlock = { - title: title || __( 'Untitled Pattern block' ), + title: title || __( 'Untitled pattern block' ), content: serialize( registry .select( blockEditorStore ) From ea974de51967efe5ec945715c8444dd458790126 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:00:57 +1000 Subject: [PATCH 2/4] Tweak further files --- packages/list-reusable-blocks/src/utils/import.js | 2 +- .../reusable-block-convert-button.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/list-reusable-blocks/src/utils/import.js b/packages/list-reusable-blocks/src/utils/import.js index 465fb080ce8dfe..432948ce6d6dbc 100644 --- a/packages/list-reusable-blocks/src/utils/import.js +++ b/packages/list-reusable-blocks/src/utils/import.js @@ -31,7 +31,7 @@ async function importReusableBlock( file ) { ( parsedContent.syncStatus && typeof parsedContent.syncStatus !== 'string' ) ) { - throw new Error( 'Invalid Pattern JSON file' ); + throw new Error( 'Invalid pattern JSON file' ); } const postType = await apiFetch( { path: `/wp/v2/types/wp_block` } ); const reusableBlock = await apiFetch( { diff --git a/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js b/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js index de29a930e89f18..347638baeaf059 100644 --- a/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js +++ b/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js @@ -115,12 +115,12 @@ export default function ReusableBlockConvertButton( { ! syncType ? sprintf( // translators: %s: the name the user has given to the pattern. - __( 'Synced Pattern created: %s' ), + __( 'Synced pattern created: %s' ), reusableBlockTitle ) : sprintf( // translators: %s: the name the user has given to the pattern. - __( 'Unsynced Pattern created: %s' ), + __( 'Unsynced pattern created: %s' ), reusableBlockTitle ), { From 9c9dba50adb187adce348e4065c875e4298e72eb Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:06:09 +1000 Subject: [PATCH 3/4] Tweak hidden labels for consistency too --- .../block-editor/src/components/block-patterns-list/index.js | 2 +- packages/block-editor/src/components/inserter/search-results.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/block-patterns-list/index.js b/packages/block-editor/src/components/block-patterns-list/index.js index 3ac0cc7018b3da..9ab7bbaf0bb445 100644 --- a/packages/block-editor/src/components/block-patterns-list/index.js +++ b/packages/block-editor/src/components/block-patterns-list/index.js @@ -149,7 +149,7 @@ function BlockPatternList( onHover, onClickPattern, orientation, - label = __( 'Block Patterns' ), + label = __( 'Block patterns' ), showTitlesAsTooltip, pagingProps, }, diff --git a/packages/block-editor/src/components/inserter/search-results.js b/packages/block-editor/src/components/inserter/search-results.js index 23a3cafc563ba6..edd99609ea916c 100644 --- a/packages/block-editor/src/components/inserter/search-results.js +++ b/packages/block-editor/src/components/inserter/search-results.js @@ -184,7 +184,7 @@ function InserterSearchResults( { const patternsUI = !! filteredBlockPatterns.length && ( { __( 'Block Patterns' ) } + { __( 'Block patterns' ) } } >
From 148d06a9b1ed1a1195a9a265e92dc8156cc260d2 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Tue, 26 Sep 2023 17:55:57 +1000 Subject: [PATCH 4/4] Fix failing e2es --- packages/e2e-test-utils/src/create-reusable-block.js | 2 +- packages/e2e-tests/specs/editor/various/pattern-blocks.test.js | 2 +- .../list-reusable-blocks/src/components/import-form/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/e2e-test-utils/src/create-reusable-block.js b/packages/e2e-test-utils/src/create-reusable-block.js index ed756353310dd9..0b2e327a5c05c2 100644 --- a/packages/e2e-test-utils/src/create-reusable-block.js +++ b/packages/e2e-test-utils/src/create-reusable-block.js @@ -34,7 +34,7 @@ export const createReusableBlock = async ( content, title ) => { // Wait for creation to finish await page.waitForXPath( - '//*[contains(@class, "components-snackbar")]/*[contains(text(),"Pattern created:")]' + '//*[contains(@class, "components-snackbar")]/*[contains(text(),"pattern created:")]' ); // Check that we have a reusable block on the page diff --git a/packages/e2e-tests/specs/editor/various/pattern-blocks.test.js b/packages/e2e-tests/specs/editor/various/pattern-blocks.test.js index cdbc130943e8de..442ed2b21915a5 100644 --- a/packages/e2e-tests/specs/editor/various/pattern-blocks.test.js +++ b/packages/e2e-tests/specs/editor/various/pattern-blocks.test.js @@ -209,7 +209,7 @@ describe( 'Pattern blocks', () => { // Wait for creation to finish. await page.waitForXPath( - '//*[contains(@class, "components-snackbar")]/*[contains(text(),"Pattern created:")]' + '//*[contains(@class, "components-snackbar")]/*[contains(text(),"pattern created:")]' ); await clearAllBlocks(); diff --git a/packages/list-reusable-blocks/src/components/import-form/index.js b/packages/list-reusable-blocks/src/components/import-form/index.js index 57221d37d644c0..1f5e62f9115b36 100644 --- a/packages/list-reusable-blocks/src/components/import-form/index.js +++ b/packages/list-reusable-blocks/src/components/import-form/index.js @@ -49,7 +49,7 @@ function ImportForm( { instanceId, onUpload } ) { case 'Invalid JSON file': uiMessage = __( 'Invalid JSON file' ); break; - case 'Invalid Pattern JSON file': + case 'Invalid pattern JSON file': uiMessage = __( 'Invalid pattern JSON file' ); break; default: