Hallo everyone...
I'm building a website in three different languages (English, Italian and German).
Is there any solution (embedded code, snippet, plugin) which can analyze users browser (e.g. country or OS language) and redirect the visitor to the proper version of the website?
I've tried RWML Stack, which is usually great, but in this case the browser takes too much time to render the page and for some seconds all the languages are visible, so I cannot use this solution...
Thanks in advance,
Raffaele
Comments
here is the code: I am going to add instructions on how to use in a moment.
the first step is to have your engilsh site publsih to yourdomin.com/en/
and your other languages to yourdomain.com/sp or .com/fr and so on
then you create a new projcet file who's whole purpose is to redirect the user.
the first page is a simple styled text page and you paste the code into the header/ header section
you then create a redirect page for each language and have it point to the appropriate language site and name it with one of these.
("english.html", "french.html", "spanish.html", "japan.html", "chinese.html")
make sure they are all saved in the root of your site so the root folder would have a index.html, english.hmtl, french.html.... and so on.
and you are done unless you didnt use all the languages listed here. english, french, spanish, japan, chineese.
if you didnt use one of them you must change one line of code.
//Enter corresponding redirect URLs (last one is for default URL):
var langredirects=new Array("english.html", "french.html", "spanish.html", "japan.html", "chinese.html", "english.html")
so lets say you only had a english french and spanish but not the others it would look like this.
//Enter corresponding redirect URLs (last one is for default URL): this would redirect users who you dont have a language for to the default of english
var langredirects=new Array("english.html", "french.html", "spanish.html", "english.html", "english.html", "english.html")
if you have other questions please ask I know it can be confusing.
I'm afraid I need a little more help...
This is the scenario:
Italian version of the website is at http://www.mystyleproperty.com/it/index.php
English version of the website is at http://www.mystyleproperty.com/en/index.php
German version of the website is at http://www.mystyleproperty.com/de/index.php
Now, the root of the website is obviously at http://www.mystyleproperty.com/ndex.php
So, what have I to do in order to have visitor redirected to the proper versions according to their browser language?
It will be a step by step guide.
How can I thank you?
I have made adding this a lot easier. Simply paste this into the header section of your sites landing page. change all of the urls for each language to your site for that language. if you don't have a site for a certain language set that language to the same as your most commonly visited page or the closest language to that one.
where it says [removed] on the top use < SCRIPT L A N G U A G E = " JavaScript 1 . 2 " >
and where it says [removed] on the bottom use [ / script ]
______________________________
[removed] <!-- Begin if (navigator.appName == 'Netscape') var language = navigator.language; else var language = navigator.browserLanguage; /*------------------------------------------------------------- Netscape instructions: In Netscape, find the language you want to redirect by going to Edit Menu --> Preferences... Then click the '+' box next to 'Navigator' and click 'Languages' Click 'Add' then find the languages you want and add them below. --------------------------------------------------------------- Microsoft Internet Explorer instructions: In MSIE, find the language you want to redirect by going to Tools Menu --> Internet Options... Then click the 'Languages' button near the bottom of the page. Click 'Add' then find the languages you want and add them below. -------------------------------------------------------------*/ if (language.indexOf('en') ] -1) document.location.href = 'http://www.example.com/en/english.html'; else if (language.indexOf('nl') ] -1) document.location.href = 'http://www.example.com/nl/dutch.html'; else if (language.indexOf('fr') ] -1) document.location.href = 'http://www.example.com/fr/french.html'; else if (language.indexOf('de') ] -1) document.location.href = 'http://www.example.com/de/german.html'; else if (language.indexOf('ja') ] -1) document.location.href = 'http://www.example.com/ja/japanese.html'; else if (language.indexOf('it') ] -1) document.location.href = 'http://www.example.com/it/italian.html'; else if (language.indexOf('pt') ] -1) document.location.href = 'http://www.example.com/ja/portuguese.html'; else if (language.indexOf('es') ] -1) document.location.href = 'http://www.example.com/ja/spanish.html'; else if (language.indexOf('sv') ] -1) document.location.href = 'http://www.example.com/ja/swedish.html'; else if (language.indexOf('zh') ] -1) document.location.href = 'http://www.example.com/ja/chinese.html'; else document.location.href = 'http://www.example.com/en/english.html'; // End --> [removed] [p][center] [font face="arial, helvetica" size="-2"]Free JavaScripts provided[br] by [a href="http://javascriptsource.com"]The JavaScript Source[/a][/font] [/center][p] <!-- Script Size: 1.95 KB -->