On Thursday, May 14, 2020 at 7:30:11 AM UTC+2, foal wrote:
I don't mean introducing a new kind of Locale.
For example, you've added toLanguageTag as an instance method, and getAvailableLocales as a static method.
Then do:
public class LocaleExt {
public static String toLanguageTag(Locale locale) { … }
public static Locale[] getAvailableLocales() { … }
}
(and for performance, maybe cache the computed language tag in a java.util.Map or a
JS WeakMap)
and everywhere in your code where you used to call locale.toLanguageTag() or Locale.getAvailableLocales() then replace them with LocaleExt.toLanguageTag(locale) or LocaleExt.getAvailableLocales() respectively.
Then the SimpleDateTimeFormatStyleProvider#getFormatter(FormatStyle,FormatStyle,Chronology,Locale) emulation can keep the exact same signature.