protected String GetPreferredLanguage(HttpServletRequest httpRequest, String parseLangQueryParams)
    {
      String preferredLang = null;

      // Attempt to detect a lang parameter in the referral URL
      preferredLang = InferLangFromReferralUrl(httpRequest, parseLangQueryParams);

      // If the cookie failed, retrieve the user's language preference from a shared cookie
      if (preferredLang == null)
        preferredLang = InferLangFromCookie(httpRequest);

      // If some kind of language string was found, coerce it into one of the
      // permitted values
      if (preferredLang != null)
      {
        preferredLang = preferredLang.trim().toLowerCase();
        if (!preferredLang.equals("fr"))
          preferredLang = "en";
      }

      log.debug("Preferred language is " + preferredLang == null ? "NULL" : preferredLang);
      return preferredLang;
    }