当前位置: 首页>>代码示例>>Java>>正文


Java Locale.getISOCountries方法代码示例

本文整理汇总了Java中java.util.Locale.getISOCountries方法的典型用法代码示例。如果您正苦于以下问题:Java Locale.getISOCountries方法的具体用法?Java Locale.getISOCountries怎么用?Java Locale.getISOCountries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Locale的用法示例。


在下文中一共展示了Locale.getISOCountries方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCountryList

import java.util.Locale; //导入方法依赖的package包/类
protected String[] getCountryList() {
  if (countryList == null) {
    String[] c = Locale.getISOCountries();
    ArrayList<String> sortedCountries = new ArrayList<String>();
    for (int i = 0; i < c.length; i++) {
      String country =
        (new Locale("en", c[i])).getDisplayCountry(Locale.getDefault());
      countries.put(country, c[i]);
      sortedCountries.add(country);
    }
    Collections.sort(sortedCountries,
                     Collator.getInstance(Locale.getDefault()));
    countries.put(ANY_COUNTRY, "");
    sortedCountries.add(0, ANY_COUNTRY);
    countryList = sortedCountries.toArray(new String[sortedCountries.size()]);
  }
  return countryList;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:19,代码来源:LocaleConfigurer.java

示例2: CountryList

import java.util.Locale; //导入方法依赖的package包/类
public CountryList() {
    // A collection to store our country object
    this.countries = new ArrayList<String>();

    // Get ISO countries, create Country object and
    // store in the collection.
    String[] isoCountries = Locale.getISOCountries();
    for (String country : isoCountries) {
        Locale locale = new Locale("en", country);
        String name = locale.getDisplayCountry();

        if (!"".equals(name)) {
            this.countries.add(name);
        }
    }
    this.countryListSize = countries.size();
    this.random = new Random();
}
 
开发者ID:couchbaselabs,项目名称:GitTalent,代码行数:19,代码来源:CountryList.java

示例3: Test4126880

import java.util.Locale; //导入方法依赖的package包/类
/**
 * @bug 4126880
 */
void Test4126880() {
    String[] test;

    test = Locale.getISOCountries();
    test[0] = "SUCKER!!!";
    test = Locale.getISOCountries();
    if (test[0].equals("SUCKER!!!"))
        errln("Changed internal country code list!");

    test = Locale.getISOLanguages();
    test[0] = "HAHAHAHA!!!";
    test = Locale.getISOLanguages();
    if (test[0].equals("HAHAHAHA!!!")) // Fixed typo
        errln("Changes internal language code list!");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:LocaleTest.java

示例4: listAll

import java.util.Locale; //导入方法依赖的package包/类
public static ArrayList<Country> listAll(Context context, final String filter) {
    ArrayList<Country> list = new ArrayList<>();

    for (String countryCode : Locale.getISOCountries()) {
        Country country = getCountry(countryCode, context);

        list.add(country);
    }

    sortList(list);

    if (filter != null && filter.length() > 0) {
        return new ArrayList<>(Collections2.filter(list, new Predicate<Country>() {
            @Override
            public boolean apply(Country input) {
                return input.getName().toLowerCase().contains(filter.toLowerCase());
            }
        }));
    } else {
        return list;
    }
}
 
开发者ID:Scrounger,项目名称:CountryCurrencyPicker,代码行数:23,代码来源:Country.java

示例5: Test4126880

import java.util.Locale; //导入方法依赖的package包/类
/**
 * @bug 4126880
 */
void Test4126880() {
    String[] test;

    test = Locale.getISOCountries();
    test[0] = "SUCKER!!!";
    test = Locale.getISOCountries();
    if (test[0].equals("SUCKER!!!")) {
        errln("Changed internal country code list!");
    }

    test = Locale.getISOLanguages();
    test[0] = "HAHAHAHA!!!";
    test = Locale.getISOLanguages();
    if (test[0].equals("HAHAHAHA!!!")) { // Fixed typo
        errln("Changes internal language code list!");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:LocaleTest.java

示例6: getCountriesList

import java.util.Locale; //导入方法依赖的package包/类
public static List<String> getCountriesList() {
    List<String> countriesList = new ArrayList<>();

    String[] locales = Locale.getISOCountries();

    for (String countryCode : locales) {

        Locale obj = new Locale("", countryCode);
        countriesList.add(obj.getDisplayCountry(Locale.ENGLISH));

    }
    Collections.sort(countriesList);
    return countriesList;
}
 
开发者ID:Elbehiry,项目名称:Viajes,代码行数:15,代码来源:Utils.java

示例7: createAllSupportedCountries

import java.util.Locale; //导入方法依赖的package包/类
/**
 * Creates all SupportedCountry objects. Normally all SupportedCountry
 * objects are created during DB setup. Creating all countries is slow and
 * should be done only if needed.
 */
public static void createAllSupportedCountries(DataService mgr)
        throws NonUniqueBusinessKeyException {
    for (String countryCode : Locale.getISOCountries()) {
        findOrCreate(mgr, countryCode);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:12,代码来源:SupportedCountries.java

示例8: supportAllCountries

import java.util.Locale; //导入方法依赖的package包/类
public static void supportAllCountries(DataService mgr, Organization org) {
    for (String countryCode : Locale.getISOCountries()) {
        SupportedCountry country = SupportedCountries
                .find(mgr, countryCode);
        if (country != null) {
            org.setSupportedCountry(country);
        }
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:10,代码来源:Organizations.java

示例9: getDisplayCountries

import java.util.Locale; //导入方法依赖的package包/类
/**
 * Returns a mapping from country codes in ISO 3166 to localized country
 * names.
 */
public Map<String, String> getDisplayCountries() {
    if (hasLocaleChanged()) {
        reset();
    }
    if (displayCountries.isEmpty()) {
        Locale userLocale = getCurrentUserLocale();
        for (String code : Locale.getISOCountries()) {
            String country = getDisplayCountry(code, userLocale);
            displayCountries.put(code, country);
        }
    }
    return displayCountries;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:18,代码来源:CountryBean.java

示例10: getTagsForProperty

import java.util.Locale; //导入方法依赖的package包/类
@Override
public String[] getTagsForProperty(String propertyName) {
	if(propertyName.equals("outputLocale") || propertyName.equals("inputLocale")){
		return Locale.getISOCountries();
	}
	return super.getTagsForProperty(propertyName);
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:8,代码来源:XMLDateTimeStep.java

示例11: getTagsForProperty

import java.util.Locale; //导入方法依赖的package包/类
@Override
public String[] getTagsForProperty(String propertyName) {
	if(propertyName.equals("inputLocale") ||
		propertyName.equals("outputLocale")) {
		return Locale.getISOCountries();
	}
	return super.getTagsForProperty(propertyName);
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:9,代码来源:XMLGenerateDatesStep.java

示例12: convertToIso2

import java.util.Locale; //导入方法依赖的package包/类
public static String convertToIso2(String iso3code) {

        String[] countries = Locale.getISOCountries();

        HashMap<String, Locale> localeMap = new HashMap<>(countries.length);
        for (String country : countries) {
            Locale locale = new Locale("", country);
            localeMap.put(locale.getISO3Country().toUpperCase(), locale);
        }

        return localeMap.get(iso3code).getCountry();
    }
 
开发者ID:Code4SocialGood,项目名称:c4sg-services,代码行数:13,代码来源:CountryCodeConverterUtil.java

示例13: listAllWithCurrencies

import java.util.Locale; //导入方法依赖的package包/类
public static ArrayList<Country> listAllWithCurrencies(Context context, final String filter) {
    ArrayList<Country> list = new ArrayList<>();

    for (String countryCode : Locale.getISOCountries()) {
        Country country = getCountryWithCurrency(countryCode, context);

        if (country != null) {
            //z.B. Antarktis is null -> keine Währung
            list.add(country);
        }
    }

    sortList(list);

    if (filter != null && filter.length() > 0) {
        return new ArrayList<>(Collections2.filter(list, new Predicate<Country>() {
            @Override
            public boolean apply(Country input) {
                return input.getName().toLowerCase().contains(filter.toLowerCase()) ||
                        input.getCurrency().getName().toLowerCase().contains(filter.toLowerCase()) ||
                        input.getCurrency().getSymbol().toLowerCase().contains(filter.toLowerCase());
            }
        }));
    } else {
        return list;
    }
}
 
开发者ID:Scrounger,项目名称:CountryCurrencyPicker,代码行数:28,代码来源:Country.java

示例14: checkISO3166_3Codes

import java.util.Locale; //导入方法依赖的package包/类
/**
 * This method checks that ISO3166-3 country codes which are PART3 of
 * IsoCountryCode enum, are retrieved correctly.
 */
private static void checkISO3166_3Codes() {
    Set<String> iso3166_3Codes = Locale.getISOCountries(IsoCountryCode.PART3);
    if (!iso3166_3Codes.equals(ISO3166_3EXPECTED)) {
        reportDifference(iso3166_3Codes, ISO3166_3EXPECTED);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:Bug8071929.java

示例15: checkISO3166_1_Alpha3Codes

import java.util.Locale; //导入方法依赖的package包/类
/**
 * This method checks that ISO3166-1 alpha-3 country codes which are
 * PART1_ALPHA3 of IsoCountryCode enum, are retrieved correctly.
 */
private static void checkISO3166_1_Alpha3Codes() {
    Set<String> iso3166_1_Alpha3Codes = Locale.getISOCountries(IsoCountryCode.PART1_ALPHA3);
    if (!iso3166_1_Alpha3Codes.equals(ISO3166_1_ALPHA3_EXPECTED)) {
        reportDifference(iso3166_1_Alpha3Codes, ISO3166_1_ALPHA3_EXPECTED);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:Bug8071929.java


注:本文中的java.util.Locale.getISOCountries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。