I'm new in ENUMS. I'm looking for possibility to translate English names of days to Polish using ENUM class. What actually would I like to do?
In my program I'm using LocalDate
library and getDayOfWeek()
method. My goal is made something like this: String day = Days(someDate.getDayOfWeek().toString())
and if someDate.getDayOfWeek()
is MONDAY, the method give me translated day "Poniedziałek".
public enum Days {
MONDAY {
public String toString() {
return "Poniedziałek";
}
},
// other days ...
}
It is possible with enums? Or there is something better solution?