From a9622b81bc2066c5d38c6726678349618ebbda6b Mon Sep 17 00:00:00 2001 From: Addison Stavlo Date: Wed, 10 Mar 2021 12:19:14 -0500 Subject: [PATCH] Multi entity save panel - remove dynamic copy. (#29637) * remove dynamic copy * update static copy * replace copy again * update strong heading --- .../components/entities-saved-states/index.js | 57 +++---------------- 1 file changed, 7 insertions(+), 50 deletions(-) diff --git a/packages/editor/src/components/entities-saved-states/index.js b/packages/editor/src/components/entities-saved-states/index.js index d4d31398b94bc..b9e3110405018 100644 --- a/packages/editor/src/components/entities-saved-states/index.js +++ b/packages/editor/src/components/entities-saved-states/index.js @@ -7,7 +7,7 @@ import { some, groupBy } from 'lodash'; * WordPress dependencies */ import { Button, withFocusReturn } from '@wordpress/components'; -import { __, sprintf, _n } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { useSelect, useDispatch } from '@wordpress/data'; import { useState, useCallback } from '@wordpress/element'; import { close as closeIcon } from '@wordpress/icons'; @@ -17,36 +17,6 @@ import { close as closeIcon } from '@wordpress/icons'; */ import EntityTypeList from './entity-type-list'; -const ENTITY_NAMES = { - wp_template_part: ( number ) => - _n( 'template part', 'template parts', number ), - wp_template: ( number ) => _n( 'template', 'templates', number ), - post: ( number ) => _n( 'post', 'posts', number ), - page: ( number ) => _n( 'page', 'pages', number ), - site: ( number ) => _n( 'site', 'sites', number ), -}; - -const PLACEHOLDER_PHRASES = { - // 0 is a back up, but should never be observed. - 0: __( 'There are no changes.' ), - /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ - 1: __( 'The following changes have been made to your %s.' ), - /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ - 2: __( 'The following changes have been made to your %1$s and %2$s.' ), - /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ - 3: __( - 'The following changes have been made to your %1$s, %2$s, and %3$s.' - ), - /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ - 4: __( - 'The following changes have been made to your %1$s, %2$s, %3$s, and %4$s.' - ), - /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ - 5: __( - 'The following changes have been made to your %1$s, %2$s, %3$s, %4$s, and %5$s.' - ), -}; - function EntitiesSavedStates( { isOpen, close } ) { const { dirtyEntityRecords } = useSelect( ( select ) => { return { @@ -62,23 +32,6 @@ function EntitiesSavedStates( { isOpen, close } ) { groupBy( dirtyEntityRecords, 'name' ) ); - // Get labels for text-prompt phrase. - const entityNamesForPrompt = []; - partitionedSavables.forEach( ( list ) => { - if ( ENTITY_NAMES[ list[ 0 ].name ] ) { - entityNamesForPrompt.push( - ENTITY_NAMES[ list[ 0 ].name ]( list.length ) - ); - } - } ); - // Get text-prompt phrase based on number of entity types changed. - const placeholderPhrase = - PLACEHOLDER_PHRASES[ entityNamesForPrompt.length ] || - // Fallback for edge case that should not be observed (more than 5 entity types edited). - __( 'The following changes have been made to multiple entities.' ); - // eslint-disable-next-line @wordpress/valid-sprintf - const promptPhrase = sprintf( placeholderPhrase, ...entityNamesForPrompt ); - // Unchecked entities to be ignored by save function. const [ unselectedEntities, _setUnselectedEntities ] = useState( [] ); @@ -147,8 +100,12 @@ function EntitiesSavedStates( { isOpen, close } ) {
- { __( 'Are you ready to save?' ) } -

{ promptPhrase }

+ { __( 'Select the changes you want to save' ) } +

+ { __( + 'Some changes may affect other areas of your site.' + ) } +

{ partitionedSavables.map( ( list ) => {