title: Is there an easy way to convert HTTP_ACCEPT_LANGUAGE to Oracle NLS_LANG settings?
body: <p>When adding internationalisation capabilities to an Oracle web application (build on mod_plsql), I'd like to interpret the HTTP_ACCEPT_LANGUAGE parameter and use it to set various NLS_* settings in the Oracle session.</p>
  
  <p>For example:</p>
  
  <pre><code>HTTP_ACCEPT_LANGUAGE=de
  
  alter session set nls_territory=germany;
  alter session set nls_lang=...
  </code></pre>
  
  <p>However, you could get something more complicated I suppose...</p>
  
  <pre><code>HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
  </code></pre>
  
  <p>How have folks tackled this sort of thing before?</p>
  
  <p><strong>EDIT - following on from Curt's detailed answer below</strong></p>
  
  <p>Thanks for the clear and detailed reply Curt. I didn't really make myself clear though, as I was really asking if there were any existing Oracle widgets that handled this. </p>
  
  <p>I'm already down the road of manually parsing the HTTP_ACCEPT_LANGUAGE variable and - as Curt indicated in his answer - there are a few subtle areas of complexity. It <em>feels</em> like something that must have been done many times before. As I wrote more and more code I had that sinking "I'm reinventing the wheel" feeling. :)</p>
  
  <p>There must be an existing Oracle approach for this - probably something in iAS??</p>
  
  <p><strong>EDIT - stumbled across the answer</strong></p>
  
  <p>While looking for something else, I stumbled across the UTL_I18N package, which does exactly wham I'm after:</p>
  
  <p><a href="https://stackoverflow.com/questions/895839/is-there-an-easy-way-to-convert-httpacceptlanguage-to-oracle-nlslang-settings/1820331#1820331">Is there an easy way to convert HTTP_ACCEPT_LANGUAGE to Oracle NLS_LANG settings?</a></p>