Quote:
Originally Posted by tpearl5
You certainly can't be hurting anything by including an API key.
Here's another question... How about displaying flags based on where the IP is from? I understand this would involve a small index of IP's, but perhaps it could be an exclusion. For example, 'if not from US, display flags'
edit - nevermind - that would be a very large index either way that would have to be referenced on every visit, which sounds very expensive
|
Nah its actually very easy to do. I have an ip database on my site which performs a similar function.
I would recommend using javascript instead to read the browser language.
Code:
var nav_lng="nolang"; //default language string
if(navigator.language)nav_lng=navigator.language;
else if(navigator.browserLanguage)nav_lng=navigator.browserLanguage;
else if(navigator.userLanguage)nav_lng=navigator.userLanguage;
else if(navigator.systemLanguage)nav_lng=navigator.systemLanguage;
else if(window.navigator.language)nav_lng=window.navigator.language;
for example, for english visitors the nav_lng variable will then contain either en-US or en-GB(for users from the UK or AU)
I actually have dynamic javascript translation going on as well right now using this and it works fine.