1This directory is used for building our Android ICU data file. 2 31. To generate ICU data files:run the icu_dat_generator.py script. 4 The command is: 5 ./icu_dat_generator.py [-v] [-h] 6 72. To add a resource to Android ICU data file: insert an entry to 8 icudtxx-<tag name>.txt under external/icu4c/stubdata directory then 9 run the icu_dat_generator.py. 10 For example, to add French sort to icudt 48l-us.dat, you need to 11 a. Add an entry, "coll/fr.res", into external/icu4c/stubdata/icudt 48l-us.txt 12 b. run "./icu_dat_generator.py". 13 143. To add a new Android ICU data file: create the .txt file and run the script 15 to generate the .dat file. 16 For example, to add icudt 48l-latin.dat, you need to 17 a. Make a new file icudt 48l-latin.txt to include the resource list. 18 b. run "./icu_dat_generator.py". 19 204. Add a new resource or modify existing ICU resource definition: 21 Note: This is a rare case. You should talk to ICU team first if it is a bug 22 in ICU resource or a feature enhancement before making such changes. 23 If you would like to add existing ICU resource to Android, please check #2. 24 a. Create or change the text format resource files under external/icu4c/data. 25 b. Make a temporary directory for ICU build. 26 i.e. mkdir external/icu4c/icuBuild 27 c. cd to ICU build directory. 28 i.e. cd external/icu4c/icuBuild 29 d. Run external/icu4c/runConfigureICU with "Linux" option to generate the 30 makefile. 31 i.e. $ANDROID_BUILD_TOP/external/icu4c/runConfigureICU Linux 32 e. make -j2 33 f. The new icudtxxl.dat is under data/out/tmp and the individual resources are 34 under data/out/build/icudtxxl 35 For example, you can find data/out/tmp/icudt 48l.dat and data/out/build/icudt 48l/*.res. 36 g. Copy the new icudtxxl.dat over $ANDROID_BUILD_TOP/external/icu4c/stubdata/icudtxxl-all.dat. 37 i.e. cp data/out/tmp/icudt 48l.dat $ANDROID_BUILD_TOP/external/icu4c/stubdata/icudt 48l-all.dat. 38 h. Check #1 or #2 to replace or add resource to ICU. 39 i. Clean up ICU build directory. 40 j. Discuss with icu-team how to include the change to public ICU. 41 42Locale Resource Files: 43- icudt 48l-all.dat contains the resources in packed 44 form. It includes everything that comes with 45 a vanilla ICU 4.8. icu_dat_generator.py uses this file to generate 46 custom build dat files. 47 48- cnv/*.cnv are the additional encodings required by Android. 49 These are 50 - gsm-03.38-2000.cnv 51 - iso-8859_16-2001.cnv 52 - docomo-shift_jis-2007.cnv 53 - kddi-jisx-208-2007.cnv 54 - kddi-shift_jis-2007.cnv 55 - softbank-jisx-208-2007.cnv 56 - softbank-shift_jis-2007.cnv 57 58- Text format ICU resource files are under external/icu4c/data directory. 59 Binary resource files are packaged in external/icu4c/stubdata/icudtxxl-all.dat. 60 If you have special need such as bug fxings or examining individual resource size, 61 you can run icupkg utility to extract icudtxxl-all.dat into a temporary directory. 62 For example: 63 cd $ANDROID_BUILD_TOP/external/icu4c/stubdata 64 cp icudt 48l-all.dat icudt 48l.dat 65 mkdir tempDir 66 $ANDROID_BUILD_TOP/prebuilt/linux-x86_64/icu-4.8/icupkg icudt 48l.dat -x "*" -d tempDir 67 68Run ICU tests: 69ICU tests are not part of Android build. If you change the ICU code or data, 70it is highly recommended to run ICU tests. 71 1. Remove the flag "-R" in external/icu4c/data/Makefile.in. 72 "Reverse collation keys" tables are not included in ICU data on Android. To 73 pass ICU collation tests, you need to delete the flag "-R" in Makefile.in. 74 Search for " -R" under "### collation res" section in external/icu4c/data/Makefile.in, 75 delete all of them. 76 2. Make a temporary directory for ICU build. 77 i.e. mkdir external/icu4c/icuBuild 78 3. cd to ICU build directory. 79 i.e. cd external/icu4c/icuBuild 80 4. Run external/icu4c/runConfigureICU with "Linux" option to generate the makefile. 81 i.e. $ANDROID_BUILD_TOP/external/icu4c/runConfigureICU Linux 82 5. make -j2 check 83 6. Check the result. Ignore the errors from tsconv. 84 85Note: 86 1. The script assumes you have done 87 envsetup.sh and choosecombo before, because 88 it relies on an environment variable pointing 89 to the prebuilt tools. 90 91