From 7c56186df56878724dce49ba34a8891f168803aa Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Thu, 27 Jul 2023 16:05:05 +0100 Subject: [PATCH 01/17] Sets translated strings for the script 'create-block-theme-app' --- admin/class-react-app.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/class-react-app.php b/admin/class-react-app.php index c6ebdc1f..c7747469 100644 --- a/admin/class-react-app.php +++ b/admin/class-react-app.php @@ -18,6 +18,9 @@ public static function bootstrap() { array_push( $asset_file['dependencies'], 'wp-i18n' ); wp_enqueue_script( 'create-block-theme-app', plugins_url( 'build/index.js', __DIR__ ), $asset_file['dependencies'], $asset_file['version'] ); + // Sets translated strings for the script. + wp_set_script_translations( 'create-block-theme-app', 'create-block-theme' ); + // Set google fonts json file url. wp_localize_script( 'create-block-theme-app', From 13e6d00173a82eafab6a871d662bd5f362752761 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Thu, 27 Jul 2023 16:03:39 +0100 Subject: [PATCH 02/17] Use proper sprintf on %d Variants --- src/fonts-sidebar/index.js | 57 ++++++++++++++++++++------------- src/manage-fonts/font-family.js | 22 ++++++++----- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/src/fonts-sidebar/index.js b/src/fonts-sidebar/index.js index 3f544088..ae2e5e00 100644 --- a/src/fonts-sidebar/index.js +++ b/src/fonts-sidebar/index.js @@ -88,23 +88,31 @@ function FontsSidebar( { key ].faces.length && ( <> - ({ ' ' } - { - fontsOutline[ - key - ].faces - .length - }{ ' ' } - { _n( - 'Variant', - 'Variants', - fontsOutline[ - key - ].faces - .length, - 'create-block-theme' - ) }{ ' ' } - ) + { sprintf( + // translators: %s: Variants information. + __( + '( %s )', + 'create-block-theme' + ), + sprintf( + // translators: %d: Number of variants. + _n( + '%d Variant', + '%d Variants', + fontsOutline[ + key + ] + .faces + .length, + 'create-block-theme' + ), + fontsOutline[ + key + ] + .faces + .length + ) + ) } ) } @@ -171,12 +179,15 @@ function FontsSidebar( {
- { variantsCount }{ ' ' } - { _n( - 'Variant', - 'Variants', - variantsCount, - 'create-block-theme' + { sprintf( + // translators: %d: Number of variants. + _n( + '%d Variant', + '%d Variants', + variantsCount, + 'create-block-theme' + ), + variantsCount ) }
{ totalSize }
diff --git a/src/manage-fonts/font-family.js b/src/manage-fonts/font-family.js index c16bf386..a03840de 100644 --- a/src/manage-fonts/font-family.js +++ b/src/manage-fonts/font-family.js @@ -36,14 +36,20 @@ function FontFamily( { fontFamily, deleteFont } ) { { hasFontFaces && ( { ' ' } - ( { fontFamily.fontFace.length }{ ' ' } - { _n( - 'Variant', - 'Variants', - fontFamily.fontFace.length, - 'create-block-theme' - ) }{ ' ' } - ) + { sprintf( + // translators: %s: Variants information. + __( '( %s )', 'create-block-theme' ), + sprintf( + // translators: %d: Number of variants. + _n( + '%d Variant', + '%d Variants', + fontFamily.fontFace.length, + 'create-block-theme' + ), + fontFamily.fontFace.length + ) + ) } ) }
From 6434cb5e9c93e14018aeee1be00fd96c785915a1 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Thu, 27 Jul 2023 16:09:05 +0100 Subject: [PATCH 03/17] Add missing gettext to UI string --- src/demo-text-input/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/demo-text-input/index.js b/src/demo-text-input/index.js index a97f4543..b48ac5a7 100644 --- a/src/demo-text-input/index.js +++ b/src/demo-text-input/index.js @@ -45,7 +45,7 @@ function DemoTextInput( { axes, setAxes, resetAxes } ) { From dc43e5cc09507ba93260b2a4eae89675b9e4a5c7 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Thu, 27 Jul 2023 16:09:20 +0100 Subject: [PATCH 04/17] Fix placeholder string --- src/local-fonts/upload-font-form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/local-fonts/upload-font-form.js b/src/local-fonts/upload-font-form.js index 92521169..9a3c5517 100644 --- a/src/local-fonts/upload-font-form.js +++ b/src/local-fonts/upload-font-form.js @@ -180,7 +180,7 @@ function UploadFontForm( { name="font-weight" id="font-weight" placeholder={ __( - 'Font weight:', + 'Font weight', 'create-block-theme' ) } value={ formData.weight || '' } From 8620ea50e1817c3b45391c3564b745bdf010b43b Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Thu, 27 Jul 2023 16:25:45 +0100 Subject: [PATCH 05/17] Update i18n --- src/manage-fonts/font-family.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage-fonts/font-family.js b/src/manage-fonts/font-family.js index a03840de..3d0e2abb 100644 --- a/src/manage-fonts/font-family.js +++ b/src/manage-fonts/font-family.js @@ -2,8 +2,8 @@ import { useContext } from '@wordpress/element'; import { Button, Icon } from '@wordpress/components'; import FontFace from './font-face'; import { ManageFontsContext } from '../fonts-context'; +import { __, _n } from '@wordpress/i18n'; -const { __, _n } = wp.i18n; function FontFamily( { fontFamily, deleteFont } ) { const { familiesOpen, handleToggleFamily } = useContext( ManageFontsContext ); From 816af3952e521a90a9c7e0552998622d0019d80f Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 10:28:08 +0100 Subject: [PATCH 06/17] Update comment according to upstream. --- admin/class-react-app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-react-app.php b/admin/class-react-app.php index c7747469..c847ea89 100644 --- a/admin/class-react-app.php +++ b/admin/class-react-app.php @@ -18,7 +18,7 @@ public static function bootstrap() { array_push( $asset_file['dependencies'], 'wp-i18n' ); wp_enqueue_script( 'create-block-theme-app', plugins_url( 'build/index.js', __DIR__ ), $asset_file['dependencies'], $asset_file['version'] ); - // Sets translated strings for the script. + // Enable localization in the app. wp_set_script_translations( 'create-block-theme-app', 'create-block-theme' ); // Set google fonts json file url. From 86fe832a4777e16d86b5a7e9b555fa401803d3f6 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 10:25:18 +0100 Subject: [PATCH 07/17] Fix assets path --- admin/create-theme/theme-form.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/create-theme/theme-form.php b/admin/create-theme/theme-form.php index e9f12d96..c7661eb6 100644 --- a/admin/create-theme/theme-form.php +++ b/admin/create-theme/theme-form.php @@ -223,7 +223,7 @@ public static function create_admin_form_page() { } public static function form_script() { - wp_enqueue_script( 'form-script', plugin_dir_url( dirname( __FILE__ ) ) . '/js/form-script.js' ); - wp_enqueue_style( 'form-style', plugin_dir_url( dirname( __FILE__ ) ) . '/css/form.css' ); + wp_enqueue_script( 'form-script', plugin_dir_url( dirname( __FILE__ ) ) . 'js/form-script.js' ); + wp_enqueue_style( 'form-style', plugin_dir_url( dirname( __FILE__ ) ) . 'css/form.css' ); } } From 5609330808fc6faeeb8ec8514333c5ad3a2bc7b9 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 12:09:31 +0100 Subject: [PATCH 08/17] Enable localization in the plugin sidebar --- admin/class-create-theme.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/class-create-theme.php b/admin/class-create-theme.php index b8907b79..7a7c3d1b 100644 --- a/admin/class-create-theme.php +++ b/admin/class-create-theme.php @@ -50,6 +50,9 @@ function create_block_theme_enqueue() { wp_enqueue_script( 'create-block-theme-slot-fill', ); + + // Enable localization in the plugin sidebar. + wp_set_script_translations( 'create-block-theme-slot-fill', 'create-block-theme' ); } function create_admin_menu() { From b9498c7f08e95b4823f4909bf9a5bf7748b77e45 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 12:09:47 +0100 Subject: [PATCH 09/17] Enable localization in the form --- admin/create-theme/theme-form.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/create-theme/theme-form.php b/admin/create-theme/theme-form.php index c7661eb6..ff137950 100644 --- a/admin/create-theme/theme-form.php +++ b/admin/create-theme/theme-form.php @@ -225,5 +225,8 @@ public static function create_admin_form_page() { public static function form_script() { wp_enqueue_script( 'form-script', plugin_dir_url( dirname( __FILE__ ) ) . 'js/form-script.js' ); wp_enqueue_style( 'form-style', plugin_dir_url( dirname( __FILE__ ) ) . 'css/form.css' ); + + // Enable localization in the form. + wp_set_script_translations( 'form-script', 'create-block-theme' ); } } From a5da0b83dae947e2287d08a5f75f4de3101da191 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 12:10:52 +0100 Subject: [PATCH 10/17] Add missing text domains to the plugin sidebar --- src/plugin-sidebar.js | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/plugin-sidebar.js b/src/plugin-sidebar.js index 1fb0fac5..2898291c 100644 --- a/src/plugin-sidebar.js +++ b/src/plugin-sidebar.js @@ -1,6 +1,6 @@ import { registerPlugin } from '@wordpress/plugins'; import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-site'; -import { __ } from '@wordpress/i18n'; +import { __, _x } from '@wordpress/i18n'; import apiFetch from '@wordpress/api-fetch'; import { downloadFile } from './utils'; import { useDispatch } from '@wordpress/data'; @@ -88,7 +88,8 @@ const CreateBlockThemePlugin = () => { error.message && error.code !== 'unknown_error' ? error.message : __( - 'An error occurred while attempting to export the theme.' + 'An error occurred while attempting to export the theme.', + 'create-block-theme' ); createErrorNotice( errorMessage, { type: 'snackbar' } ); } @@ -102,12 +103,20 @@ const CreateBlockThemePlugin = () => { target="create-block-theme-sidebar" icon={ tool } > - { __( 'Create Block Theme' ) } + { _x( + 'Create Block Theme', + 'UI String', + 'create-block-theme' + ) } @@ -117,7 +126,10 @@ const CreateBlockThemePlugin = () => { icon={ archive } onClick={ handleSaveClick } > - { __( 'Save Changes' ) } + { __( + 'Save Changes', + 'create-block-theme' + ) } { __( @@ -130,7 +142,7 @@ const CreateBlockThemePlugin = () => { icon={ download } onClick={ handleExportClick } > - { __( 'Export Zip' ) } + { __( 'Export Zip', 'create-block-theme' ) } { __( @@ -143,7 +155,10 @@ const CreateBlockThemePlugin = () => { - { __( 'Theme Info' ) } + { __( + 'Theme Info', + 'create-block-theme' + ) } @@ -159,7 +174,10 @@ const CreateBlockThemePlugin = () => { - { __( 'Create Theme' ) } + { __( + 'Create Theme', + 'create-block-theme' + ) } From ab0d385d814f708e42d0d6b7744172d2b1844d86 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 12:11:39 +0100 Subject: [PATCH 11/17] Fix loading of 'Remove' l10n --- src/manage-fonts/font-face.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage-fonts/font-face.js b/src/manage-fonts/font-face.js index 4a62cb50..4ff747e4 100644 --- a/src/manage-fonts/font-face.js +++ b/src/manage-fonts/font-face.js @@ -1,6 +1,6 @@ import { Button } from '@wordpress/components'; import Demo from '../demo-text-input/demo'; -const { __ } = wp.i18n; +import { __ } from '@wordpress/i18n'; function FontFace( { face, deleteFont, shouldBeRemoved, isFamilyOpen } ) { const demoStyles = { From dc95b6de941944cedfe4a31d22665c7d6c304cd0 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 16:16:59 +0100 Subject: [PATCH 12/17] Localize Font Styles --- src/fonts-sidebar/index.js | 5 ++++- src/google-fonts/font-variant.js | 5 ++++- src/local-fonts/upload-font-form.js | 9 +++++++-- src/manage-fonts/confirm-delete-modal.js | 3 ++- src/manage-fonts/font-face.js | 3 ++- src/utils.js | 10 ++++++++++ 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/fonts-sidebar/index.js b/src/fonts-sidebar/index.js index ae2e5e00..3d829e4f 100644 --- a/src/fonts-sidebar/index.js +++ b/src/fonts-sidebar/index.js @@ -4,6 +4,7 @@ import { bytesToSize } from '../utils'; import './fonts-sidebar.css'; import { Button } from '@wordpress/components'; import { trash } from '@wordpress/icons'; +import { getFontStyleLocalized } from '../utils'; function FontsSidebar( { title, @@ -138,7 +139,9 @@ function FontsSidebar( { >
{ face.weight }{ ' ' } - { face.style } + { getFontStyleLocalized( + face.style + ) }
{ getFileSize( diff --git a/src/google-fonts/font-variant.js b/src/google-fonts/font-variant.js index b102863c..43726d03 100644 --- a/src/google-fonts/font-variant.js +++ b/src/google-fonts/font-variant.js @@ -1,5 +1,6 @@ import { useEffect } from '@wordpress/element'; import Demo from '../demo-text-input/demo'; +import { getFontStyleLocalized } from '../utils'; function FontVariant( { font, variant, isSelected, handleToggle } ) { const style = variant.includes( 'italic' ) ? 'italic' : 'normal'; @@ -51,7 +52,9 @@ function FontVariant( { font, variant, isSelected, handleToggle } ) { - +
diff --git a/src/manage-fonts/confirm-delete-modal.js b/src/manage-fonts/confirm-delete-modal.js index 5311661f..625b5dd6 100644 --- a/src/manage-fonts/confirm-delete-modal.js +++ b/src/manage-fonts/confirm-delete-modal.js @@ -3,6 +3,7 @@ import { __experimentalConfirmDialog as ConfirmDialog, } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; +import { getFontStyleLocalized } from '../utils'; function ConfirmDeleteModal( { isOpen, onConfirm, onCancel, fontToDelete } ) { const deleteFontFaceMessage = sprintf( @@ -12,7 +13,7 @@ function ConfirmDeleteModal( { isOpen, onConfirm, onCancel, fontToDelete } ) { 'create-block-theme' ), fontToDelete?.weight, - fontToDelete?.style, + getFontStyleLocalized( fontToDelete?.style ), fontToDelete?.fontFamily ); diff --git a/src/manage-fonts/font-face.js b/src/manage-fonts/font-face.js index 4ff747e4..b4375774 100644 --- a/src/manage-fonts/font-face.js +++ b/src/manage-fonts/font-face.js @@ -1,6 +1,7 @@ import { Button } from '@wordpress/components'; import Demo from '../demo-text-input/demo'; import { __ } from '@wordpress/i18n'; +import { getFontStyleLocalized } from '../utils'; function FontFace( { face, deleteFont, shouldBeRemoved, isFamilyOpen } ) { const demoStyles = { @@ -21,7 +22,7 @@ function FontFace( { face, deleteFont, shouldBeRemoved, isFamilyOpen } ) { return ( - { face.fontStyle } + { getFontStyleLocalized( face.fontStyle ) } { face.fontWeight } diff --git a/src/utils.js b/src/utils.js index 6a7b338f..5d09867e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,3 +1,5 @@ +import { __, _x } from '@wordpress/i18n'; + export function getStyleFromGoogleVariant( variant ) { return variant.includes( 'italic' ) ? 'italic' : 'normal'; } @@ -21,6 +23,14 @@ export function getGoogleVariantFromStyleAndWeight( style, weight ) { return weight + style; } +export function getFontStyleLocalized( style ) { + const styles = { + normal: _x( 'Normal', 'Font style', 'create-block-theme' ), + italic: _x( 'Italic', 'Font style', 'create-block-theme' ), + }; + return styles[ style ] !== undefined ? styles[ style ] : style; +} + export function forceHttps( url ) { return url.replace( 'http://', 'https://' ); } From 79d97920608e43dad3f649572eb33689817ec06d Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 16:17:18 +0100 Subject: [PATCH 13/17] Add missing text domain --- src/editor-sidebar/update-panel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor-sidebar/update-panel.js b/src/editor-sidebar/update-panel.js index e13e4219..d66a9bb5 100644 --- a/src/editor-sidebar/update-panel.js +++ b/src/editor-sidebar/update-panel.js @@ -204,7 +204,7 @@ export const UpdateThemePanel = () => { ) }
- { __( 'Read more.' ) } + { __( 'Read more.', 'create-block-theme' ) } } From 8df37ed06f8d0a7a38d289953d8a989ab92157f8 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 16:17:37 +0100 Subject: [PATCH 14/17] Add missing gettext wrapper --- src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 5d09867e..844ba0e7 100644 --- a/src/utils.js +++ b/src/utils.js @@ -37,7 +37,7 @@ export function forceHttps( url ) { export function bytesToSize( bytes ) { const sizes = [ 'Bytes', 'KB', 'MB', 'GB', 'TB' ]; - if ( bytes === 0 ) return 'n/a'; + if ( bytes === 0 ) return __( 'n/a', 'create-block-theme' ); const i = parseInt( Math.floor( Math.log( bytes ) / Math.log( 1024 ) ) ); if ( i === 0 ) return bytes + ' ' + sizes[ i ]; return ( bytes / Math.pow( 1024, i ) ).toFixed( 1 ) + ' ' + sizes[ i ]; From f58644e545693bb7e142442e6ca6ce107e4a18c9 Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Fri, 28 Jul 2023 16:34:31 +0100 Subject: [PATCH 15/17] Remove duplicated import --- src/fonts-sidebar/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fonts-sidebar/index.js b/src/fonts-sidebar/index.js index 3d829e4f..95670735 100644 --- a/src/fonts-sidebar/index.js +++ b/src/fonts-sidebar/index.js @@ -1,10 +1,9 @@ import { _n } from '@wordpress/i18n'; import { useEffect, useState } from '@wordpress/element'; -import { bytesToSize } from '../utils'; +import { bytesToSize, getFontStyleLocalized } from '../utils'; import './fonts-sidebar.css'; import { Button } from '@wordpress/components'; import { trash } from '@wordpress/icons'; -import { getFontStyleLocalized } from '../utils'; function FontsSidebar( { title, From e0d00b946189c452dc957f584c67557c6fee1dcd Mon Sep 17 00:00:00 2001 From: Vicente Canales Date: Fri, 28 Jul 2023 12:38:50 -0400 Subject: [PATCH 16/17] Rename getFontStyleLocalized to localizeFontStyles --- src/fonts-sidebar/index.js | 4 ++-- src/google-fonts/font-variant.js | 4 ++-- src/local-fonts/upload-font-form.js | 6 +++--- src/manage-fonts/confirm-delete-modal.js | 4 ++-- src/manage-fonts/font-face.js | 4 ++-- src/utils.js | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/fonts-sidebar/index.js b/src/fonts-sidebar/index.js index 95670735..03693a41 100644 --- a/src/fonts-sidebar/index.js +++ b/src/fonts-sidebar/index.js @@ -1,6 +1,6 @@ import { _n } from '@wordpress/i18n'; import { useEffect, useState } from '@wordpress/element'; -import { bytesToSize, getFontStyleLocalized } from '../utils'; +import { bytesToSize, locallizeFontStyles } from '../utils'; import './fonts-sidebar.css'; import { Button } from '@wordpress/components'; import { trash } from '@wordpress/icons'; @@ -138,7 +138,7 @@ function FontsSidebar( { >
{ face.weight }{ ' ' } - { getFontStyleLocalized( + { locallizeFontStyles( face.style ) }
diff --git a/src/google-fonts/font-variant.js b/src/google-fonts/font-variant.js index 43726d03..6d410435 100644 --- a/src/google-fonts/font-variant.js +++ b/src/google-fonts/font-variant.js @@ -1,6 +1,6 @@ import { useEffect } from '@wordpress/element'; import Demo from '../demo-text-input/demo'; -import { getFontStyleLocalized } from '../utils'; +import { locallizeFontStyles } from '../utils'; function FontVariant( { font, variant, isSelected, handleToggle } ) { const style = variant.includes( 'italic' ) ? 'italic' : 'normal'; @@ -53,7 +53,7 @@ function FontVariant( { font, variant, isSelected, handleToggle } ) { diff --git a/src/local-fonts/upload-font-form.js b/src/local-fonts/upload-font-form.js index 73a50233..230cbf57 100644 --- a/src/local-fonts/upload-font-form.js +++ b/src/local-fonts/upload-font-form.js @@ -7,7 +7,7 @@ import { import { Font } from 'lib-font'; import { __ } from '@wordpress/i18n'; import { variableAxesToCss } from '../demo-text-input/utils'; -import { getFontStyleLocalized } from '../utils'; +import { locallizeFontStyles } from '../utils'; function UploadFontForm( { formData, @@ -170,10 +170,10 @@ function UploadFontForm( { } > diff --git a/src/manage-fonts/confirm-delete-modal.js b/src/manage-fonts/confirm-delete-modal.js index 625b5dd6..263965f2 100644 --- a/src/manage-fonts/confirm-delete-modal.js +++ b/src/manage-fonts/confirm-delete-modal.js @@ -3,7 +3,7 @@ import { __experimentalConfirmDialog as ConfirmDialog, } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; -import { getFontStyleLocalized } from '../utils'; +import { locallizeFontStyles } from '../utils'; function ConfirmDeleteModal( { isOpen, onConfirm, onCancel, fontToDelete } ) { const deleteFontFaceMessage = sprintf( @@ -13,7 +13,7 @@ function ConfirmDeleteModal( { isOpen, onConfirm, onCancel, fontToDelete } ) { 'create-block-theme' ), fontToDelete?.weight, - getFontStyleLocalized( fontToDelete?.style ), + locallizeFontStyles( fontToDelete?.style ), fontToDelete?.fontFamily ); diff --git a/src/manage-fonts/font-face.js b/src/manage-fonts/font-face.js index b4375774..14fcedd9 100644 --- a/src/manage-fonts/font-face.js +++ b/src/manage-fonts/font-face.js @@ -1,7 +1,7 @@ import { Button } from '@wordpress/components'; import Demo from '../demo-text-input/demo'; import { __ } from '@wordpress/i18n'; -import { getFontStyleLocalized } from '../utils'; +import { locallizeFontStyles } from '../utils'; function FontFace( { face, deleteFont, shouldBeRemoved, isFamilyOpen } ) { const demoStyles = { @@ -22,7 +22,7 @@ function FontFace( { face, deleteFont, shouldBeRemoved, isFamilyOpen } ) { return ( - { getFontStyleLocalized( face.fontStyle ) } + { locallizeFontStyles( face.fontStyle ) } { face.fontWeight } diff --git a/src/utils.js b/src/utils.js index 844ba0e7..111388ac 100644 --- a/src/utils.js +++ b/src/utils.js @@ -23,7 +23,7 @@ export function getGoogleVariantFromStyleAndWeight( style, weight ) { return weight + style; } -export function getFontStyleLocalized( style ) { +export function locallizeFontStyles( style ) { const styles = { normal: _x( 'Normal', 'Font style', 'create-block-theme' ), italic: _x( 'Italic', 'Font style', 'create-block-theme' ), From 79b218ad734e2826a833e3448c2a36f60ac96841 Mon Sep 17 00:00:00 2001 From: Vicente Canales Date: Fri, 28 Jul 2023 12:40:11 -0400 Subject: [PATCH 17/17] Fix typo --- src/fonts-sidebar/index.js | 4 ++-- src/google-fonts/font-variant.js | 6 ++---- src/local-fonts/upload-font-form.js | 6 +++--- src/manage-fonts/confirm-delete-modal.js | 4 ++-- src/manage-fonts/font-face.js | 4 ++-- src/utils.js | 2 +- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/fonts-sidebar/index.js b/src/fonts-sidebar/index.js index 03693a41..961ef9e1 100644 --- a/src/fonts-sidebar/index.js +++ b/src/fonts-sidebar/index.js @@ -1,6 +1,6 @@ import { _n } from '@wordpress/i18n'; import { useEffect, useState } from '@wordpress/element'; -import { bytesToSize, locallizeFontStyles } from '../utils'; +import { bytesToSize, localizeFontStyle } from '../utils'; import './fonts-sidebar.css'; import { Button } from '@wordpress/components'; import { trash } from '@wordpress/icons'; @@ -138,7 +138,7 @@ function FontsSidebar( { >
{ face.weight }{ ' ' } - { locallizeFontStyles( + { localizeFontStyle( face.style ) }
diff --git a/src/google-fonts/font-variant.js b/src/google-fonts/font-variant.js index 6d410435..d6d0c5a1 100644 --- a/src/google-fonts/font-variant.js +++ b/src/google-fonts/font-variant.js @@ -1,6 +1,6 @@ import { useEffect } from '@wordpress/element'; import Demo from '../demo-text-input/demo'; -import { locallizeFontStyles } from '../utils'; +import { localizeFontStyle } from '../utils'; function FontVariant( { font, variant, isSelected, handleToggle } ) { const style = variant.includes( 'italic' ) ? 'italic' : 'normal'; @@ -52,9 +52,7 @@ function FontVariant( { font, variant, isSelected, handleToggle } ) { - +