Java disposes of DateFormatSymbols
which allows to generate the days of week according to the given locale. Is there the same mecanism for time units (seconds, minutes…) ?
So far, I only found java.util.concurrent.TimeUnit
and java.time.temporal.ChronoUnit
which dispose of a list in english. but no localized version.
NB : I'm just interested in features from the "vanilla" java7 (I'd rather create my own system than load a full api)
In Java 8 there is java.time.temporal.ChronoField#getDisplayName(Locale)
Locale fr = Locale.FRENCH;
System.out.println(ChronoField.HOUR_OF_DAY.getDisplayName(fr));
System.out.println(ChronoField.MINUTE_OF_HOUR.getDisplayName(fr));
System.out.println(ChronoField.SECOND_OF_MINUTE.getDisplayName(fr));
prints
heure
minute
seconde
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With