code: public static Locale getLocale(String localeName) {
  
          if (CmsStringUtil.isEmpty(localeName)) {
              return getDefaultLocale();
          }
  
          Locale locale = null;
          if (OpenCms.getMemoryMonitor() != null) {
              // this may be used AFTER shutdown
              locale = OpenCms.getMemoryMonitor().getCachedLocale(localeName);
          }
          if (locale != null) {
              return locale;
          }
          try {
              if ("all".equals(localeName)) {
                  locale = new Locale("all");
              } else {
                  locale = LocaleUtils.toLocale(localeName);
              }
          } catch (Throwable t) {
              LOG.debug(Messages.get().getBundle().key(Messages.LOG_CREATE_LOCALE_FAILED_1, localeName), t);
              // map this error to the default locale
              locale = getDefaultLocale();
          }
          if (OpenCms.getMemoryMonitor() != null) {
              // this may be used AFTER shutdown
              OpenCms.getMemoryMonitor().cacheLocale(localeName, locale);
          }
          return locale;
      }
docs: Returns a locale created from the given full name.<p>
  
  The full name must consist of language code,
  country code(optional), variant(optional) separated by "_".<p>
  
  This method will always return a valid Locale!
  If the provided locale name is not valid (i.e. leads to an Exception
  when trying to create the Locale, then the configured default Locale is returned.<p>
  
  @param localeName the full locale name
  @return the locale or <code>null</code> if not available