-
Notifications
You must be signed in to change notification settings - Fork 110
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
Language autodetection in all urls #875
Comments
That's a good question. I don't know why there is this condition. There must have been good historical reasons. Maybe the fear was that you would get different language results depending on the URL you are requesting, which could make the language switch too often, but i don't think this would create some infinite redirections. Maybe we can enable for all paths as you suggest and see what happens. It wouldn't be hard to revert in any case. |
The underlying function we use is this: https://php.uz/manual/en/function.http-negotiate-language.php I don't think this is related to the current URL at all but only to the browser settings. Maybe there was a concern about performance. Having the check on the home page made it more explicit and restricted. If we remove the path check, this code would be run on every URL request for the front side. But would that be a problem? I don't think so. |
In the original qTranslate (before qTranslate-X), this check didn't exist. The change was done in 2015 in pre-release 3.2.8 but i can't find any explanation yet about this change... Here is the commit introducing this check: |
I just pushed a fix to master. We can experiment a bit here before next release. I keep the ticket open until then. |
Thanks @herrvigg!! I plan to test it next week. The only issue we've detected having this logic enabled in all pages is that in W3TC we needed to check late init in page cache. That makes qTranslate execute language auto detect prior to W3TC page cache logic. |
What does this mean? How do you do that? I used W3TC a long time ago but finally removed it, i found it to be slow and creating more problems more than it solves. |
Released in 3.9.1. |
Hello,
First of all, thanks for going on with this development. I currently work with qTranslate-x in a WordPress Multisite and I would like to discuss something we've been doing for years, language autodetection in all urls.
We commented the condition related to being at the home page (qtranslate_core.php):
And then we handled the url translation (we are using also qtranslate-slug) in the filter qtranslate_language_detect_redirect. It's been working in 800 sites for years, with not knwown problem.
Maybe there is a better approach to what I'm doing. At least, I would like to know if you are open to add an option to switch on/off the home condition. With that, I won't need to comment that line of code.
Thanks!
The text was updated successfully, but these errors were encountered: