Results 1 to 2 of 2

Thread: International Coding

  1. #1
    Join Date
    Dec 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default International Coding

    I learned of this forum while studying the code for a website that comes in a couple "flavors" -- english and russian. See: www.dolcevitacrimea.com

    I find that it is common on international sites for the user/client to have to select his native language through a button selection. The website I noted above is an example.

    Is there no way to automate this process -- detect the native language for the web browser or system, and then load the appropriate text tables or resource files? It seems like there should be some script to handle this. I know that Java has a system resource class, but I would like to steer away from java and javascript if possible. Any thoughts?

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Put this in the <head> section of your index.htm file (keep that file blank other than the HTML essentials)

    Code:
    <SCRIPT language="javascript">
    language=navigator.language;
    if(language){language=language.substring(0,2);}
    else{language="z";}
    switch (language){
       case "en" :
          window.location="english.html";
          break;
       case "es" :
          window.location="spanish.html";
          break;
       case "de" :
          window.location="german.html";
          break;
       case "fr" :
          window.location="french.html";
          break;
       case "it" :
          window.location="italian.html";
          break;
       case "sv" :
          window.location="swedish.html";
          break;
        case "nl" :
          window.location="dutch.html";
          break;
       default :
     window.location="english.html";
    
    }
    </SCRIPT>
    And then it'll instantly redirect to english.htm, dutch.htm, swedish.htm, italian.htm, german.htm or spanish.htm according to browser language.

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •