/
githubmirror
/
icu
ОбзорДокументацияВойти
/
githubmirror
/
icu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
ДокументацияПоддержка
Политика конфиденциальностиПользовательское соглашениеПолитика использования «cookies»Согласие субъекта персональных данных
2026 ©
icu/
tools/currency/
..
.settings

ICU-22116 Updating minimum Java runtime support to Java 8

4 года назад
src

ICU-23056 BRS78 Update currency numeric codes

год назад
.classpath

ICU-22116 Updating minimum Java runtime support to Java 8

4 года назад
.project

ICU-23175 Consistent names for the release artifacts

год назад
build.py

ICU-23333 Create equivalent build.py scripts for all ant tasks

4 месяца назад
build.xml

ICU-23056 BRS78 Update currency numeric codes

год назад
readme.txt

ICU-23333 Create equivalent build.py scripts for all ant tasks

4 месяца назад
readme.txt
*******************************************************************************
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
*******************************************************************************
* Copyright (C) 2012-2013, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
 
[Overview]
 
This directory contains a tool used for maintaining ICU's ISO 4217 currency
code mapping data. ICU uses a resource generated by this tool for mapping
ISO 4217 currency alpha codes to numeric codes.
 
 
[Files]
 
package com.ibm.icu.dev.tool.currency
 
Main.java - The tool's entry point
NumericCodeData.java - The mapping data used by ICU
CurrencyDataParser.java - ISO 4217 XML data parser
CurrencyDataEntry.java - ISO 4217 XML data entry
 
 
[Details]
 
com.ibm.icu.dev.tool.NumericCodeData has String[][] CODE_MAP_DATA.
This array represents mappings between ISO 4217 alpha codes and
numeric codes. ICU's resource bundle currencyNumericCodes is generated
from the table.
 
ISO 4217 maintenance agency - SIX Interbank Clearing distributes
ISO 4217 code data in XML format. These files are found in
http://www.currency-iso.org/iso_index/iso_tables.htm. There are two
files that we're interested in.
 
- https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
- https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-three.xml
 
Table A.1 contains current currencies and funds and Table A.3 contains
historic denominations.
 
The tool supports 2 commands - check / resource.
 
1) check
 
This command compares the hardcoded mapping data in NumericCodeData.java
with the ISO 4217 XML data files side by side and check differences.
 
2) resource
 
This command writes out the hardcoded mapping data in NumericCodeData.java
in ICU resource bundle source format - currencyNumericCodes.txt.
 
 
[Release Tasks]
 
For each ICU release, we should check if the mapping data is up to date.
 
Prerequisites: Java 11+, Ant (TO REMOVE), Python
 
First, run the "check" target. This target will download XML files from
the SIX Interbank Clearing site and invoke the tool command "check".
 
```sh
./build.py --check
```
 
When the target successfully finished, you should see the log like below:
----------------------------------------------------------------------------
 
```
[INFO] ──────────────────────────────[ check() ]───────────────────────────────
[INFO] ─────────────────────────────[ classes() ]──────────────────────────────
[INFO] [rmdir] ./out/bin
[INFO] [mkdir] ./out/bin
[INFO] [execute] javac -d ./out/bin --release 11 -encoding UTF-8 ./src/com/ibm/icu/dev/tool/currency/*.java
logfile: -
[INFO] [mkdir] ./target/pylogs
[INFO] [rmfile] ./target/pylogs/-
[INFO] ─────────────────────────────[ xml_data() ]─────────────────────────────
[INFO] _local_xml()
[INFO] _check_local_xml()
[INFO] _download_xml()
[INFO] _check_local_xml()
[INFO] Downloading ISO 4217 XML data files
[INFO] [mkdir] ./out/xml
[INFO] urllib.request.urlretrieve( "https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml", "./out/xml/list-one.xml")
[INFO] [execute] java -cp ./out/bin com.ibm.icu.dev.tool.currency.Main check ./out/xml/list-one.xml ./out/xml/list-three.xml
logfile: -
[OK] ICU data is synchronized with the reference data
[INFO] [mkdir] ./target/pylogs
[INFO] [rmfile] ./target/pylogs/-
```
 
----------------------------------------------------------------------------
In this case, our data is synchronized with the latest XML data and you're done.
 
 
If the data is out of sync, you should see message like below:
----------------------------------------------------------------------------
check:
Missing alpha code in ICU map [ZWR]
Codes not found in the reference data: ZZZ
 
BUILD FAILED
C:\devtools\trunk\currency\build.xml:54: Java returned: 1
----------------------------------------------------------------------------
In this case, you have to update the hardcoded data in NumericCodeData.
You can either edit the table in NumericCodeData manually, or run the tool
command "print" and copy the output and paste it to the table.
 
Once you make sure "check" returns no errors, run "resource" task. This
target generate out/res/currencyNumericCodes.txt. The file should go to
<icu4c>/source/data/misc directory.
 
```sh
./build.py --resource
```
 
Note: The default "build" target does both operation. Although it creates the
ICU resource file, you do not need to replace the one in ICU4C package with
the newly generated one if "check" successfully finished.
 
```sh
./build.py --build
```