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

Reduce duplication of font library group headings #63532

Merged
merged 4 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
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' )
Copy link
Contributor

Choose a reason for hiding this comment

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

_x requires a string describing the context as the 2nd argument (see https://github.com/WordPress/gutenberg/tree/trunk/packages/i18n#_x).

}
</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' )
}
</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 @@ -172,7 +172,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' )
}
</h2>
{ /*
* Disable reason: The `list` ARIA role is redundant but
Expand Down Expand Up @@ -209,7 +212,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' )
}
</h2>
{ /*
* Disable reason: The `list` ARIA role is redundant but
Expand Down
Loading