make/src/classes/build/tools/cldrconverter/ResourceBundleGenerator.java

Print this page
rev 10560 : 8038436: Re-examine the mechanism to determine available localedata and cldrdata
Reviewed-by:

*** 157,176 **** try (PrintWriter out = new PrintWriter(file, "us-ascii")) { out.println(CopyrightHeaders.getOpenJDKCopyright()); out.println("package sun.util.cldr;\n\n" ! + "import java.util.ListResourceBundle;\n"); ! out.printf("public class %s extends ListResourceBundle {\n", METAINFO_CLASS); out.println(" @Override\n" + " protected final Object[][] getContents() {\n" + " final Object[][] data = new Object[][] {"); for (String key : metaInfo.keySet()) { out.printf(" { \"%s\",\n", key); out.printf(" \"%s\" },\n", toLocaleList(metaInfo.get(key))); } ! out.println(" };\n return data;\n }\n}"); } } private static String toLocaleList(SortedSet<String> set) { StringBuilder sb = new StringBuilder(set.size() * 6); --- 157,186 ---- try (PrintWriter out = new PrintWriter(file, "us-ascii")) { out.println(CopyrightHeaders.getOpenJDKCopyright()); out.println("package sun.util.cldr;\n\n" ! + "import java.util.ListResourceBundle;\n" ! + "import sun.util.locale.provider.LocaleProviderAdapter;\n" ! + "import sun.util.locale.provider.LocaleDataMetaInfo;\n"); ! out.printf("public class %s extends ListResourceBundle implements LocaleDataMetaInfo {\n", METAINFO_CLASS); out.println(" @Override\n" + " protected final Object[][] getContents() {\n" + " final Object[][] data = new Object[][] {"); for (String key : metaInfo.keySet()) { out.printf(" { \"%s\",\n", key); out.printf(" \"%s\" },\n", toLocaleList(metaInfo.get(key))); } ! out.println(" };\n return data;\n }\n\n"); ! ! out.println(" public LocaleProviderAdapter.Type getType() {\n" + ! " return LocaleProviderAdapter.Type.CLDR;\n" + ! " }\n\n"); ! ! out.println(" public String availableLanguageTags(String category) {\n" + ! " return getString(category);\n" + ! " };\n}"); } } private static String toLocaleList(SortedSet<String> set) { StringBuilder sb = new StringBuilder(set.size() * 6);