[wp-trac] [WordPress Trac] #60509: Font Collection: Font name and description are not translatable

WordPress Trac noreply at wordpress.org
Thu Feb 15 13:38:19 UTC 2024


#60509: Font Collection: Font name and description are not translatable
--------------------------+---------------------
 Reporter:  wildworks     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  6.5
Component:  Editor        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+---------------------

Comment (by swissspidy):

 @youknowriad  @mmaattiiaass @grantmkin This one needs an owner to shepherd
 a fix during beta. Any volunteers?

 I don't think we really want to put this in version control, so the more
 viable option is to provide a URL _and_ name + description separately.

 To prevent devs from forgetting this and have untranslated strings, I
 suggest to change the function signature for registering fonts as follows:


 {{{
 wp_register_font_collection(
   $slug: string,
   $data: array<{ url?: string, name: string, description?: string,
 font_families?: array, categories?: array}>
 }}}


 So for core it would be:


 {{{
 wp_register_font_collection(
 'google-fonts',
 array(
   'url' => '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.' ),
 ),
 }}}


 But plugins could do:

 {{{
 wp_register_font_collection(
 'google-fonts',
 array(
   'font_families' => [...],
   'categories' => [...],
   'name' => __( '...', 'foo-plugin' ),
   'description' => __( '...', 'foo-plugin' ),
 ),
 }}}

 Definitely want to prevent the `wp_register_font_collection( 'xyz',
 'url...' )` use case with that.

 What do you think?

 -----

 Aside: why is the Gutenberg version in the
 `https://s.w.org/images/fonts/17.7/collections/google-fonts-with-
 preview.json` URL, shouldn't that be the WordPress version?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60509#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list