Example usage for java.util Locale getDisplayName

List of usage examples for java.util Locale getDisplayName

Introduction

In this page you can find the example usage for java.util Locale getDisplayName.

Prototype

public final String getDisplayName() 

Source Link

Document

Returns a name for the locale that is appropriate for display to the user.

Usage

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    Locale defaultLocale = Locale.getDefault();
    System.out.println(defaultLocale.getDisplayName());
    System.out.println(defaultLocale.getDisplayName(Locale.ITALIAN));
    System.out.println(defaultLocale.getDisplayName(Locale.US));
}

From source file:DisplayNameOutput.java

public static void main(String[] argv) {

    Locale defaultLocale = Locale.getDefault();
    System.out.println(defaultLocale.getDisplayName());
    System.out.println(defaultLocale.getDisplayName(Locale.ITALIAN));
    System.out.println(defaultLocale.getDisplayName(Locale.US));
}

From source file:FormatDateLocale.java

public static void main(String[] args) {
    Locale[] locales = new Locale[] { Locale.JAPAN, Locale.CHINA, Locale.KOREA, Locale.TAIWAN, Locale.ITALY,
            Locale.FRANCE, Locale.GERMAN };

    Date today = new Date();

    for (Locale locale : locales) {
        System.out.println("Date format in " + locale.getDisplayName() + " = "
                + SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG, locale).format(today).toUpperCase());
    }/*from  w  w w.  j a va 2  s .co  m*/
}

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) {

    // create a calendar
    Locale locale1 = Locale.CANADA;
    TimeZone tz1 = TimeZone.getTimeZone("GMT");
    Calendar cal1 = Calendar.getInstance(tz1, locale1);

    // display time zone for both calendars
    String tzname1 = tz1.getDisplayName();
    String name1 = locale1.getDisplayName();
    System.out.println("GMT and Canada: " + tzname1 + " " + name1);
}

From source file:Main.java

public static boolean isRTL(Locale locale) {
    final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
    return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
            || directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}

From source file:Main.java

private static boolean isRTL(Locale locale) {
    int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
    return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
            || directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}

From source file:com.hustunique.jianguo.materialsearchview.SearchViewUtil.java

private static boolean isRTL(Locale locale) {
    final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
    return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
            || directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}

From source file:architecture.common.util.LocaleUtils.java

public static Locale[] getAvailableLocales() {
    Locale locales[] = Locale.getAvailableLocales();

    Arrays.sort(locales, new Comparator<Locale>() {
        public int compare(Locale locale1, Locale locale2) {
            return locale1.getDisplayName().compareTo(locale2.getDisplayName());
        }//from ww  w.  j  av  a  2 s.  c o  m
    });
    return locales;
}

From source file:Test.java

static void displayLocalizedData(Locale l, long number, Date date) {
    NumberFormat nf = NumberFormat.getInstance(l);
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, l);
    System.out.printf("Locale: %s\nNumber: %s\nDate: %s\n\n", l.getDisplayName(), nf.format(number),
            df.format(date));/*  ww  w. ja  v  a2 s.  co m*/
}