From 4d5523aca96263cb808de5cd1af77194b200dc88 Mon Sep 17 00:00:00 2001 From: Sunil Prajapati <61308756+akasunil@users.noreply.github.com> Date: Tue, 16 Jul 2024 19:22:39 +0530 Subject: [PATCH] Reduce duplication of font library group headings (#63532) * Update title in typography panel * Update font list titles in font library modal * used _x with translator comments * Add context for translation of headings Co-authored-by: akasunil Co-authored-by: matiasbenedetto Co-authored-by: creativecoder Co-authored-by: richtabor --- .../src/components/global-styles/font-families.js | 14 +++++++++++--- .../font-library-modal/installed-fonts.js | 12 +++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/font-families.js b/packages/edit-site/src/components/global-styles/font-families.js index 309bd8a9dc81fe..811d4e66b27a0d 100644 --- a/packages/edit-site/src/components/global-styles/font-families.js +++ b/packages/edit-site/src/components/global-styles/font-families.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, _x } from '@wordpress/i18n'; import { __experimentalText as Text, __experimentalItemGroup as ItemGroup, @@ -52,7 +52,12 @@ function FontFamilies() { { themeFonts.length > 0 && ( - { __( 'Theme Fonts' ) } + + { + /* translators: Heading for a list of fonts provided by the theme. */ + _x( 'Theme', 'font source' ) + } + { themeFonts.map( ( font ) => ( 0 && ( - { __( 'Custom fonts' ) } + { + /* translators: Heading for a list of fonts installed by the user. */ + _x( 'Custom', 'font source' ) + } { customFonts.map( ( font ) => ( diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js b/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js index c1e2f12edcb5ed..f3c8d73eef307e 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js @@ -20,7 +20,7 @@ import { import { useEntityRecord, store as coreStore } from '@wordpress/core-data'; import { useSelect } from '@wordpress/data'; import { useContext, useEffect, useState } from '@wordpress/element'; -import { __, sprintf } from '@wordpress/i18n'; +import { __, _x, sprintf } from '@wordpress/i18n'; import { chevronLeft } from '@wordpress/icons'; import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; @@ -176,7 +176,10 @@ function InstalledFonts() { { baseThemeFonts.length > 0 && (

- { __( 'Theme Fonts' ) } + { + /* translators: Heading for a list of fonts provided by the theme. */ + _x( 'Theme', 'font source' ) + }

{ /* * Disable reason: The `list` ARIA role is redundant but @@ -213,7 +216,10 @@ function InstalledFonts() { { baseCustomFonts.length > 0 && (

- { __( 'Custom fonts' ) } + { + /* translators: Heading for a list of fonts installed by the user. */ + _x( 'Custom', 'font source' ) + }

{ /* * Disable reason: The `list` ARIA role is redundant but