[wp-trac] [WordPress Trac] #52047: Twenty Twenty-One: Remove untranslatable post type names

WordPress Trac noreply at wordpress.org
Sat Dec 12 15:26:24 UTC 2020


#52047: Twenty Twenty-One: Remove untranslatable post type names
----------------------------+--------------------
 Reporter:  SergeyBiryukov  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  5.6.1
Component:  Bundled Theme   |    Version:
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+--------------------
 Twenty Twenty-One uses these labels for `the_post_navigation()`:
 {{{
 /* translators: %s: The post-type singular name (example: Post, Page,
 etc.) */
 $twentytwentyone_next_label = sprintf( esc_html__( 'Next %s',
 'twentytwentyone' ), $twentytwentyone_post_type_name );
 /* translators: %s: The post-type singular name (example: Post, Page,
 etc.) */
 $twentytwentyone_previous_label = sprintf( esc_html__( 'Previous %s',
 'twentytwentyone' ), $twentytwentyone_post_type_name );
 }}}

 Unfortunately, just inserting a post type name into a generic string like
 `Next %s` is not translatable, hence the need for a
 [https://developer.wordpress.org/reference/functions/get_post_type_labels/
 full array of various labels] provided when registering a post type.

 A general best practice in WordPress is to avoid post type and taxonomy
 names in generic strings due to i18n concerns and structural differences
 in languages. For reference, see:
  * comment:3:ticket:17609
  * comment:1:ticket:19099
  * #26066
  * #37895

 Since "Next post" and "Previous post" strings are often used in themes, it
 seems like adding them to post type labels in a future WordPress version
 would be beneficial.

 For Twenty Twenty-One, I would suggest using "Next post" and "Previous
 post" for now instead of the code above, which is what all previous
 bundled themes did.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52047>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list