code: public Locale getLocale()
      {
          Enumeration enm = _httpRequest.getFieldValues(HttpFields.__AcceptLanguage,
                                                         HttpFields.__separators);
  
          // handle no locale
          if (enm == null || !enm.hasMoreElements())
              return Locale.getDefault();
          
          // sort the list in quality order
          List acceptLanguage = HttpFields.qualityList(enm);
          if (acceptLanguage.size()==0)
              return  Locale.getDefault();
  
          int size=acceptLanguage.size();
          
          // convert to locals
          for (int i=0; i<size; i++)
          {
              String language = (String)acceptLanguage.get(i);
              language=HttpFields.valueParameters(language,null);
              String country = "";
              int dash = language.indexOf('-');
              if (dash > -1)
              {
                  country = language.substring(dash + 1).trim();
                  language = language.substring(0,dash).trim();
              }
              return new Locale(language,country);
          }
  
          return  Locale.getDefault();
      }
docs: /* ------------------------------------------------------------