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

WordPress Trac noreply at wordpress.org
Sat Sep 3 12:52:42 UTC 2016


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

Comment (by swissspidy):

 [attachment:26511.diff] applies cleanly against trunk again.

 Changes to the previous patch:

 * Actually includes some unit tests to get us started. Not included are
 Multisite-related tests (e.g. `switch_to_blog()` + `switch_to_locale()`)
 and tests with plugin/theme translations.
 * Removes the need for a `WP_Locale_Storage` class. One simple filter is
 enough.
 * Adds `switch_locale` and `restore_locale` action hooks.

 As you can see, this takes into account some of the feedback from #29783.
 This ticket should actually lay the foundation for that one so we can kill
 two birds with one stone

 @SergeyBiryukov: Regarding the `$wp_locale_switcher` global, we could
 change it when #37699 lands or perhaps make it a property of the `WP`
 class.

 There's actually a bunch of i18n globals like `$l10n`, `$l10n_unloaded`,
 `$locale`, `$wp_locale`, `$wp_local_package`. We could combine all of
 these in 1 central `WP_i18n` class (which could also be a property of the
 `WP` class), though that's probably out of scope for this ticket.

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


More information about the wp-trac mailing list