title: Programmatically change locale (language) of a page
body: <p>I have two root nodes in my Umbraco website.. one is set to English and other is set to German using Manage Hostnames ..</p>
  
  <pre><code>|- en
  |---- english page1
  |---- english page2
  
  |- de
  |---- german page1
  |---- german page2
  </code></pre>
  
  <p><a href="http://mywebsite.com" rel="nofollow noreferrer">http://mywebsite.com</a> is set to <strong>en</strong> node and <a href="http://mywebsite.de" rel="nofollow noreferrer">http://mywebsite.de</a> is set to <strong>de</strong> node.</p>
  
  <p>I need to change the German node's language to English in certain conditions.. Is this possible and how?</p>
  
  <p>For example if someone calls an English page using German hostname, I need to change the locale to English</p>
  
  <p>For example
  <a href="http://mywebsite" rel="nofollow noreferrer">http://mywebsite</a><strong>.de</strong>/english-page1.aspx should be in English locale.. so the dictionary etc need to be loaded from English<br>
  <a href="http://mywebsite" rel="nofollow noreferrer">http://mywebsite</a><strong>.com</strong>/german-page1.aspx should be in German locale.. so the dictionary etc need to be loaded from German  </p>
  
  <p>I have written an HttpModule to change the locale on PreRequestHandlerExecute but without no success</p>
  
  <pre><code>void context_PreRequestHandlerExecute(object sender, EventArgs e)
  {
      Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("de-CH");
      Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-CH");
  }
  </code></pre>