Looks up the {@link MessageFormat} for a code.

@param code the code to look up
@param locale the {@link Locale} for which the code should be looked up
@return newly created {@link MessageFormat}
541833
@Override
  public MessageFormat resolveCode(String code, Locale locale) {
    String resolved = resolveCodeWithoutArguments(code, locale);
    if (resolved == null) {
      return null;
    }
    return createMessageFormat(resolved, locale);
  }
614974
private String getMessage(boolean localized) {
        String msg = localized ? super.getLocalizedMessage() : super.getMessage();
        StringBuilder sb = new StringBuilder(msg == null ? "" : msg);
        
        for (Throwable exception : exceptions) {
            msg = localized ? exception.getLocalizedMessage() : exception.getMessage();
            
            if (msg != null) {
                sb.append(sb.length() == 0 ? "" : "\n\n").append(msg);
            }
        }
        
        return sb.toString();
    }
826731
public String getMessage(String key, Locale locale)
	{
		if (null == locale)
		{
			return getMessage(key);
		}
		return CollectionTools.getString(getResourceBundle(locale), key, getBehaviourOnMissingMessage().getValueOnMissingMessage(key));
	}
1189292
private void loadLocalizationFromXmlBundle(Locale locale) {

        CmsXmlContentValueSequence messages = m_xmlBundle.getValueSequence("Message", locale);
        SortedProperties props = new SortedProperties();
        if (null != messages) {
            for (I_CmsXmlContentValue msg : messages.getValues()) {
                String msgpath = msg.getPath();
                props.put(
                    m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", locale),
                    m_xmlBundle.getStringValue(m_cms, msgpath + "/Value", locale));
            }
        }
        m_localizations.put(locale, props);
    }
740250
protected String getMessageInternal(Locale locale, String code, Object[] args) {
		if(code == null) {
			return null;
		}

		if(locale == null) {
			locale = I18nUtils.getLocale();
		}

		final MessageFormat messageFormat = resolveMessageFormat(locale, code);
		if(messageFormat != null) {
			synchronized(messageFormat) {
				return messageFormat.format(args);
			}
		}

		return null;
	}
1087152
public static String formatMessage(TraceComponent tc, Locale locale, String msgKey, Object... objs) {
        return formatMessage(tc, (locale == null) ? null : Collections.singletonList(locale), msgKey, objs);
    }
714072
public String getMessage(final MSLocale formatLocale, Locale runtimeLocale, final String key) {

        if(formatLocale != null) {
            return getMessage(formatLocale, key);
        } else {
            return getMessage(runtimeLocale, key);
        }

    }
357569
protected void loadOtherLocale(final String locale) {

        CmsRpcAction<CmsPreviewInfo> previewAction = new CmsRpcAction<CmsPreviewInfo>() {

            @SuppressWarnings("synthetic-access")
            @Override
            public void execute() {

                if (m_previewInfoProvider != null) {
                    m_previewInfoProvider.loadPreviewForLocale(locale, this);
                } else {
                    CmsCoreProvider.getVfsService().getPreviewInfo(getSitePath(), locale, this);
                }
                start(0, true);
            }

            @Override
            protected void onResponse(CmsPreviewInfo result) {

                stop(false);
                updatePreviewContent(result);
            }
        };
        previewAction.execute();
    }
472721
public String getMessage(final MSLocale locale, final String key) {
        if(locale == null) {
            return loadResource(null).getMessage(key);

        } else {
            return loadResource(locale.getLocale()).getMessage(key);
        }
    }
57385
public CLDR.Locale match(MetaLocale locale) {
    MetaLocale result = availableBundlesMap.get(locale);
    MetaLocale maxBundleId = null;
    if (result == null) {
      // If the locale isn't expanded, do that here by adding likely subtags.
      // For the vast majority of cases this code shouldn't be executed, since
      // we've indexed permutations of locales to create a static mapping to
      // bundle identifiers.
      maxBundleId = languageResolver.addLikelySubtags(locale);
      MetaLocale minBundleId = languageResolver.removeLikelySubtags(maxBundleId);
      result = availableBundlesMap.get(minBundleId);
    }
    if (result == null) {
      // Fallback necessary to find best match for language tags that have
      // invalid fields, e.g. those with an unknown region, etc.
      MetaLocale key = maxBundleId.copy();
      for (int flags : LanguageResolver.MATCH_ORDER) {
        LanguageResolver.set(maxBundleId, key, flags);
        result = availableBundlesMap.get(key);
        if (result != null && result.hasLanguage()) {
          return result;
        }
      }
    }
    return result != null ? result : availableBundlesMap.get((MetaLocale)CLDR.Locale.en);
  }
327637
public function language($code, $locale = null)
    {
        $codes = explode('_', $code);

        $name = Intl::getLanguageBundle()->getLanguageName(
            $codes[0],
            $codes[1] ?? null,
            $locale ?: $this->localeDetector->getLocale()
        );

        return $name ? $this->fixCharset($name) : '';
    }
1298585
public String format(final MessageResolver messageResolver, final MessageInterpolator messageInterpolator) {
        
        for(String code : getCodes()) {
            Optional<String> message = messageResolver.getMessage(code);
            if(message.isPresent()) {
                return messageInterpolator.interpolate(message.get(), getVariables(), true, messageResolver);
            }
            
        }
        
        // デフォルトメッセージはBeanValidationのとき変数を追加している場合があるため、再度フォーマットする。
        return messageInterpolator.interpolate(getDefaultMessage(), getVariables(), true, messageResolver);
    }
54369
public static Locale convertLanguageToLocale(final String planguage) {
    final Locale locale;
    if (planguage == null) {
      locale = null;
    } else {
      final String localeStringUp = planguage.toUpperCase().replace('-', '_');
      if (LocaleUtil.DEFAULT_MAP.containsKey(localeStringUp)) {
        locale = LocaleUtil.DEFAULT_MAP.get(localeStringUp);
      } else if (localeStringUp.contains("_")) {
        final String[] lcoaleSplitted = localeStringUp.split("_");
        if (lcoaleSplitted.length > 2) {
          locale =
              new Locale(lcoaleSplitted[0].toLowerCase(), lcoaleSplitted[1], lcoaleSplitted[2]);
        } else {
          locale = new Locale(lcoaleSplitted[0].toLowerCase(), lcoaleSplitted[1]);
        }
      } else {
        locale = new Locale(planguage);
      }
    }
    return locale;
  }
514247
public static void setLocale(@NonNull Locale locale) {
        if (!locale.equals(Locale.getDefault())) {
            LocalizationHelper.locale = locale;
            Locale.setDefault(locale);
        }
    }
976666
public CellFormatResult format(final Cell cell, final Locale locale) {

        if(cell == null) {
            return createBlankCellResult();
        }

        final Locale runtimeLocale = locale != null ? locale : Locale.getDefault();

        switch(cell.getCellTypeEnum()) {
            case BLANK:
                if(isConsiderMergedCell()) {
                    // 結合しているセルの場合、左上のセル以外に値が設定されている場合がある。
                    return getMergedCellValue(cell, runtimeLocale);
                } else {
                    return createBlankCellResult();
                }

            case BOOLEAN:
                return getCellValue(cell, runtimeLocale);

            case STRING:
                return getCellValue(cell, runtimeLocale);

            case NUMERIC:
                return getCellValue(cell, runtimeLocale);

            case FORMULA:
                return getFormulaCellValue(cell, runtimeLocale);

            case ERROR:
                return getErrorCellValue(cell, runtimeLocale);

            default:
                final CellFormatResult result = new CellFormatResult();
                result.setCellType(FormatCellType.Unknown);
                result.setText("");
                return result;
        }
    }
1009411
public String getLocaleName(final Locale locale) {
        return messageResolver.getMessage(locale, String.format("color.%d.name", index));
    }
628852
public String getLocalizedName(Locale locale) {

        if (m_messageContainer != null) {
            return m_messageContainer.key(locale);
        }
        return m_key;
    }