[wp-trac] [WordPress Trac] #26511: Introduce a locale-switching function
WordPress Trac
noreply at wordpress.org
Sat Sep 24 08:43:38 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 ocean90):
Replying to [comment:58 swissspidy]:
> No. I mainly created that ticket to keep discussions off from this one,
but it's good to know where discussion is heading to make this class more
future proof. The only thing I would rename at the moment is
`restore_previous_locale()` to `restore_current_locale()` because of
`restore_current_blog()`.
Not sure if we really have to be consistent with a naming which is
semantically incorrect. But maybe we can provide both functions?
`restore_current_locale()` would empty the stack and set the locale to
`$original_locale`.
> In [attachment:26511.5.diff] I removed the `get_user_locale()` check
(which had no test btw!) and improved the docs as well.
>
> I feel like the `add_filter()` call should be moved outside the
constructor. Any ideas?
Can't we move it to `default-filters.php` as `add_filter( 'locale', array(
$GLOBALS['wp_locale_switcher'], 'filter_locale' );`? Or a simple `init()`
method which gets called in `wp-settings.php`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26511#comment:60>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list