/** * Produces a java map that maps a {@link Country} to it's ISO 3166 country code.<br> * Each map entry consists of:<br> * * <table border=1> * <tr> * <td>key:</td> * <td>ISO 3166 country code</td> * </tr> * <tr> * <td>value:</td> * <td>the corresponding country as {@link Country}-instance</td> * </table> * * @return */ public static Map<String, Country> createCountryMap() { // ISO3166-ALPHA-2 codes String[] countryCodes = Locale.getISOCountries(); // Key = CountryCode // Value = Country Map<String, Country> countries = new HashMap<String, Country>(countryCodes.length); for (String cc : countryCodes) { Locale.setDefault(Locale.US); String countryNameEnglish = new Locale(Locale.US.getLanguage(), cc).getDisplayCountry(); Locale.setDefault(Locale.GERMANY); String countryNameGerman = new Locale(Locale.GERMANY.getLanguage(), cc).getDisplayCountry(); Country country = new Country(cc.toUpperCase(), countryNameEnglish, countryNameGerman); countries.put(cc, country); } if (logger.isInfoEnabled()) { logger.info( "Created a country-iso3166Code Map<String, Country> with {} entries.", countries.size()); } return countries; }
static { GOOGLE_COUNTRY_TLD = new HashMap<String, String>(); GOOGLE_COUNTRY_TLD.put("AR", "com.ar"); // ARGENTINA GOOGLE_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA GOOGLE_COUNTRY_TLD.put("BR", "com.br"); // BRAZIL GOOGLE_COUNTRY_TLD.put("BG", "bg"); // BULGARIA GOOGLE_COUNTRY_TLD.put(Locale.CANADA.getCountry(), "ca"); GOOGLE_COUNTRY_TLD.put(Locale.CHINA.getCountry(), "cn"); GOOGLE_COUNTRY_TLD.put("CZ", "cz"); // CZECH REPUBLIC GOOGLE_COUNTRY_TLD.put("DK", "dk"); // DENMARK GOOGLE_COUNTRY_TLD.put("FI", "fi"); // FINLAND GOOGLE_COUNTRY_TLD.put(Locale.FRANCE.getCountry(), "fr"); GOOGLE_COUNTRY_TLD.put(Locale.GERMANY.getCountry(), "de"); GOOGLE_COUNTRY_TLD.put("GR", "gr"); // GREECE GOOGLE_COUNTRY_TLD.put("HU", "hu"); // HUNGARY GOOGLE_COUNTRY_TLD.put("ID", "co.id"); // INDONESIA GOOGLE_COUNTRY_TLD.put("IL", "co.il"); // ISRAEL GOOGLE_COUNTRY_TLD.put(Locale.ITALY.getCountry(), "it"); GOOGLE_COUNTRY_TLD.put(Locale.JAPAN.getCountry(), "co.jp"); GOOGLE_COUNTRY_TLD.put(Locale.KOREA.getCountry(), "co.kr"); GOOGLE_COUNTRY_TLD.put("NL", "nl"); // NETHERLANDS GOOGLE_COUNTRY_TLD.put("PL", "pl"); // POLAND GOOGLE_COUNTRY_TLD.put("PT", "pt"); // PORTUGAL GOOGLE_COUNTRY_TLD.put("RU", "ru"); // RUSSIA GOOGLE_COUNTRY_TLD.put("SK", "sk"); // SLOVAK REPUBLIC GOOGLE_COUNTRY_TLD.put("SI", "si"); // SLOVENIA GOOGLE_COUNTRY_TLD.put("ES", "es"); // SPAIN GOOGLE_COUNTRY_TLD.put("SE", "se"); // SWEDEN GOOGLE_COUNTRY_TLD.put(Locale.TAIWAN.getCountry(), "tw"); GOOGLE_COUNTRY_TLD.put("TR", "com.tr"); // TURKEY GOOGLE_COUNTRY_TLD.put(Locale.UK.getCountry(), "co.uk"); GOOGLE_COUNTRY_TLD.put(Locale.US.getCountry(), "com"); }
static { GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD = new HashMap<String, String>(); GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.CHINA.getCountry(), "cn"); GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.FRANCE.getCountry(), "fr"); GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.GERMANY.getCountry(), "de"); GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.ITALY.getCountry(), "it"); GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.JAPAN.getCountry(), "co.jp"); GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("NL", "nl"); // NETHERLANDS GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("ES", "es"); // SPAIN GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.UK.getCountry(), "co.uk"); GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.US.getCountry(), "com"); }
@Test public void testGetterAndSetter() { InternationalStandardRecordingCode isrc = new InternationalStandardRecordingCode(); isrc.setCountry(Locale.GERMANY.getCountry()); Assert.assertEquals(Locale.GERMANY.getCountry(), isrc.getCountry()); isrc.setRegistrant("AAA"); Assert.assertEquals("AAA", isrc.getRegistrant()); isrc.setRegistrant("Aaa"); Assert.assertEquals("AAA", isrc.getRegistrant()); isrc.setYear(3); Assert.assertEquals(3, isrc.getYear()); isrc.setYear(3); Assert.assertEquals(3, isrc.getYear()); isrc.setNumber(1); Assert.assertEquals(1, isrc.getNumber()); }
///////////////////////////////////////////////////////////////////////////////////// // Construct public static void main(String[] args) { console = false; // Locale currentLocale = Locale.getDefault(); // TODO!!!: currentLocale = new Locale("en", "US"); // currentBundle = ResourceBundle.getBundle("LanguageBundle"); currentBundle = ResourceBundle.getBundle("LanguageBundle", currentLocale); System.out.println(currentBundle.getString("Welcome")); if (getGermanDate() == null) { Locale locDE = new Locale(Locale.GERMANY.getCountry()); setDateFormatGermany(DateFormat.getDateInstance(DateFormat.FULL, locDE)); } launcher = new ExamenVerwaltung(); // args = new String[] { "asasas", "54908" }; String osname = System.getProperty("os.name"); if (!(osname.regionMatches(true, 0, "Windows", 0, 7))) { System.out.println(currentBundle.getString("ps.linux")); // System.out.println( // "Was ist das denn für ein Dreck, wo ist meine Windows API // hin?\nNa da darfst du jetzt schön tippen mein Freund, klicken is // nicht.\r\n"); console = true; } else if (args.length > 0) { // TODO: LANGUAGE if (args[0].equalsIgnoreCase("DEBUG")) { System.out.println("<Rebug-Mode>"); console = true; launcher.setVisible(true); } else { console = true; String out = ""; // String add = "hat er"; // String it = "er steht"; String it = getText("no.use/s"); String param = getText("your/s"); for (int index = 0; index < args.length; index++) { if (index != args.length - 1 && index > 0) { out += ", "; } else if (index == args.length - 1) { out += " und "; } // add = "haben sie"; // it = "sie stehen"; param = getText("your/m"); out += args[index]; it = getText("no.use/m"); } System.out.println( getText("thank.you.for") + " " + param + " Parameter " + out + ",\n" + it); System.out.println(); launcher.setVisible(false); } } else { launcher.setVisible(!console); } if (console) { shell = new Shell(); shell.Start(console); getInstance().closeConnections(); System.exit(0); } }