Skip to content

Supplement for nv-i18n to add Subdivisions (regions/provinces/states etc)

License

Notifications You must be signed in to change notification settings

mihxil/i18n-subdivisions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I18n Country Subdivisions

Build Status Maven Central snapshots javadoc

Overview

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.

This is forked from https://github.com/tobias-/i18n-subdivisions which doesn’t seem to be maintained. I changed the coordinates and package and I am maintaining it myself now.

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.

License

Apache License, Version 2.0

Download

git clone https://github.com/mihxil/i18n-subdivisions.git

All code is generated by the groovy script src/build/groovy/generateSubdivisions.groovy from the html files in src/build/resources/.

Building

mvn clean install -Pdownload

Releasing

mvn release:prepare release:perform -Pdownload-subdivisions

Example

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());
}

This is wrapped also in i18n-regions, which would make every enum defined in this project available as a more generic 'Region' object.

Maven

<dependency>
    <groupId>org.meeuw.i18n</groupId>
    <artifactId>i18n-subdivision-enums</artifactId>
    <version>0.3</version>
</dependency>

Gradle

dependencies {
    compile 'org.meeuw.i18n:i18n-subdivision-enums:0.3'
}

TODO

  • Verify with another source of the codes

  • If anyone wants them, include subdivision types in the enum

About

Supplement for nv-i18n to add Subdivisions (regions/provinces/states etc)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • HTML 100.0%