From c16776b96f91407b2825071e6e37ca75b84ee98f Mon Sep 17 00:00:00 2001 From: Michiel Meeuwissen Date: Wed, 10 Jul 2024 11:35:01 +0200 Subject: [PATCH] These make some sense too. --- src/main/java/org/meeuw/i18n/languages/ISO_639_Code.java | 4 ++++ src/main/java/org/meeuw/i18n/languages/LanguageCode.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/org/meeuw/i18n/languages/ISO_639_Code.java b/src/main/java/org/meeuw/i18n/languages/ISO_639_Code.java index 3932c53..47a99b4 100644 --- a/src/main/java/org/meeuw/i18n/languages/ISO_639_Code.java +++ b/src/main/java/org/meeuw/i18n/languages/ISO_639_Code.java @@ -41,6 +41,10 @@ default NameRecord nameRecord(Locale locale) { return nameRecord(); } + default NameRecord nameRecord(LanguageCode locale) { + return nameRecord(locale.toLocale()); + } + default NameRecord nameRecord() { return new NameRecord(toString()); } diff --git a/src/main/java/org/meeuw/i18n/languages/LanguageCode.java b/src/main/java/org/meeuw/i18n/languages/LanguageCode.java index 4c05d7b..71a8da8 100644 --- a/src/main/java/org/meeuw/i18n/languages/LanguageCode.java +++ b/src/main/java/org/meeuw/i18n/languages/LanguageCode.java @@ -65,6 +65,11 @@ public interface LanguageCode extends ISO_639_Code { .sorted(Map.Entry.comparingByKey()); } + static Stream> streamByNames(LanguageCode locale) { + return streamByNames(locale.toLocale()); + } + + /** * Defaulting version of {@link #streamByNames(Locale)}, using {@link Locale#US}. * @since 3.0