[wp-trac] [WordPress Trac] #26511: Introduce a locale-switching function

WordPress Trac noreply at wordpress.org
Mon Sep 26 18:01:36 UTC 2016


#26511: Introduce a locale-switching function
--------------------------------------+------------------------
 Reporter:  johnbillion               |       Owner:
     Type:  feature request           |      Status:  reviewing
 Priority:  normal                    |   Milestone:  4.7
Component:  I18N                      |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------

Comment (by swissspidy):

 Today I've chatted about this with @ocean90. The easiest way to support
 re-initialization like of post type labels would be to support passing a
 callback function for labels instead of an array — for post types, post
 status and taxonomies. That way, post type labels would always get
 translated again.

 Passing callbacks for the built-in objects would result in plenty of new
 functions added to core just to provide these labels. A class could make
 sense there. As you can see, this would add more complexity and needs some
 more consideration.

 For now, in [attachment:26511.7.diff] I just re-register the built-in post
 types and taxonomies upon changing the locale.

 Alternatively, [attachment:WP_Post_Type_Labels.diff] is a WIP of what I've
 toyed with today. 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.

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


More information about the wp-trac mailing list