Skip to content

Commit

Permalink
Reduce duplication of font library group headings (WordPress#63532)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: matiasbenedetto <[email protected]>
Co-authored-by: creativecoder <[email protected]>
Co-authored-by: richtabor <[email protected]>
  • Loading branch information
5 people authored and carstingaxion committed Jul 18, 2024
1 parent 1454f0f commit d1843d9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
14 changes: 11 additions & 3 deletions packages/edit-site/src/components/global-styles/font-families.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';
import {
__experimentalText as Text,
__experimentalItemGroup as ItemGroup,
Expand Down Expand Up @@ -52,7 +52,12 @@ function FontFamilies() {
<VStack spacing={ 4 }>
{ themeFonts.length > 0 && (
<VStack>
<Subtitle level={ 3 }>{ __( 'Theme Fonts' ) }</Subtitle>
<Subtitle level={ 3 }>
{
/* translators: Heading for a list of fonts provided by the theme. */
_x( 'Theme', 'font source' )
}
</Subtitle>
<ItemGroup isBordered isSeparated>
{ themeFonts.map( ( font ) => (
<FontFamilyItem
Expand All @@ -66,7 +71,10 @@ function FontFamilies() {
{ customFonts.length > 0 && (
<VStack>
<Subtitle level={ 3 }>
{ __( 'Custom fonts' ) }
{
/* translators: Heading for a list of fonts installed by the user. */
_x( 'Custom', 'font source' )
}
</Subtitle>
<ItemGroup isBordered isSeparated>
{ customFonts.map( ( font ) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -176,7 +176,10 @@ function InstalledFonts() {
{ baseThemeFonts.length > 0 && (
<VStack>
<h2 className="font-library-modal__fonts-title">
{ __( 'Theme Fonts' ) }
{
/* translators: Heading for a list of fonts provided by the theme. */
_x( 'Theme', 'font source' )
}
</h2>
{ /*
* Disable reason: The `list` ARIA role is redundant but
Expand Down Expand Up @@ -213,7 +216,10 @@ function InstalledFonts() {
{ baseCustomFonts.length > 0 && (
<VStack>
<h2 className="font-library-modal__fonts-title">
{ __( 'Custom fonts' ) }
{
/* translators: Heading for a list of fonts installed by the user. */
_x( 'Custom', 'font source' )
}
</h2>
{ /*
* Disable reason: The `list` ARIA role is redundant but
Expand Down

0 comments on commit d1843d9

Please sign in to comment.