In a multilanguage website, create a system plugin with just that :
public function __construct(&$subject, $config = array()) {
$doc = JFactory::getDocument();
parent::__construct($subject, $config);
}
Nothing
the lang html attribute does not update to the current language, still remains on the default language
instead of (for a french based website) when switching on the english language
PHP Version 7.1.8
Database Version 5.7.9
Joomla! 3.8.6
if I force the language in the user account, it works
therefore, you mean Even when the site is NOT a full multilingual site ? (In the sense of using the language filter system plugin and switcher module)
You shouldn't fetch the document in the plugin constructor. That's the issue. With that, you force a document creation prior to when the CMS actually would do it.
That is because the (system) plugin classes actually get loaded very early in the request cycle.
Move that code to the plugin event where you actually use it, and then it will work fine.
yes, tested both with plugin/module activated or not, the html tag is ok when user loggied in with specific language in the profile
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-04-13 11:58:35 |
Closed_By | ⇒ | ced1870 |
question: can you reproduce this when multiple languages are installed, multilingual is not implemented, but some registered users have chosen another site UI language than the default site one?