Is there a Java library/api which , given an iso language code, returns the corresponding language name. For example zh-cn should return chinese, en should return english and so on.
The Java Locale class can do this:
new Locale("zh", "cn").getDisplayName();
--> Chinese (China)
You just have to parse the language/country names.
You don't need a library; you can use java.util.Locale for this.
Locale locale = new Locale("zh", "cn");
System.out.println(locale.getDisplayLanguage());
This will print
Chinese
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