[wp-trac] [WordPress Trac] #26511: Separate locale for the admin toolbar
WordPress Trac
noreply at wordpress.org
Mon Dec 9 17:39:31 UTC 2013
#26511: Separate locale for the admin toolbar
-----------------------------+------------------------------
Reporter: johnbillion | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: |
-----------------------------+------------------------------
Comment (by nacin):
A locale-switching function would be nice to have.
I think this will be something core will need to look into once we start
having an in-dashboard language chooser, whereby the pack for that
language can be downloaded automatically on selection. At that point, the
next logical step would be to allow a user to choose their dashboard
language independently from the site's locale.
In theory, this is easy to do. (See the Admin in English plugin.) In
practice, it's akin to using the admin in SSL and the frontend using HTTP
— core is surely doing something somewhere that causes whatever happens in
the admin to trickle into the frontend (so, the equivalent of #15928), and
we'll need to figure out those and patch things up.
Anyway, a locale-switching function could be implemented along the lines
of switch_to_blog(). As of right now it'd need to be just two things: a
filter on 'locale' (there's also a $locale global, though YMMV in the
future) followed by a call to load_default_textdomain(). Un-switching is a
matter of unhooking the filter and re-calling load_default_textdomain().
(YMMV due to [https://core.trac.wordpress.org/browser/trunk/src/wp-
admin/includes/admin.php?rev=25001#L9 this]). That's expensive, though.
For core to have this functionality, we should start storing loaded
translations on a per-language basis, so as not to obliterate the object
in memory, to allow for a switch-back when done without re-calling
load_default_textdomain().
--
Ticket URL: <http://core.trac.wordpress.org/ticket/26511#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list