[wp-trac] [WordPress Trac] #38218: Introduce a WP_Post_Type_Labels class

WordPress Trac noreply at wordpress.org
Mon Oct 3 09:49:46 UTC 2016


#38218: Introduce a WP_Post_Type_Labels class
-------------------------------+--------------------------------------
 Reporter:  swissspidy         |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:
 Severity:  normal             |   Keywords:  has-patch has-unit-tests
  Focuses:                     |
-------------------------------+--------------------------------------
 This came up while working on #38157 and #26511.

 Moving the logic from `get_post_type_labels()` into its own class would
 greatly benefit the efforts made to switch locales. It essentially
 replaces the post type labels object with a new class that returns the
 labels on the fly (note: includes tests from #38157). The downside is that
 labels are never stored in an array but always translated upon request
 (performance problems?).

 What's needed for just-in-time translation (in addition to the current
 patch) is probably allowing passing a callback instead of an array of
 labels to the function. The same would need to be done for custom
 taxonomies and perhaps post statuses.

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


More information about the wp-trac mailing list