-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Font Library: Ensure name/description are localized #6130
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
This comment was marked as resolved.
This comment was marked as resolved.
Noting that after this PR lands we need to update the font-collection JSON schema: https://github.com/WordPress/gutenberg/blob/trunk/schemas/json/font-collection.json |
Speaking of schema, the code references https://schemas.wp.org/trunk/font-collection.json but that doesn't actually exist yet. |
The schema is present at https://github.com/WordPress/gutenberg/blob/trunk/schemas/json/font-collection.json, but it seems the redirect isn't working correctly for that one. Both block.json and theme.json schemas redirect from schemas.wp.org/* to raw.githubusercontent.com/WordPress/gutenberg/* |
Given how this is evolving, potentially trimming down the collection json file to only contain font_families, I wonder if it makes sense to have font_families as a separate parameter:
|
Personally, I think we should stick with |
So, who can help update the JSON file, the schema, and fix the schema redirect? |
I requested the schema redirect here: https://meta.trac.wordpress.org/ticket/7476#ticket |
OK, so the signature of the function will be like this, right? wp_register_font_collection(
$slug: string,
$data: array<{
name: string,
description?: string,
font_families: array|string,
categories?: array
}> Both of these use cases will be allowed.
$categories = array(
array(
"name" => __( 'Sans Serif' ),
"slug" => "sans-serif"
),
);
wp_register_font_collection(
'google-fonts',
array(
'font_families' => 'https://s.w.org/images/fonts/17.7/collections/google-fonts-with-preview.json',
'name' => __( 'Google Fonts' ),
'description' => __( 'Install from Google Fonts. Fonts are copied to and served from your site.' ),
'categories' => $categories,
)
);
$ubuntu = array(
'fontFamily' => 'Ubuntu, system-ui',
'name' => 'Ubuntu',
'slug' => 'ubuntu',
);
wp_register_font_collection(
'my-collection',
array(
'name' => __( 'My Collection' ),
'description' => __( 'My custom fonts collection.' ),
'categories' => $categories,
'font_families' => [ $ubuntu ],
)
); |
@swissspidy you can find an updated version of the file in this PR: WordPress/google-fonts-to-wordpress-collection#21. To test, these changes, you are able to link the PR version of that JSON file https://raw.githubusercontent.com/WordPress/google-fonts-to-wordpress-collection/e9037d48ec56988dbaa7036186619415ef6761f7/releases/core-6.5.beta/google-fonts-with-preview.json. |
Thanks for the help! The signature
sounds good to me 👍 I just updated the PR accordingly. It uses https://raw.githubusercontent.com/WordPress/google-fonts-to-wordpress-collection/e9037d48ec56988dbaa7036186619415ef6761f7/releases/core-6.5.beta/google-fonts-with-preview.json for testing, but since the data structure is still the same as https://s.w.org/images/fonts/17.7/collections/google-fonts-with-preview.json, just with fewer keys, I should be able to just change it back with no issues. So nicely backward compatible. |
@matiasbenedetto @youknowriad @creativecoder I think this is now ready |
This is testing well on my end. ✔️ Both worked as expected. Thanks, @swissspidy, for working on this. I think it's ready to be merged. |
Once this is committed, let's also make sure to synchronize the Gutenberg plugin properly. Thanks all for addressing this one. |
Committed in https://core.trac.wordpress.org/changeset/57686 |
Porting the changes from this PR to Gutenberg: WordPress/gutenberg#59256 |
* porting changes back from wordpress core PR: WordPress/wordpress-develop#6130 * format php * adding 'gutenberg' translation domain back Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org> Co-authored-by: vcanales <vcanales@git.wordpress.org>
…lection: WordPress/wordpress-develop#6130 (#59314) Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org> Co-authored-by: mikachan <mikachan@git.wordpress.org>
…lection: WordPress/wordpress-develop#6130 (#59314) Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org> Co-authored-by: mikachan <mikachan@git.wordpress.org>
…lection: WordPress/wordpress-develop#6130 (#59314) Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org> Co-authored-by: mikachan <mikachan@git.wordpress.org>
Changes the data format as per the suggestion on the ticket.
In practice not really a fan of using
_doing_it_wrong()
everywhere instead of using proper exceptions, but alas.Trac ticket: https://core.trac.wordpress.org/ticket/60509
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.