MCPcopy
hub / github.com/daviddrysdale/python-phonenumbers / main

Method main

tools/python/DumpLocale.java:74–108  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

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}

Callers 5

testwrapper.pyFile · 0.80
testpb2.pyFile · 0.80
testwrapper.pyFile · 0.80
__init__.pyFile · 0.80
__init__.pyFile · 0.80

Calls 3

printPrologMethod · 0.95
printNameMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected