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

WordPress Trac noreply at wordpress.org
Mon Jan 30 10:26:08 UTC 2023


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

Comment (by swissspidy):

 In [changeset:"55161" 55161]:
 {{{
 #!CommitTicketReference repository="" revision="55161"
 I18N: Introduce `switch_to_user_locale()`.

 This new function makes it easier to switch to a specific user’s locale by
 reducing duplicate code and storing the user’s ID as additional context
 for plugins to consume. Existing usage of `switch_to_locale()` in core has
 been replaced with `switch_to_user_locale()` where appropriate.

 Also, this change ensures `WP_Locale_Switcher` properly filters
 `determine_locale` so that anyyone using the `determine_locale()` function
 will get the correct locale information when switching is in effect.

 Props costdev.
 Fixes #57123.
 See #26511.
 }}}

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


More information about the wp-trac mailing list