Example usage for java.util Locale getDisplayCountry

List of usage examples for java.util Locale getDisplayCountry

Introduction

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

Prototype

public final String getDisplayCountry() 

Source Link

Document

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

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    Locale[] locales = NumberFormat.getAvailableLocales();
    for (Locale locale : locales) {
        System.out.println(locale.getDisplayCountry());
    }//from   ww w .j  a v  a 2 s . c om
}

From source file:MainClass.java

public static void main(String[] args) {
    Date today = new Date();
    Locale[] locales = { US, UK, GERMANY, FRANCE };
    int[] styles = { FULL, LONG, MEDIUM, SHORT };
    String[] styleNames = { "FULL", "LONG", "MEDIUM", "SHORT" };
    DateFormat fmt = null;/*from   www .j  a v a 2s .c o  m*/
    for (Locale locale : locales) {
        System.out.println("\nThe Date for " + locale.getDisplayCountry() + ":");
        for (int i = 0; i < styles.length; i++) {
            fmt = DateFormat.getDateInstance(styles[i], locale);
            System.out.println("\tIn " + styleNames[i] + " is " + fmt.format(today));
        }
    }
}

From source file:DisplayCountryOutput.java

public static void main(String[] argv) {

    Locale defaultLocale = Locale.getDefault();
    System.out.println(defaultLocale.getISO3Country());
    System.out.println(defaultLocale.getDisplayCountry());
    System.out.println(defaultLocale.getDisplayCountry(Locale.GERMAN));
}

From source file:Main.java

public static void main(String[] args) {
    Locale locale = new Locale("ENGLISH");

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

    System.out.println("Display Name:" + locale.getDisplayCountry());

}

From source file:com.talkdesk.geo.PhoneNumberGeoMap.java

/**
 * @param args/*w w  w .j  a  va 2s.  com*/
 * @throws IOException
 * @throws SQLException
 * @throws ClassNotFoundException
 * @throws GeoResolverException
 */
public static void main(String[] args) throws GeoResolverException {
    // create Options object
    DBConnector connector = new DBConnector();
    GeoCodeResolver resolver = new GeoCodeResolver(connector.getDefaultDBconnection());
    ArrayList list = new ArrayList(Arrays.asList(args));
    Hashtable<String, Double> infoTable = new Hashtable<String, Double>();

    if (list.contains("--populate-data")) {
        GeoCodeRepositoryBuilder repositoryBuilder = new GeoCodeRepositoryBuilder();
        if (list.contains("--country"))
            repositoryBuilder.populateCountryData();
        else if (list.contains("--geo"))
            repositoryBuilder.populateGeoData();
        else {
            repositoryBuilder.populateCountryData();
            repositoryBuilder.populateGeoData();
        }

    } else if (list.contains("--same-country-only")) {
        list.remove("--same-country-only");
        infoTable = resolver.buildInfoTable(list, true);
    } else {
        infoTable = resolver.buildInfoTable(list, false);
    }

    String phoneNumber = resolver.getClosestNumber(infoTable);

    if (phoneNumber != null) {
        System.out.println("-----------------------");
        System.out.println(phoneNumber);
        Locale locale = new Locale("en", phoneNumber.split(":")[0]);
        System.out.println(locale.getDisplayCountry());
    } else {
        System.out.println("-----------------------");
        System.out.println("No Result ..!!!");
    }

}

From source file:Main.java

static void describeLocale(Locale l) {
    System.out.println("Country: " + l.getDisplayCountry());
    System.out.println("Language: " + l.getDisplayLanguage());
    System.out.println();// w w w .ja v a  2s  .c o m
}

From source file:Main.java

public static String iso2CountryCodeToCountryName(String iso2CountryCode) {
    Locale locale = new Locale(loc, iso2CountryCode);
    return locale.getDisplayCountry();
}

From source file:Main.java

private static Map<String, String> initCountries() {
    Map<String, String> countries = new HashMap<String, String>();
    for (String iso : Locale.getISOCountries()) {
        Locale l = new Locale(loc, iso);
        countries.put(l.getDisplayCountry(), iso);
    }/*  w  w  w . j  a va  2s .co  m*/
    return countries;
}

From source file:Main.java

public static String getCountry(Context context) {
    Locale locale = context.getResources().getConfiguration().locale;
    String country = locale.getDisplayCountry();
    return country;
}