Package to support internationalization, specifically the Subdivision (provinces/states/region) defined in ISO 3166-2.
It depends on the neovisionaries i18n (nv-i18n) package for defining all the CountryCodes used.
The author is well aware that there are bound to be problems in the data set. If nothing else, the data changes over time, so please submit issues when something is wrong (preferably with a verifiably link to the correct data).
While the information on what kind of subdivision it is (region, island, state, province, city etc), they are too many different kinds for them to be readily usable and thus they are not available.
Apache License, Version 2.0
git clone https://github.com/tobias-/i18n-subdivisions.git
All code is generated by the groovy script src/build/groovy/generateSubdivisions.groovy
from the html files in src/build/resources/
.
mvn clean install -Pdownload-subdivisions
mvn release:prepare release:perform -Pdownload-subdivisions
List all the subdivision codes available for a specific country.
for (CountrySubdivisionCode code : SubdivisionFactory.getSubdivisions(CountryCode.BE)) {
System.out.format("[%s] %s\n", code, code.getName());
}
Find the region with a specific code and in a specific country. Codes are not unique across countries, ergo country must be specified.
for (CountrySubdivisionCode code : SubdivisionFactory.getSubdivisions(CountryCode.BE)) {
System.out.format("[%s] %s\n", code, code.getName());
}
<dependency>
<groupId>be.olsson</groupId>
<artifactId>i18n-subdivisions</artifactId>
<version>0.1</version>
</dependency>
dependencies {
compile 'be.olsson:i18n-subdivisions:0.1'
}
- Verify with another source of the codes
- If anyone wants them, include subdivision types in the enum