~timo-jyrinki/ubuntu-online-tour/fix_1019025

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<head>
</head>

<body>
<script type="text/javascript">
    function redirectpage(dest){
      if (window.location.replace)
        window.location.replace(dest)
      else
        window.location=dest
    }

    var languageinfo=navigator.language ? navigator.language :
    navigator.userLanguage
    console.log(languageinfo.substr(0,2));
    if (languageinfo.substr(0,2)=="zh") {
      redirectpage("zh-CN/index.html");
	} 
    else {
      languages=new Array("ar", "az", "ca", "cs", "de", "el", "eo", "es", "fa", "fi", "fo", "fr", "gl", "gu", "he", "hu", "id", "it", "ja", "lt", "ms", "my", "nb", "nl", "pt", "ro", "ru", "sl", "sr", "sv", "te", "ub", "uk", "uz")
      var found=0
      for (var i=0; i<languages.length; i++) {
        if (languageinfo.substr(0,2)==languages[i]  ) {
          redirectpage(languages[i] + "/index.html");
          found=1
        }
      }
      if (found == 0) {
        redirectpage("en/index.html");
      }
    }
</script>
</body>
</html>