public static TDateFormat getDateInstance(int style, TLocale locale) {
return new TSimpleDateFormat(getDateFormatString(style, locale), locale);
}
private static String getDateFormatString(int style, TLocale locale) {
DateFormatCollection formats = CLDRHelper.resolveDateFormats(locale.getLanguage(), locale.getCountry());
switch (style) {
case SHORT:
return formats.getShortFormat();
case MEDIUM:
return formats.getMediumFormat();
case LONG:
return formats.getLongFormat();
case FULL:
return formats.getFullFormat();
default:
throw new IllegalArgumentException("Unknown style: " + style);
}
}