(String[] args)
| 72 | } |
| 73 | |
| 74 | public static void main(String[] args) { |
| 75 | // Check for mode |
| 76 | printProlog(); |
| 77 | System.out.println("LOCALE_DATA = {"); |
| 78 | String[] all_countries = Locale.getISOCountries(); |
| 79 | String[] all_langs = Locale.getISOLanguages(); |
| 80 | // Name => first language code that maps to that name |
| 81 | HashMap<String, String> name_to_lang = new HashMap<String, String>(); |
| 82 | for (String country: all_countries) { |
| 83 | System.out.print(" '"+country+"': {"); |
| 84 | Locale country_locale = new Locale("", country); |
| 85 | for (String lang: all_langs) { |
| 86 | Locale lang_locale = new Locale(lang); |
| 87 | String country_in_lang = country_locale.getDisplayCountry(lang_locale); |
| 88 | if ((country_in_lang != null) && (country_in_lang.length() != 0)) { |
| 89 | String previous_lang = name_to_lang.get(country_in_lang); |
| 90 | if (previous_lang != null) { |
| 91 | // Already seen this name before. Print the name as "*<otherlang>" |
| 92 | // on the assumption that this will save a lot of space (about 30%) |
| 93 | System.out.print("'"+lang+"':"); |
| 94 | System.out.print("'*"+previous_lang+"'"); |
| 95 | System.out.print(","); |
| 96 | } else { |
| 97 | // First time we've seen this name |
| 98 | name_to_lang.put(country_in_lang, lang); |
| 99 | System.out.print("'"+lang+"':"); |
| 100 | printName(country_in_lang); |
| 101 | System.out.print(","); |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | System.out.println("},"); |
| 106 | } |
| 107 | System.out.println("}"); |
| 108 | } |
| 109 | } |
no test coverage detected