Skip to content
 
 

Repository files navigation

nv-i18n

GitHub commits since latest release GitHub contributors Maven Central Last Update OpenSSF Best Practices OpenSSF Baseline OpenSSF Scorecard OSS Lifecycle GitHub License jdk badge MvnRepository Quality gate status

Overview

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)

License

Apache License, Version 2.0

Maven

<dependency>
    <groupId>uk.co.foundationsedge</groupId>
    <artifactId>nv-i18n</artifactId>
    <version>version-number</version>
</dependency>

For the latest version-number look at sonatype

Gradle

dependencies {
    compile 'uk.co.foundationsedge:nv-i18n:version-number'
}

OSGi

Bundle-SymbolicName: uk.co.foundationsedge
Export-Package: uk.co.foundationsedge;version="version-number"

Source Code

https://github.com/foundationsedge/nv-i18n.git

Example

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

See Also

Note

Original Author

Takahiko Kawasaki, Authlete, Inc.

Contributors

Made with contrib.rocks.

About

Package to support internationalization, containing ISO 3166-1 country code enum, ISO 639-1 language code enum, etc.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages