You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On live preview mode the result of the method Craft::$app->getLocale() not return the locale of the target entry page url. The method return the locale of the Cp Panel, not the entry site selected.
On our website, we have two site configured with locales (fr-ca, en-ca). The CP is configured with the locale (fr). When we visit the site with the live preview mode button, an error is throw when we valide for a valid site locale (in our case fr-ca pr en-ca). The error us causing by the fact that the locale is set to (fr).
I understand that in the CP panel, the locale used is the locale configured in the user settings. But in live preview, it suppose to use the locale defined in the url ex : http://mysite.com/{locale}/{slug}.
Maybe Craft::$app->getLocale() is not the method needed to be used for getting the locale properly in all case ?
Steps to reproduce
Create two site via CP with two different locale
Create an admin user with another locale defined in the site settings
Create a entry related to any site
Relate the entry section to a template
Dump a call to Craft::$app->getLocale() in the template
Validate that the locale is not in the list of the sites locales
Additional info
We use a module variable that is used in a template for output the locale.
The text was updated successfully, but these errors were encountered:
Description
On live preview mode the result of the method Craft::$app->getLocale() not return the locale of the target entry page url. The method return the locale of the Cp Panel, not the entry site selected.
On our website, we have two site configured with locales (fr-ca, en-ca). The CP is configured with the locale (fr). When we visit the site with the live preview mode button, an error is throw when we valide for a valid site locale (in our case fr-ca pr en-ca). The error us causing by the fact that the locale is set to (fr).
I understand that in the CP panel, the locale used is the locale configured in the user settings. But in live preview, it suppose to use the locale defined in the url ex : http://mysite.com/{locale}/{slug}.
Maybe Craft::$app->getLocale() is not the method needed to be used for getting the locale properly in all case ?
Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: