Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix font library modal dialog translatable strings #58256

Merged
merged 4 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
) }
Comment on lines +61 to +69
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition, thanks.

</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
Loading