[wp-trac] [WordPress Trac] #26511: Introduce a locale-switching function
WordPress Trac
noreply at wordpress.org
Wed Sep 21 17:26:26 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):
> I see, but isn't loading the new text domain also part of switching the
locale?
> Also, "Fires when the locale is switched" isn't accurate right now. If
I'd hook into `switch_locale` and use a function like `is_rtl()` I'd
expect that it returns the data of the new locale. Currently it doesn't.
True. I moved the actions further down now.
> You're saying that this ticket now depends on introducing an interface?
I'm not sure I like that. _If_ there would be an interface in the future
we still can use it even if the name is different.
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()`.
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?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26511#comment:58>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list