title: Web Storage for website localization
body: <p>I am trying to create a website that shows the selected language page at first visit. On click of the language name, the language name string (eg. French) gets stored in the web/local storage. And when the next time user visits the website, the language string is checked and specific language page is shown.
  I have written twelve functions for storing the language string on click of anchor tag of each language. Like this:</p>
  
  <pre><code>function english()
  {
  if(typeof(Storage)!=="undefined")
    {
    localStorage.clear();
    localStorage.language="English";
   window.location.reload();
    }
  }
  
  function french()
  {
  if(typeof(Storage)!=="undefined")
    {
    localStorage.clear();
    localStorage.language="French";
    window.location.href = "french.html";
    }
  }
  </code></pre>
  
  <p>Is this method really efficient? I think creating multiple pages for multiple language is good for SEO rather than changing the text string on the fly.
  Till here when I check the Chrome developers console, the value of the string gets stored. But when I close the tab or the browser window the stored value is gone and the next time it cannot remember the language.</p>
  
  <p>I am checking the language using this code (I have to do it for 12 languages):</p>
  
  <pre><code>window.onload = function() {
  if (localStorage.language="Language")
    {
     window.location.href = "language.html";
    }
  else if (localStorage.language="English")
    {
     window.location.href = "eng.html";
    }
  else if (localStorage.language="French")
    {
    window.location.href = "french.html";
    }
  else if (localStorage.language="Spanish")
    {
    window.location.href = "spanish.html";
    }
  </code></pre>
  
  <p>The code kinda stops after checking the first 'if' condition, true or false it just stops there and doesn't check the 'else if' condition beyond that.</p>
  
  <p>Can someone please help me this?? The sample codes seems to store the value in web storage even after browser close but I cannot replicate it in mine.</p>