@@ -172,63 +172,7 @@ the resulting formulas will be in this format:
172172
173173### Generating the CLDR data
174174This repository uses the CLDR data, including American English (` en_US ` ) json files.
175- In order to generate this data, you can use Docker.
176- Start a new Docker container by running
177-
178- ``` sh
179- docker run --rm -it -v path/to/src/cldr-data:/output alpine:3.13 sh
180- ```
181-
182- Then run the following script, setting the values of the variables accordingly to your needs:
183-
184- ``` sh
185- # The value of the CLDR version (eg 39, 38.1, ...)
186- CLDR_VERSION=39
187- # Your GitHub username (required since CLDR 38) - see http://cldr.unicode.org/development/maven#TOC-Introduction
188- GITHUB_USERNAME=
189- # Your GitHub personal access token (required since CLDR 38) - see http://cldr.unicode.org/development/maven#TOC-Introduction
190- GITHUB_TOKEN=
191-
192- if ! test -d /output; then
193- echo ' Missing output directory' >&2
194- return 1
195- fi
196- apk -U upgrade
197- apk add --no-cache git git-lfs openjdk8 apache-ant maven
198- CLDR_MAJORVERSION=" $( printf ' %s' " $CLDR_VERSION " | sed -E ' s/^([0-9]+).*/\1/' ) "
199- SOURCE_DIR=" $( mktemp -d) "
200- DESTINATION_DIR=" $( mktemp -d) "
201- git clone --single-branch --depth=1 " --branch=release-$( printf ' %s' " $CLDR_VERSION " | tr ' .' ' -' ) " https://github.com/unicode-org/cldr.git " $SOURCE_DIR "
202- if test $CLDR_MAJORVERSION -lt 38; then
203- git -C " $SOURCE_DIR " lfs pull --include tools/java || true
204- ant -f " $SOURCE_DIR /tools/java/build.xml" jar
205- JARFILE=" $SOURCE_DIR /tools/java/cldr.jar"
206- DESTINATION_DIR_LOCALE=" $DESTINATION_DIR /en_US"
207- DESTINATION_FILE_PLURALS=" $DESTINATION_DIR /supplemental/plurals.json"
208- else
209- if test -z " ${GITHUB_USERNAME:- } " ; then
210- echo ' GITHUB_USERNAME is missing' >&2
211- return 1
212- fi
213- if test -z " ${GITHUB_TOKEN:- } " ; then
214- echo ' GITHUB_TOKEN is missing' >&2
215- return 1
216- fi
217- printf ' <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"><servers><server><id>githubicu</id><username>%s</username><password>%s</password></server></servers></settings>' " $GITHUB_USERNAME " " $GITHUB_TOKEN " > " $SOURCE_DIR /mvn-settings.xml"
218- mvn --settings " $SOURCE_DIR /mvn-settings.xml" package -DskipTests=true --file " $SOURCE_DIR /tools/cldr-code/pom.xml"
219- JARFILE=" $SOURCE_DIR //tools/cldr-code/target/cldr-code.jar"
220- DESTINATION_DIR_LOCALE=" $DESTINATION_DIR "
221- DESTINATION_FILE_PLURALS=" $DESTINATION_DIR /supplemental/plurals/plurals.json"
222- fi
223- java -Duser.language=en -Duser.country=US " -DCLDR_DIR=$SOURCE_DIR " " -DCLDR_GEN_DIR=$DESTINATION_DIR_LOCALE " -jar " $JARFILE " ldml2json -t main -r true -s contributed -m en_US
224- java -Duser.language=en -Duser.country=US " -DCLDR_DIR=$SOURCE_DIR " " -DCLDR_GEN_DIR=$DESTINATION_DIR /supplemental" -jar " $JARFILE " ldml2json -s contributed -o true -t supplemental
225- mkdir -p /output/main/en-US
226- cp $DESTINATION_DIR /en_US/languages.json /output/main/en-US/
227- cp $DESTINATION_DIR /en_US/scripts.json /output/main/en-US/
228- cp $DESTINATION_DIR /en_US/territories.json /output/main/en-US/
229- mkdir -p /output/supplemental
230- cp " $DESTINATION_FILE_PLURALS " /output/supplemental/
231- ```
175+ In order to generate this data, you can use the ` bin/import-cldr-data ` CLI command.
232176
233177
234178## Support this project
0 commit comments