From ad10d0cf9b60476eede3cb1c55877064578a4c79 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Tue, 24 May 2022 17:19:28 +0300 Subject: [PATCH] make strings translatable --- .../add-custom-template-modal.js | 48 +++++++++++++------ .../add-new-template/new-template.js | 27 +++++++++-- 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/packages/edit-site/src/components/add-new-template/add-custom-template-modal.js b/packages/edit-site/src/components/add-new-template/add-custom-template-modal.js index ccd4a1690fb9c5..0503cdde35ca34 100644 --- a/packages/edit-site/src/components/add-new-template/add-custom-template-modal.js +++ b/packages/edit-site/src/components/add-new-template/add-custom-template-modal.js @@ -2,7 +2,7 @@ * WordPress dependencies */ import { useState, useMemo, useEffect } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { Button, Flex, @@ -124,7 +124,6 @@ function SuggestionList( { entityForSuggestions, onSelect } ) { return ( <> ) } - { !! search && ! suggestions?.length &&

No results

} + { !! search && ! suggestions?.length && ( +

{ __( 'No results were found.' ) }

+ ) } ); } @@ -162,7 +163,11 @@ function AddCustomTemplateModal( { onClose, onSelect, entityForSuggestions } ) { const baseCssClass = 'edit-site-custom-template-modal'; return ( { __( 'General' ) } - { `Design a template for all ${ entityForSuggestions.labels.plural }.` } + { sprintf( + // translators: %s: Name of the post type in plural e.g: "Posts". + __( 'Design a template for a all %s.' ), + entityForSuggestions.labels.plural + ) } { - setShowSearchEntities( true ); - } - // show the available missing types... - } + onClick={ () => { + setShowSearchEntities( true ); + } } > { __( 'Specific' ) } - { `Design a template for a specific ${ entityForSuggestions.labels.singular }.` } + { sprintf( + // translators: %s: Name of the post type e.g: "Post". + __( + 'Design a template for a specific %s.' + ), + entityForSuggestions.labels.singular + ) } - { ' ' } + ) } { showSearchEntities && ( <> -

{ `Use the search form below to find or create a template for a certain ${ entityForSuggestions.labels.singular }.` }

+

+ { sprintf( + // translators: %s: Name of the post type e.g: "Post". + __( + 'Select the %s you would like to design a template for.' + ), + entityForSuggestions.labels.singular + ) } +