Skip to content

Commit

Permalink
CLDR-13587 Fix the validity files as per BRS A18.5. Includes tool cha…
Browse files Browse the repository at this point in the history
…nges to make the changes in-place, and use the DtdType.xxx.header appropriately. (#370)
  • Loading branch information
macchiati authored Mar 3, 2020
1 parent 7600022 commit 5fbb6b4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion common/validity/currency.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
YER
ZAR ZMW
</id>
<!-- Deprecated values are those that are not legal tender in some country after 2019.
<!-- Deprecated values are those that are not legal tender in some country after 2020.
More detailed usage information needed for some implementations is in supplemental data. -->
<id type='currency' idStatus='deprecated'> <!-- 147 items -->
ADP AFA ALK AOK AON AOR ARA ARL~M ARP ATS AZM
Expand Down
12 changes: 6 additions & 6 deletions common/validity/subdivision.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<supplementalData>
<version number="$Revision$"/>
<idValidity>
<id type='subdivision' idStatus='regular'> <!-- 4940 items -->
<id type='subdivision' idStatus='regular'> <!-- 4933 items -->
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -217,17 +217,17 @@
</id>
<!-- Deprecated values include those that are not formally deprecated in the country in question, but have their own region codes.
It also include codes that were previously in CLDR, for compatibility. -->
<id type='subdivision' idStatus='deprecated'> <!-- 346 items -->
<id type='subdivision' idStatus='deprecated'> <!-- 355 items -->
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
Expand Down
3 changes: 2 additions & 1 deletion tools/java/org/unicode/cldr/tool/GenerateDayPeriods.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<version number=\"$Revision" /* bypass SVN */ + "$\"/>");
Factory factory = CLDRConfig.getInstance().getCldrFactory();
for (Type type : Type.values()) {
Expand Down
5 changes: 2 additions & 3 deletions tools/java/org/unicode/cldr/tool/GenerateValidityXml.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -146,7 +145,7 @@ public static void main(String[] args) throws IOException {
String type = entry.getKey();
final Info info = entry.getValue();
Multimap<Status, String> 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<version number=\"$Revision" /*hack to stop SVN changing this*/ + "$\"/>\n"
Expand Down
1 change: 1 addition & 0 deletions tools/java/org/unicode/cldr/tool/ToolConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down
2 changes: 1 addition & 1 deletion tools/java/org/unicode/cldr/util/CLDRPaths.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions tools/java/org/unicode/cldr/util/DtdType.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5fbb6b4

Please sign in to comment.