Introduce a locale-switching function
|Reported by:||johnbillion||Owned by:|
When a site's content is displayed in a language that's different to that used in the admin area  by using the locale filter in get_locale(), the admin toolbar is shown in the language of the content, not the language of the admin area.
For example, if your content is in French (using fr_FR in the locale filter) but your admin area is in English (using en_US in the locale filter) then the admin toolbar on the front end will display in French rather than English.
The value of get_locale() is used when the translation files are loaded at the beginning of the page load, but there's no easy way to subsequently switch locale and load a different set of translation files later in the page load (ie. when we output the admin toolbar in the footer).
We should introduce a means of changing the locale at any point during the page load and automatically loading in the relevant translation files, overriding existing ones. This could then be used to switch the language before admin-related output on the front end (primarily the admin toolbar, but potentially any admin-related item).
Leaving this as a feature request for now because I don't have a solution in mind.
Change History (22)
- Keywords needs-patch added
- Summary changed from Separate locale for the admin toolbar to Introduce a locale-switching function