nv-i18n solves the problem of handling international codes in Java applications: it provides ready-made, type-safe enums for country, language, script and currency codes so you do not have to build or maintain these lists yourself.
To install it, add the Maven or Gradle dependency shown below. To use it, reference
the enums directly (e.g. CountryCode.JP.getName()); no setup or configuration is
required. The library is read-only reference data and processes no untrusted input,
so secure use simply means keeping the dependency up to date.
Package to support internationalization, containing enums for
- ISO 3166-1 Country
- ISO 639-1 Language
- ISO 15924 Script etc.
| Class | Description | Last Updated |
|---|---|---|
CountryCode |
ISO 3166-1 country code. | 2026-06-24 (Wikipedia as source) |
LanguageCode |
ISO 639-1 language code. | 2026-08-07 (Wikipedia as source) |
LanguageAlpha3Code |
ISO 639-2 language code. | unknown |
LocaleCode |
Available locales whose format match either 'xx' or 'xx-XX'. | unknown |
ScriptCode |
ISO 15924 script code. | 2026-08-28 (Wikipedia as source) |
CurrencyCode |
ISO 4217 currency code. | 2026-07-17 (Wikipedia as source) |
Apache License, Version 2.0
<dependency>
<groupId>uk.co.foundationsedge</groupId>
<artifactId>nv-i18n</artifactId>
<version>version-number</version>
</dependency>For the latest version-number look at sonatype
dependencies {
compile 'uk.co.foundationsedge:nv-i18n:version-number'
}Bundle-SymbolicName: uk.co.foundationsedge
Export-Package: uk.co.foundationsedge;version="version-number"
https://github.com/foundationsedge/nv-i18n.git
class Example {
public static void main(String[] args) {
// List all the country codes.
for (CountryCode code : CountryCode.values()) {
System.out.format("[%s] %s\n", code, code.getName());
}
// List all the language codes.
for (LanguageCode code : LanguageCode.values()) {
System.out.format("[%s] %s\n", code, code.getName());
}
// List all the locale codes.
for (LocaleCode code : LocaleCode.values()) {
String language = code.getLanguage().getName();
String country = code.getCountry() != null
? code.getCountry().getName()
: null;
System.out.format("[%s] %s, %s\n", code, language, country);
}
// List all the script codes.
for (ScriptCode code : ScriptCode.values()) {
System.out.format("[%s] %03d %s\n", code, code.getNumeric(), code.getName());
}
// List all the currency codes.
for (CurrencyCode code : CurrencyCode.values()) {
System.out.format("[%s] %03d %s\n", code, code.getNumeric(), code.getName());
}
}
}- nv-i18n @ GitHub
- Country Code ISO 3166-1
- Country Code ISO 3166-1 alpha-2
- Country Code ISO 3166-1 alpha-3
- Country Code ISO 3166-1 numeric
- Language Code ISO 639-1
- Language Alpha3 Code ISO 639-2
- Script Code ISO 15924
- Currency Code ISO 4217
- This nv-i18n supersedes https://github.com/TakahikoKawasaki/nv-i18n/
- That nv-i18n superseded https://github.com/TakahikoKawasaki/CountryCode
Takahiko Kawasaki, Authlete, Inc.
Made with contrib.rocks.