View Full Version : autodetect language
05-10-2007, 01:25 PM
I'm using language feature of pixelpost 1.6 and it's fine.
I'm guessing if is there a way to automatically detect if use English or the other language when somebody visits my site.
(reading here and there I think it is not possible now)
How can it be done?
05-10-2007, 03:45 PM
You can detect the browser language, or you have to reverse lookup the ip to get a country.
05-10-2007, 04:21 PM
I think reverse ip lookup may be too heavy.
Should be used JS or PHP.
JS: may be fine because simple and usable in the template but... not so much clean solution.
PHP: using $_SERVER["HTTP_ACCEPT_LANGUAGE"] variable should work, but it must be placed in alt language mechanism (index.php?). (also a grep in $_SERVER["HTTP_USER_AGENT"])
Do you think you'll put this feature in future releases?
05-10-2007, 05:17 PM
I'll can look at it. But what about users like me: english windows/browser, dutch language? The blog will be in English instead of dutch.
JScript in the template won't work (or it should be a redirect to another url).
05-10-2007, 08:44 PM
You're right, in that case it won't work.
The idea is to use english (or main language) for all except alternative language if detected.
Ok, thanks for the talk, I'll try to figure it out too. Although I have firstly to understand the whole mechanism.
05-11-2007, 06:35 AM
I am working with a shop software for customers and I know they did a lot of work on the autmatic language detection and failed.
Obviously there are many browsers which don't send the HTTP_ACCEPT_LANGUAGE or send it wrong. On the other hand it was said that it would slow down things.
You have to do several requests for that: reading out the HTTP_ACCEPT_LANGUAGE, remove the eventual additional subtags down to the pure language tag, look if it matches the alternative language abbreviation of pixelpost setting and then change the language accordingly. Always with the risk of getting some crowded tags or nothing.
Of course it would be nice: My default language in the blog is english since most of my visitors are international. The alternative language is german (because I speak german :-)), and it would be great if german visitors would have the site in german from the beginning.
But in my opinion the cookie based system we have now is a very good and simple alternative.
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.