List of usage examples for java.util Locale Locale
public Locale(String language, String country)
From source file:Main.java
public static void main(String[] args) { Locale locale = new Locale("ENGLISH", "US"); System.out.println("Locale:" + locale); System.out.println("Display Name:" + locale.getDisplayCountry()); }
From source file:Main.java
public static void main(String[] args) { Locale locale = new Locale("ENGLISH", "US"); System.out.println("Locale:" + locale); // print language for another locale - result is based on inLocale System.out.println("Language:" + locale.getDisplayLanguage(new Locale("GERMANY", "GERMAN"))); }
From source file:Main.java
public static void main(String[] args) { Locale locale = new Locale("ENGLISH", "US"); System.out.println("Locale:" + locale); // print display name for locale - based on inLocale System.out.println("Name:" + locale.getDisplayName(new Locale("GERMAN", "GERMANY"))); }
From source file:Main.java
public static void main(String[] args) { Locale locale = new Locale("ENGLISH", "US"); System.out.println("Locale1:" + locale); // print the country of this locale System.out.println("Country:" + locale.getCountry()); }
From source file:Main.java
public static void main(String[] args) { Locale locale = new Locale("ENGLISH", "US"); System.out.println("Locale:" + locale); // print language System.out.println("Language:" + locale.getDisplayLanguage()); }
From source file:Main.java
public static void main(String[] args) { Locale locale = new Locale("ENGLISH", "US"); System.out.println("Locale:" + locale); //display name - result is based on inLocale System.out.println("Display Name:" + locale.getDisplayCountry(new Locale("GERMAN", "GERMANY"))); }
From source file:Main.java
public static void main(String[] args) { Locale locale = new Locale("ENGLISH", "US"); System.out.println("Locale:" + locale); // print display name for locale System.out.println("Name:" + locale.getDisplayName()); }
From source file:Main.java
public static void main(String[] args) { Locale locale1 = new Locale("ENGLISH", "US"); // print this locale System.out.println("Locale1:" + locale1); // create a second locale Locale locale2;/*from w ww. jav a 2s. c o m*/ // clone locale1 to locale2 locale2 = (Locale) locale1.clone(); System.out.println("Locale2:" + locale2); }
From source file:Main.java
public static void main(String[] args) { Locale locale1 = new Locale("ENGLISH", "US"); // print this locale System.out.println("Locale1:" + locale1); // create a second locale Locale locale2 = new Locale("GERMANY", "GERMAN"); // compare two locales System.out.println("Locales are equal:" + locale1.equals(locale2)); // create a third locale Locale locale3 = new Locale("ENGLISH", "US"); // compare locale1 and locale3 System.out.println("Locales are equal:" + locale1.equals(locale3)); }
From source file:Main.java
public static void main(String[] args) { Locale USLocale = new Locale("en", "US"); Collator c = Collator.getInstance(USLocale); String str1 = "Java"; String str2 = "HTML"; int diff = c.compare(str1, str2); System.out.print("Comparing using Collator class: "); if (diff > 0) { System.out.println(str1 + " comes after " + str2); } else if (diff < 0) { System.out.println(str1 + " comes before " + str2); } else {/* w w w. j ava2s . c o m*/ System.out.println(str1 + " and " + str2 + " are the same."); } }