Skip to content

Commit

Permalink
Fix font library modal dialog translatable strings (#58256)
Browse files Browse the repository at this point in the history
* Fix translatable string in font library modal font card.

* Fix translatable string in font library modal local fonts.

* Simplify allowed font types string.

* Reapply change after rebase.
  • Loading branch information
afercia authored Jan 30, 2024
1 parent 7ddc2af commit 62027aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { _n } from '@wordpress/i18n';
import { _n, sprintf } from '@wordpress/i18n';
import {
__experimentalText as Text,
Button,
Expand Down Expand Up @@ -58,9 +58,15 @@ function FontCard( { font, onClick, variantsText } ) {
<FlexItem>
<Text className="font-library-modal__font-card__count">
{ variantsText ||
variantsCount +
' ' +
_n( 'variant', 'variants', variantsCount ) }
sprintf(
/* translators: %d: Number of font variants. */
_n(
'%d variant',
'%d variants',
variantsCount
),
variantsCount
) }
</Text>
</FlexItem>
<FlexItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import {
Button,
DropZone,
Expand Down Expand Up @@ -30,11 +30,6 @@ const { ProgressBar } = unlock( componentsPrivateApis );
function UploadFonts() {
const { installFont, notice, setNotice } = useContext( FontLibraryContext );
const [ isUploading, setIsUploading ] = useState( false );
const supportedFormats =
ALLOWED_FILE_EXTENSIONS.slice( 0, -1 )
.map( ( extension ) => `.${ extension }` )
.join( ', ' ) +
` ${ __( 'and' ) } .${ ALLOWED_FILE_EXTENSIONS.slice( -1 ) }`;

const handleDropZone = ( files ) => {
handleFilesUpload( files );
Expand Down Expand Up @@ -199,12 +194,8 @@ function UploadFonts() {
) }
<Spacer margin={ 2 } />
<Text className="font-library-modal__upload-area__text">
{ sprintf(
/* translators: %s: supported font formats: ex: .ttf, .woff and .woff2 */
__(
'Uploaded fonts appear in your library and can be used in your theme. Supported formats: %s.'
),
supportedFormats
{ __(
'Uploaded fonts appear in your library and can be used in your theme. Supported formats: .tff, .otf, .woff, and .woff2.'
) }
</Text>
</VStack>
Expand Down

0 comments on commit 62027aa

Please sign in to comment.