-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
When changing locale for an admin user with the site in 'production' mode, the admin Breaks.
to Recreate:
I have store views configured for en_GB and en_US, site set to production and all static content generated. Admin user selects a different locale from the list under user preferences, e.g. fr_FR
The user is allowed the freedom to select any locale and this influences the path to the static resources (js/css etc). Under development mode the static.php handles the requests, fetches and caches the requested files, however in production they return 404s owing to:
/* Magento\Framework\App\StaticResource */
public function launch()
{
// disabling profiling when retrieving static resource
\Magento\Framework\Profiler::reset();
$appMode = $this->state->getMode();
if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) {
$this->response->setHttpResponseCode(404);
} else {
...The only solution currently would be to pre-generate static content for all 82 locales as the admin user could choose any one of them. (extreme maybe, but you get my point?)
I appreciate that PHP should not be used to serve static content in production, but this tight relationship between locale and theme with the current configuration makes it almost impossible to rely upon anything else. I do not want to serve JS/CSS etc with static.php and certainly don't want to run in developer mode.
I do not understand why all content has to be replicated for all locales under the current static content system. Having this locale variable for all content is surely overkill and needs to be rethought. JS and CSS and agnostic of locale for the most part, Jquery is the same in french,german,english or any other language and locale.