blob: 518fa12d4143bf1d1b0e58fc220af8b0e2256357 [file] [log] [blame]
<!-- © 2019 and later: Unicode, Inc. and others.
License & terms of use: -->
To build ICU data files:
1: Determine the CLDR base directory and set the CLDR_DIR environment variable.
2: Determine the flags required (see the list of properties below).
3: Run: ant -f build-icu-data.xml -D<flag-name>=<flag-value>...
<!-- TODO: Add things like copying of a template directory and deleting previous files
(perhaps always generate into a temporary directory and copy back to avoid having
inconsistent state when the conversion is cancelled). -->
<project name="Convert" default="all" basedir=".">
<target name="all" depends="init-args, prepare-jar, clean, convert"/>
<!-- Initialize the properties which were not already set on the command line. -->
<target name="init-args">
<property environment="env"/>
<condition property="hascldrdir" >
<isset property="env.CLDR_DIR" />
<fail unless="hascldrdir"
message="Please set the CLDR_DIR environment variable to the top level CLDR source dir (containing 'common')."/>
<!-- The base directory of the CLDR release from which CLDR data is obtained. For
legacy reasons, this must also match an environment variable called CLDR_DIR,
which is read here, so it is best to set this via the environment variable for
now. -->
<!-- TODO: Update this when the CLDR_DIR environment variable is no longer needed. -->
<property name="cldrDir" value="${env.CLDR_DIR}"/>
<!-- The output directory into which to write the converted ICU data. By default
this will overwrite (without deletion) the ICU data files in this ICU release,
so it is recommended that for testing, it be set to another value. -->
<property name="outDir" value="${basedir}/../../../icu4c/source/data/"/>
<!-- The directory in which the additional ICU XML data is stored. -->
<property name="specialsDir" value="${basedir}/../../../icu4c/source/data/xml"/>
<!-- An override for the CLDR version string to be used in generated data. -->
<property name="cldrVersion" value=""/>
<!-- The minimum draft status for CLDR data to be used in the conversion. See
CldrDraftStatus for more details. -->
<property name="minDraftStatus" value="contributed"/>
<!-- A regular expression to match the locale IDs to be generated (useful for
debugging specific regions). This is applied after locale ID specifications
have been expanded into full locale IDs, so the value "en" will NOT match
"en_GB" or "en_001" etc. -->
<property name="localeIdFilter" value=""/>
<!-- Whether to synthetically generate "pseudo locale" data ("en_XA" and "ar_XB"). -->
<property name="includePseudoLocales" value="false"/>
<!-- Whether to emit a debug report containing some possibly useful information after
the conversion has finished. -->
<!-- TODO: Currently this isn't hugely useful, so find out what people want. -->
<property name="emitReport" value="false"/>
<!-- List of output "types" to be generated (e.g. "rbnf,plurals,locales"); an empty
list means "build everything".
Note that the grouping of types is based on the legacy converter behaviour and
is not always directly associated with an output directory (e.g. "locales"
produces locale data for curr/, lang/, main/, region/, unit/, zone/ but NOT
coll/, brkitr/ or rbnf/).
Pass in the value "HELP" (or any invalid value) to see the full list of types. -->
<!-- TODO: Find out what common use cases are and use them. -->
<property name="outputTypes" value=""/>
<!-- Override to force the 'clean' task to delete files it cannot determine to be
auto-generated by this tool. This is useful if the file header changes since
the heading is what's used to recognize auto-generated files. -->
<property name="forceDelete" value="false"/>
<!-- Build a standalone JAR which is called by Ant (and which avoids needing to mess
about making Ant know the Maven class-path). -->
<target name="prepare-jar" depends="init-args">
<exec executable="mvn" searchpath="true">
<arg value="compile"/>
<!-- Do the actual CLDR data conversion, based on the command line arguments, built in
default properties and the configuration in the "<convert>" element below. -->
<target name="convert" depends="init-args, prepare-jar">
<taskdef name="convert" classname="">
<pathelement path="target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar"/>
<convert cldrDir="${cldrDir}" outputDir="${outDir}" specialsDir="${specialsDir}"
outputTypes="${outputTypes}" cldrVersion="${cldrVersion}"
minimalDraftStatus="${minDraftStatus}" localeIdFilter="${localeIdFilter}"
includePseudoLocales="${includePseudoLocales}" emitReport="${emitReport}">
<!-- The primary set of locale IDs to be generated by default. The IDs in this list are
automatically expanded to include default scripts and all available regions. The
rules are:
1) Base languages are expanded to include default scripts (e.g. "en" -> "en_Latn").
2) All region and variant subtags are added for any base language or language+script
(e.g. "en" -> "en_GB" or "shi_Latn" -> "shi_Latn_MA").
If a non-default script is desired it should be listed explicitly (e.g. "sr_Latn").
Locale IDs with deprecated subtags (which become aliases) must still be listed in
full (e.g. "en_RH" or "sr_Latn_YU").
// A
af, agq, ak, am, ar, ars, as, asa, ast, az, az_AZ, az_Cyrl
// B
bas, be, bem, bez, bg, bm, bn, bo, br, brx, bs, bs_BA, bs_Cyrl
// C
ca, ccp, ce, ceb, cgg, chr, ckb, cs, cy
// D
da, dav, de, dje, dsb, dua, dyo, dz
// E
ebu, ee, el, en, en_NH, en_RH, eo, es, et, eu, ewo
// F
fa, ff, ff_Adlm, ff_CM, ff_GN, ff_MR, ff_SN, fi, fil, fo, fr, fur, fy
// G
ga, gd, gl, gsw, gu, guz, gv
// H
ha, haw, he, hi, hr, hsb, hu, hy
// I
ia, id, ig, ii, in, in_ID, is, it, iw, iw_IL
// J
ja, jgo, jmc, jv
// K
ka, kab, kam, kde, kea, khq, ki, kk, kkj, kl, kln, km, kn, ko, kok, ks
ks_IN, ksb, ksf, ksh, ku, kw, ky
// L
lag, lb, lg, lkt, ln, lo, lrc, lt, lu, luo, luy, lv
// M
mai, mas, mer, mfe, mg, mgh, mgo, mi, mk, ml, mn, mni, mni_IN, mo, mr, ms
mt, mua, my, mzn
// N
naq, nb, nd, nds, ne, nl, nmg, nn, nnh, no, no_NO, no_NO_NY, nus, nyn
// O
om, or, os
// P
pa, pa_Arab, pa_IN, pa_PK, pcm, pl, ps, pt
// Q
// R
rm, rn, ro, rof, ru, rw, rwk
// S
sah, saq, sat, sat_IN, sbp, sd, sd_Deva, sd_PK, se, seh, ses, sg, sh, sh_BA, sh_CS, sh_YU
shi, shi_Latn, shi_MA, si, sk, sl, smn, sn, so, sq, sr, sr_BA, sr_CS, sr_Cyrl_CS, sr_Cyrl_YU, sr_Latn
sr_Latn_CS, sr_Latn_YU, sr_ME, sr_RS, sr_XK, sr_YU, su, su_ID, sv, sw
// T
ta, te, teo, tg, th, ti, tk, tl, tl_PH, to, tr, tt, twq, tzm
// U
ug, uk, ur, uz, uz_AF, uz_Arab, uz_Cyrl, uz_UZ
// V
vai, vai_LR, vai_Latn, vi, vun
// W
wae, wo
// X
xh, xog
// Y
yav, yi, yo, yue, yue_CN, yue_HK, yue_Hans
// Z
zgh, zh, zh_CN, zh_HK, zh_Hant, zh_MO, zh_SG, zh_TW, zu
<!-- The following elements configure directories in which a subset of the available
locales IDs should be generated. Unlike the main <localeId> element, these
filters must specify all locale IDs in full (but since they mostly select base
languages, this isn't a big deal).
As well as allowing some data directories to have a subset of available data (via
the <localeIds> element) there are also mechanisms for controlling aliasing and
the locale parent relation which allows the sharing of some ICU data in cases
where it would otherwise need to be copied. The two mechanisms are:
1: inheritLanguageSubtag: Used to rewrite the parent of a locale ID from "root" to
its language subtag (e.g. "zh_Hant" has a natural parent of "root", but to allow
some base language data to be shared it can be made to have a parent of "zh").
2: forcedAlias: Used to add aliases for specific directories in order to affect the
ICU behaviour in special cases.
Between them these mechanisms are known as "tailorings" of the affected locales. -->
<!-- TODO: Explain why these special cases are needed/different. -->
<!-- Collation data is large, but also more sharable than other data, which is why there
are a number of aliases and parent remappings for this directory. -->
<directory dir="coll" inheritLanguageSubtag="bs_Cyrl, sr_Latn, zh_Hant">
<!-- These aliases are to avoid needing to copy and maintain the same collation data
for "zh" and "yue". The maximized versions of "yue_Hans" is "yue_Hans_CN" (vs
"zh_Hans_CN"), and for "yue" it's "yue_Hant_HK" (vs "zh_Hant_HK"), so the
aliases are effectively just rewriting the base language. -->
<forcedAlias source="yue" target="zh_Hant"/>
<forcedAlias source="yue_Hant" target="zh_Hant"/>
<forcedAlias source="yue_CN" target="zh_Hans"/>
<forcedAlias source="yue_Hans" target="zh_Hans"/>
<forcedAlias source="yue_Hans_CN" target="zh_Hans"/>
<!-- TODO: Find out and document this properly. -->
<forcedAlias source="sr_ME" target="sr_Cyrl_ME"/>
// A-B
af, am, ars, ar, as, az, be, bg, bn, bo, bs_Cyrl, bs,
// C-F
ca, ceb, chr, cs, cy, da, de_AT, de, dsb, dz, ee, el, en,
en_US_POSIX, en_US, eo, es, et, fa_AF, fa, ff_Adlm, ff, fil, fi, fo, fr_CA, fr,
// G-J
ga, gl, gu, ha, haw, he, hi, hr, hsb, hu, hy,
id_ID, id, ig, in, in_ID, is, it, iw_IL, iw, ja,
// K-P
ka, kk, kl, km, kn, kok, ko, ku, ky, lb, lkt, ln, lo, lt, lv,
mk, ml, mn, mo, mr, ms, mt, my, nb, ne, nl, nn, no_NO, no,
om, or, pa_IN, pa, pa_Guru, pl, ps, pt,
// R-T
ro, ru, se, sh_BA, sh_CS, sh, sh_YU, si, sk, sl, smn, sq,
sr_BA, sr_Cyrl_ME, sr_Latn, sr_ME, sr_RS, sr, sv, sw,
ta, te, th, tk, to, tr,
// U-Z
ug, uk, ur, uz, vi, wae, wo, xh, yi, yo, yue_CN, yue_Hans_CN, yue_Hans
yue_Hant, yue, zh_CN, zh_Hans, zh_Hant, zh_HK, zh_MO, zh_SG, zh_TW, zh, zu
<directory dir="rbnf">
<!-- It is not at all clear why this is being done. It's certainly not exactly the
same as above, since (a) the alias is reversed (b) "zh_Hant" does exist, with
different data than "yue", so this alias is not just rewriting the base
language. -->
<!-- TODO: Find out and document this properly. -->
<forcedAlias source="zh_Hant_HK" target="yue"/>
// A-E
af, ak, am, ars, ar, az, be, bg, bs, ca, ccp, chr, cs, cy,
da, de_CH, de, ee, el, en_001, en_IN, en, eo, es_419, es_DO,
es_GT, es_HN, es_MX, es_NI, es_PA, es_PR, es_SV, es, es_US, et,
// F-P
fa_AF, fa, ff, fil, fi, fo, fr_BE, fr_CH, fr, ga, he, hi, hr,
hu, hy, id, in, is, it, iw, ja, ka, kl, km, ko, ky, lb,
lo, lrc, lt, lv, mk, ms, mt, my, nb, nl, nn, no, pl, pt_PT, pt,
// Q-Z
qu, ro, ru, se, sh, sk, sl, sq, sr_Latn, sr, su, sv, sw, ta, th, tr,
uk, vi, yue_Hans, yue, zh_Hant_HK, zh_Hant, zh_HK, zh_MO, zh_TW, zh
<directory dir="brkitr" inheritLanguageSubtag="zh_Hant">
de, el, en, en_US_POSIX, en_US, es, fr, it, ja, pt, ru, zh_Hant, zh
<!-- Some spoken languages (e.g. "ars") inherit all their data from a written language
(e.g. "ar_SA"). However CLDR doesn't currently support a way to represent that
relationship. Unlike deprecated languages for which an alias can be inferred from
the "languageAlias" CLDR data, there's no way in CLDR to represent the fact that
we want "ars" (a non-deprecated language) to inherit the data of "ar_SA".
This alias is the first example of potentially many cases where ICU needs to
generate an alias in order to affect "sideways inheritance" for spoken languages,
and at some stage it should probably be supported properly in the CLDR data. -->
<forcedAlias source="ars" target="ar_SA"/>
<!-- A legacy global alias (note that "no_NO_NY" is not even structurally valid). -->
<forcedAlias source="no_NO_NY" target="nn_NO"/>
<!-- The following elements configure alternate values for some special case paths.
The target path will only be replaced if both it, and the source path, exist in
the CLDR data (paths will not be modified if only the source path exists).
Since the paths must represent the same semantic type of data, they must be in the
same "namespace" (same element names) and must not contain value attributes. Thus
they can only differ by distinguishing attributes (either added or modified).
This feature is typically used to select alternate translations (e.g. short forms)
for certain paths. -->
<!-- <altPath target="//path/to/value[@attr='foo']"
locales="xx,yy_ZZ"/> -->
<target name="clean" depends="init-args, prepare-jar">
<taskdef name="outputDirectories" classname="">
<pathelement path="target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar"/>
<outputDirectories root="${outDir}" forceDelete="${forceDelete}">
<dir name="brkitr">
<retain path="dictionaries"/>
<retain path="rules"/>
<dir name="coll">
<retain path="de__PHONEBOOK.txt"/>
<retain path="de_.txt"/>
<retain path="es__TRADITIONAL.txt"/>
<retain path="es_.txt"/>
<dir name="curr"/>
<dir name="lang"/>
<dir name="locales"/>
<dir name="misc">
<retain path="currencyNumericCodes.txt"/>
<retain path="icudata.rc"/>
<retain path="icustd.txt"/>
<retain path="icuver.txt"/>
<retain path="langInfo.txt"/>
<retain path="zoneinfo64.txt"/>
<!-- This file should be removed before the next release. -->
<retain path=""/>
<dir name="rbnf"/>
<dir name="region"/>
<dir name="translit">
<retain path="en.txt"/>
<retain path="el.txt"/>
<!-- This file should be removed before the next release. -->
<retain path=""/>
<dir name="unit"/>
<dir name="zone">
<retain path="tzdbNames.txt"/>