private static SupportedLocale fromValidatedULocale()

in locales-common/src/main/java/com/spotify/i18n/locales/common/model/SupportedLocale.java [130:142]


  private static SupportedLocale fromValidatedULocale(final ULocale validatedULocale) {
    ULocale rootLocaleForFormatting =
        LocalesHierarchyUtils.getHighestAncestorLocale(validatedULocale);
    return SupportedLocale.builder()
        .localeForTranslations(validatedULocale)
        .relatedLocalesForFormatting(
            Stream.concat(
                    Stream.of(rootLocaleForFormatting),
                    LocalesHierarchyUtils.getDescendantLocales(rootLocaleForFormatting).stream())
                .filter(locale -> !LocalesHierarchyUtils.isSameLocale(locale, EN_US_POSIX))
                .collect(Collectors.toSet()))
        .build();
  }