/** * Equivalent to {@code getDisplayCountry(Locale.getDefault())}. */ public final String getDisplayCountry() { return getDisplayCountry(getDefault()); }
Locale loc = new Locale("","NL"); loc.getDisplayCountry();
Locale l = new Locale("", "NL"); String country = l.getDisplayCountry();
Locale l = new Locale("", "CH"); System.out.println(l.getDisplayCountry());
@Override public void run() { for (String code : countryCodes) { System.out.println(String.format("%s: %s", code.toUpperCase(), new Locale("", code).getDisplayCountry())); } } }
/** * Get the collation name. * * @param l the locale * @return the name of the collation */ public static String getName(Locale l) { Locale english = Locale.ENGLISH; String name = l.getDisplayLanguage(english) + ' ' + l.getDisplayCountry(english) + ' ' + l.getVariant(); name = StringUtils.toUpperEnglish(name.trim().replace(' ', '_')); return name; }
String[] locales = Locale.getISOCountries(); for (String countryCode : locales) { Locale obj = new Locale("", countryCode); System.out.println("Country Code = " + obj.getCountry() + ", Country Name = " + obj.getDisplayCountry()); }
public static void main(String[] args) throws InterruptedException { Map<String, String> countries = new HashMap<>(); for (String iso : Locale.getISOCountries()) { Locale l = new Locale("", iso); countries.put(l.getDisplayCountry(), iso); } System.out.println(countries.get("Switzerland")); System.out.println(countries.get("Andorra")); System.out.println(countries.get("Japan")); }
Locale[] locale = Locale.getAvailableLocales(); ArrayList<String> countries = new ArrayList<String>(); String country; for( Locale loc : locale ){ country = loc.getDisplayCountry(); if( country.length() > 0 && !countries.contains(country) ){ countries.add( country ); } } Collections.sort(countries, String.CASE_INSENSITIVE_ORDER); Spinner citizenship = (Spinner)findViewById(R.id.input_citizenship); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, countries); citizenship.setAdapter(adapter);
/** * Get the collation name. * * @param l the locale * @return the name of the collation */ public static String getName(Locale l) { Locale english = Locale.ENGLISH; String name = l.getDisplayLanguage(english) + ' ' + l.getDisplayCountry(english) + ' ' + l.getVariant(); name = StringUtils.toUpperEnglish(name.trim().replace(' ', '_')); return name; }
import java.util.*; class Countries { public static void main(String[] args) { Locale[] locales = Locale.getAvailableLocales(); ArrayList<String> countries = new ArrayList<String>(); for (Locale locale : locales) { String country = locale.getDisplayCountry(); if (country.trim().length()>0 && !countries.contains(country)) { countries.add(country); } } Collections.sort(countries); for (String country : countries) { System.out.println(country); } System.out.println( "# countries found: " + countries.size()); } }
public String getCountryDisplay() { final String myCountry = getCountry(); if (myCountry == null) { return null; } // "fr" est sans conséquence return new Locale("fr", myCountry).getDisplayCountry(I18N.getCurrentLocale()); }
@Signature(@Arg(value = "locale", nativeType = WrapLocale.class, optional = @Optional("null"))) public Memory getDisplayCountry(Environment env, Memory... args) { return StringMemory.valueOf(args[0].isNull() ? locale.getDisplayCountry() : locale.getDisplayCountry(args[0].toObject(WrapLocale.class).locale) ); }
Locale loc = new Locale("", ssid); return loc.getDisplayCountry().trim();
buffer.append(" ("); String displayCountry = getDisplayCountry(locale); buffer.append(displayCountry.isEmpty() ? countryCode : displayCountry); ++count;
private void createCountries() throws ServiceException { LOGGER.info(String.format("%s : Populating Countries ", name)); List<Language> languages = languageService.list(); for(String code : SchemaConstant.COUNTRY_ISO_CODE) { Locale locale = SchemaConstant.LOCALES.get(code); if (locale != null) { Country country = new Country(code); countryService.create(country); for (Language language : languages) { String name = locale.getDisplayCountry(new Locale(language.getCode())); //byte[] ptext = value.getBytes(Constants.ISO_8859_1); //String name = new String(ptext, Constants.UTF_8); CountryDescription description = new CountryDescription(language, name); countryService.addCountryDescription(country, description); } } } }
+ defaultLocale.getLanguage() + "_" + defaultLocale.getCountry() + " (" + defaultLocale.getDisplayLanguage() + "," + defaultLocale.getDisplayCountry() + ")"); System.out.println(" now = " + nowInMillis + " [ms] or " + createDateFormat().format(now));
"</td><td>" + prefix + locale.getDisplayCountry() + suffix + "</td><td>" +
public String[] getOtherCountries() { Set<String> countries = new HashSet<String>(); Set<Object> keys = supportedLanguages.keySet(); for (Object key : keys) { Locale other = (Locale) supportedLanguages.get(key); if (other != requestLocale) { countries.add(other.getDisplayCountry(requestLocale)); } } return countries.toArray(new String[0]); }
@Koan public void getCountryInformation() { Locale locBR = new Locale("pt", "BR"); assertEquals(locBR.getDisplayCountry(), __); assertEquals(locBR.getDisplayCountry(locBR), __); Locale locCH = new Locale("it", "CH"); assertEquals(locCH.getDisplayCountry(), __); assertEquals(locCH.getDisplayCountry(locCH), __); assertEquals(locCH.getDisplayCountry(new Locale("de", "CH")), __); }