From 5fbb6b46f07ef003780ee468d1113705b3a96531 Mon Sep 17 00:00:00 2001 From: Mark Davis Date: Mon, 2 Mar 2020 19:11:31 -0800 Subject: [PATCH] CLDR-13587 Fix the validity files as per BRS A18.5. Includes tool changes to make the changes in-place, and use the DtdType.xxx.header appropriately. (#370) --- common/validity/currency.xml | 2 +- common/validity/subdivision.xml | 12 ++++++------ .../org/unicode/cldr/tool/GenerateDayPeriods.java | 3 ++- .../org/unicode/cldr/tool/GenerateValidityXml.java | 5 ++--- tools/java/org/unicode/cldr/tool/ToolConstants.java | 1 + tools/java/org/unicode/cldr/util/CLDRPaths.java | 2 +- tools/java/org/unicode/cldr/util/DtdType.java | 5 +++++ 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/common/validity/currency.xml b/common/validity/currency.xml index 94f58a92795..c28582e17ae 100644 --- a/common/validity/currency.xml +++ b/common/validity/currency.xml @@ -41,7 +41,7 @@ YER ZAR ZMW - ADP AFA ALK AOK AON AOR ARA ARL~M ARP ATS AZM diff --git a/common/validity/subdivision.xml b/common/validity/subdivision.xml index 10f0cc0cfca..19b0a34530c 100644 --- a/common/validity/subdivision.xml +++ b/common/validity/subdivision.xml @@ -13,7 +13,7 @@ - + ad02~8 aeaj aeaz aedu aefu aerk aesh aeuq afbal~m afbdg afbds afbgl afday affra affyb afgha afgho afhel afher afjow afkab afkan afkap afkdz afkho afknr aflag aflog afnan afnim afnur afpan afpar afpia afpka afsam afsar aftak afuru afwar afzab @@ -98,7 +98,7 @@ iqan iqar iqba~b iqbg iqda iqdi iqdq iqka iqki iqma iqmu iqna iqni iqqa iqsd iqsu iqwa ir01~8 ir10~9 ir20~9 ir30~2 is1~8 - it21 it23 it25 it32 it34 it36 it42 it45 it52 it55 it57 it62 it65 it67 it72 it75 it77~8 it82 it88 itag ital itan~r itat itav itba itbg itbi itbl itbn~o itbr~t itbz itca~b itce itch~i itcl itcn~o itcr~t itcz iten itfc itfe itfg itfi itfm itfr itge itgo itgr itim itis itkr itlc itle itli itlo itlt~u itmb~c itme itmi itmn~o itms~t itna itno itnu itog itor itot itpa itpc~e itpg itpi itpn~o itpr itpt~v itpz itra itrc itre itrg itri itrm~o itsa itsi itso~p itsr~s itsv itta itte ittn~p ittr~s ittv itud itva~c itve itvi itvr~t itvv + it21 it23 it25 it32 it34 it36 it42 it45 it52 it55 it57 it62 it65 it67 it72 it75 it77~8 it82 it88 itag ital itan~r itat itav itba itbg itbi itbl itbn~o itbr~t itbz itca~b itce itch itcl itcn~o itcr~t itcz iten itfc itfe itfg itfi itfm itfr itge itgr itim itis itkr itlc itle itli itlo itlt~u itmb~c itme itmi itmn~o itms~t itna itno itnu itor itpa itpc~e itpg itpi itpo itpr itpt~v itpz itra itrc itre itrg itri itrm~o itsa itsd itsi itso~p itsr~s itsv itta itte ittn~p ittr ittv itva~c itve itvi itvr itvt itvv jm01~9 jm10~4 joaj joam joaq joat joaz joba joir joja joka joma jomd jomn jp01~9 jp10~9 jp20~9 jp30~9 jp40~7 @@ -146,7 +146,7 @@ ngab ngad ngak ngan ngba ngbe ngbo ngby ngcr ngde ngeb nged ngek ngen ngfc nggo ngim ngji ngkd~e ngkn~o ngkt ngkw ngla ngna ngni ngog ngon ngos ngoy ngpl ngri ngso ngta ngyo ngza nian nias nibo nica nici nico nies nigr niji nile nimd nimn nims~t nins niri nisj nlbq1~3 nldr nlfl nlfr nlge nlgr nlli nlnb nlnh nlov nlut nlze nlzh - no01~9 no10~2 no14~5 no18~9 no20~3 + no01~9 no10~2 no14~5 no18~9 no20~2 no50 np1~5 npba npbh npdh npga npja npka npko nplu npma npme npna npp1~7 npra npsa npse nr01~9 nr10~4 nzauk nzbop nzcan nzcit nzgis nzhkb nzmbh nzmwt nznsn nzntl nzota nzstl nztas nztki nzwgn nzwko nzwtc @@ -217,17 +217,17 @@ - + albr albu aldi aldl aldr aldv alel aler alfr algj algr alha alka~c alko alkr alku allb alle allu almk almm almr almt alpg alpq~r alpu alsh alsk alsr alte altp altr alvl ba01~9 ba10 bh16 cdbn cdka cdkw cdor ci01~9 ci10~9 cn11~5 cn21~3 cn31~7 cn41~6 cn50~4 cn61~5 cn71 cn91~2 cz101~9 cz10a~f cz110~9 cz120~2 cz611~5 cz621~7 czjc czjm czka czkr czli czmo czol czpa czpl czpr czst czus czvy czzl escn fi01 fra~b frbl frc frcp frd~g frgf frgp frh~m frmf frmq frn frnc fro~p frpf frpm frq~r frre frs~t frtf fru~v frwf fryt gbant gbard gbarm gbbla gbbly gbbnb gbcgv gbckf gbckt gbclr gbcsr gbdgn gbdow gbdry gbfer gblmv gblrn gblsb gbmft gbmyl gbndn gbnta gbnym gbomh gbstb glqa gr01 gr03~7 gr11~7 gr21~4 gr31~4 gr41~4 gr51~9 gr61~4 gr71~3 gr81~5 gr91~4 gra1 - is0 + is0 itci itgo itog itot itpn itts itud itvs laxn lud lug lul ma13~6 mammd mammn masyb mk01 mk09 mk15 mk17 mk28~9 mk31 mk38~9 mk57 mk68 mk77 mk79 mk84 mrnkc mvce mvnc mvno mvsc mvsu mvun mvus mxdif - nlaw nlcw nlsx no16~7 nzn nzs + nlaw nlcw nlsx no16~7 no23 nzn nzs omba omsh plds plkp pllb plld pllu plma plmz plop plpd plpk plpm plsk~l plwn plwp plzp shta diff --git a/tools/java/org/unicode/cldr/tool/GenerateDayPeriods.java b/tools/java/org/unicode/cldr/tool/GenerateDayPeriods.java index 1996ef7481d..2bc111f224d 100644 --- a/tools/java/org/unicode/cldr/tool/GenerateDayPeriods.java +++ b/tools/java/org/unicode/cldr/tool/GenerateDayPeriods.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.io.PrintWriter; +import java.lang.invoke.MethodHandles; import java.util.Map; import java.util.Set; import java.util.TreeMap; @@ -26,7 +27,7 @@ public class GenerateDayPeriods { public static void main(String[] args) throws IOException { try (PrintWriter out = FileUtilities.openUTF8Writer(CLDRPaths.GEN_DIRECTORY + "/supplemental", "dayPeriods.xml")) { - out.println(DtdType.supplementalData.header(null) + out.println(DtdType.supplementalData.header(MethodHandles.lookup().lookupClass()) + "\t"); Factory factory = CLDRConfig.getInstance().getCldrFactory(); for (Type type : Type.values()) { diff --git a/tools/java/org/unicode/cldr/tool/GenerateValidityXml.java b/tools/java/org/unicode/cldr/tool/GenerateValidityXml.java index 40367ae06ac..55db9b6731d 100644 --- a/tools/java/org/unicode/cldr/tool/GenerateValidityXml.java +++ b/tools/java/org/unicode/cldr/tool/GenerateValidityXml.java @@ -1,7 +1,6 @@ package org.unicode.cldr.tool; import java.io.IOException; -import java.io.PrintWriter; import java.lang.invoke.MethodHandles; import java.util.Collection; import java.util.Date; @@ -15,7 +14,6 @@ import java.util.TreeMap; import java.util.TreeSet; -import org.unicode.cldr.draft.FileUtilities; import org.unicode.cldr.draft.ScriptMetadata; import org.unicode.cldr.util.CLDRPaths; import org.unicode.cldr.util.CLDRTool; @@ -27,6 +25,7 @@ import org.unicode.cldr.util.StringRange.Adder; import org.unicode.cldr.util.SupplementalDataInfo; import org.unicode.cldr.util.SupplementalDataInfo.CurrencyDateInfo; +import org.unicode.cldr.util.TempPrintWriter; import org.unicode.cldr.util.Validity; import org.unicode.cldr.util.Validity.Status; @@ -146,7 +145,7 @@ public static void main(String[] args) throws IOException { String type = entry.getKey(); final Info info = entry.getValue(); Multimap subtypeMap = info.getStatusMap(); - try (PrintWriter output = FileUtilities.openUTF8Writer(CLDRPaths.GEN_DIRECTORY, "validity/" + type + ".xml")) { + try (TempPrintWriter output = TempPrintWriter.openUTF8Writer(CLDRPaths.COMMON_DIRECTORY, "validity/" + type + ".xml")) { adder.target = output; output.append(DtdType.supplementalData.header(MethodHandles.lookup().lookupClass()) + "\t\n" diff --git a/tools/java/org/unicode/cldr/tool/ToolConstants.java b/tools/java/org/unicode/cldr/tool/ToolConstants.java index 2b3ef8180b6..c0cf5651fa6 100644 --- a/tools/java/org/unicode/cldr/tool/ToolConstants.java +++ b/tools/java/org/unicode/cldr/tool/ToolConstants.java @@ -35,6 +35,7 @@ public enum ChartStatus { // allows overriding with -D public static final String CHART_VERSION = CldrUtility.getProperty("CHART_VERSION", DEFAULT_CHART_VERSION); public static final String LAST_CHART_VERSION = Integer.parseInt(CHART_VERSION) + ".0"; // must have 1 decimal + public static final String LAST_RELEASE_VERSION_WITH0 = Integer.parseInt(LAST_RELEASE_VERSION) + ".0"; // must have 1 decimal public static final ChartStatus CHART_STATUS = !CHART_VERSION.equals(DEFAULT_CHART_VERSION) ? ChartStatus.release : ChartStatus.valueOf(CldrUtility.getProperty("CHART_STATUS", DEFAULT_CHART_STATUS.toString())); diff --git a/tools/java/org/unicode/cldr/util/CLDRPaths.java b/tools/java/org/unicode/cldr/util/CLDRPaths.java index aedeaf976c9..1c36237f6e3 100644 --- a/tools/java/org/unicode/cldr/util/CLDRPaths.java +++ b/tools/java/org/unicode/cldr/util/CLDRPaths.java @@ -82,7 +82,7 @@ public class CLDRPaths { public static final String ARCHIVE_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("ARCHIVE", CldrUtility.getPath(LOCAL_DIRECTORY, "cldr-archive/"))); public static final String LAST_DIRECTORY = ARCHIVE_DIRECTORY + "cldr-" + ToolConstants.PREVIOUS_CHART_VERSION + "/"; - public static final String LAST_RELEASE_DIRECTORY = ARCHIVE_DIRECTORY + "cldr-" + ToolConstants.LAST_RELEASE_VERSION + "/"; + public static final String LAST_RELEASE_DIRECTORY = ARCHIVE_DIRECTORY + "cldr-" + ToolConstants.LAST_RELEASE_VERSION_WITH0 + "/"; public static final String LAST_COMMON_DIRECTORY = CldrUtility.getPath(CLDRPaths.LAST_DIRECTORY, "common/"); public static final String LAST_TRANSFORMS_DIRECTORY = CldrUtility.getPath(CLDRPaths.LAST_COMMON_DIRECTORY, TRANSFORMS_SUBDIR); diff --git a/tools/java/org/unicode/cldr/util/DtdType.java b/tools/java/org/unicode/cldr/util/DtdType.java index 1db03530a3a..9afca8a0a11 100644 --- a/tools/java/org/unicode/cldr/util/DtdType.java +++ b/tools/java/org/unicode/cldr/util/DtdType.java @@ -59,6 +59,11 @@ public static DtdType fromPath(String elementOrPath) { return DtdType.valueOf(m.group(1)); } + /** + * Print a header for an XML file, where the generatedBy is normally MethodHandles.lookup().lookupClass(). The only time it needs to be changed is if it is not being called directly from the generating tool. + * @param generatedBy + * @return + */ public String header(Class generatedBy) { String gline = ""; if (generatedBy != null) {