Couldn’t translate Date to spanish with Locale(“es_ES”)

“es_ES” is a language + country. You must specify each part separately.

The constructors for Locale are:

You want new Locale("es", "ES"); to get the Locale that goes with es_ES.

However, it would be better to use Locale.forLanguageTag("es-ES"), using the well-formed IETF BCP 47 language tag es-ES (with - instead of _), since that method can return a cached Locale, instead of always creating a new one.

Leave a Comment