”;
Example
In this example, we”ll get display language per locale passed as an argument.
import java.util.Locale; public class I18NTester { public static void main(String[] args) { Locale defaultLocale = Locale.getDefault(); Locale enLocale = new Locale("en", "US"); Locale frLocale = new Locale("fr", "FR"); Locale esLocale = new Locale("es", "ES"); System.out.println(defaultLocale.getDisplayLanguage(enLocale)); System.out.println(defaultLocale.getDisplayLanguage(frLocale)); System.out.println(defaultLocale.getDisplayLanguage(esLocale)); } }
Output
It will print the following result.
English anglais inglés
Advertisements
”;