Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multilanguage lang tag and JFactory::getDocument() conflict #20157

Closed
ced1870 opened this issue Apr 13, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@ced1870
Copy link

commented Apr 13, 2018

Steps to reproduce the issue

In a multilanguage website, create a system plugin with just that :

public function __construct(&$subject, $config = array()) {
	$doc = JFactory::getDocument();

	parent::__construct($subject, $config);
}

Expected result

Nothing

Actual result

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

System information (as much as possible)

PHP Version 7.1.8
Database Version 5.7.9
Joomla! 3.8.6

Additional comments

@infograf768

This comment has been minimized.

Copy link
Member

commented Apr 13, 2018

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?

@ced1870

This comment has been minimized.

Copy link
Author

commented Apr 13, 2018

if I force the language in the user account, it works

@infograf768

This comment has been minimized.

Copy link
Member

commented Apr 13, 2018

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)

@Bakual

This comment has been minimized.

Copy link
Contributor

commented Apr 13, 2018

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.

@ced1870

This comment has been minimized.

Copy link
Author

commented Apr 13, 2018

yes, tested both with plugin/module activated or not, the html tag is ok when user loggied in with specific language in the profile

@franz-wohlkoenig

This comment has been minimized.

Copy link
Member

commented Apr 13, 2018

@ced1870 if this issue is solved, please close, thanks.

@ced1870 ced1870 closed this Apr 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.