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

WordPress Trac noreply at wordpress.org
Mon Feb 12 17:42:20 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 youknowriad):

 For theme.json we have an i18n's schema that we use to pass the whole
 theme.json file through translation strings.

 More details here https://github.com/WordPress/wordpress-
 develop/blob/4fe09a2df3a3cd8360228051955f66ebf1033374/src/wp-includes
 /class-wp-theme-json-resolver.php#L144-L151

 ---
 That said, if the name, categories and description are the only thing that
 we want to translate, then I agree that we could consider updating the
 `wp_register_font_collection` function from this:


 {{{
 wp_register_font_collection( 'google-fonts',
 'https://s.w.org/images/fonts/17.7/collections/google-fonts-with-
 preview.json' );
 }}}

 To this



 {{{
 wp_register_font_collection( 'google-fonts', array(
   'source' => 'https://s.w.org/images/fonts/17.7/collections/google-fonts-
 with-preview.json',  // or file
   "name" => __( "Google Fonts" ),
   "description" => __( "Install from Google Fonts. Fonts are copied to and
 served from your site." ),
   "categories" => [
                 [
                         "name": __( "Sans Serif" ),
                         "slug": "sans-serif"
                 ]
   ],
 ) );
 }}}

 Now that I think about it more, I think we should update
 `wp_register_font_collection` to accept an array of options as a second
 argument regardless of how we'll do i18n. The reasons for that are:

  - Consistency with most registration APIs in WordPress
  - Possibility to add new options... in the future, where a string
 argument won't allow.

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


More information about the wp-trac mailing list