code: static Locale getFormattingLocale(PageContext pc) {
          /*
         * Establish formatting locale by comparing the preferred locales
         * (in order of preference) against the available formatting
         * locales, and determining the best matching locale.
         */
          Locale match;
          Locale pref = getLocale(pc, Config.FMT_LOCALE);
          if (pref != null) {
              // Preferred locale is application-based
              match = findFormattingMatch(pref, availableFormattingLocales);
          } else {
              // Preferred locales are browser-based
              match = findFormattingMatch(pc, availableFormattingLocales);
          }
          if (match == null) {
              //Use fallback locale.
              pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE);
              if (pref != null) {
                  match = findFormattingMatch(pref, availableFormattingLocales);
              }
          }
          if (match != null) {
              setResponseLocale(pc, match);
          }
  
          return match;
      }
docs: /*
  Returns the formatting locale to use when <fmt:message> is used
  with a locale-less localization context.
  
  @param pc The page context containing the formatting action
  @return the formatting locale to use