Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Introduction

awkay edited this page · 1 revision
Clone this wiki locally

Motivation

Internationalization can be hard. Not only is it hard from a programming perspective, it is can be hard from a management perspective.

The recommended approach in Java is to do the following:

  • Make up "keys" for messages
  • Put translations in resource bundles or properties file
  • Remember what the "keys" are
  • Use the keys in lookups instead of the real strings

This can work reasonably well, and there are certainly enough people making due with it; however, it has many shortcomings:

  • A missing key can cause exceptions, and in any case will not display anything comprehensible in any language
  • Maintenance is a hard: programmers add new keys to the main language all the time...someone has to use tools to diff out what is missing in the other language files, and put in translations
  • Doing input/output is supported, but you end up writing a bunch of supporting routines to use DateFormat, MessageFormat, etc.
  • Plural support is weak, and the API is complex

Enter easy-i18n.

Easy i18n

This library is intended to address these problems with a multi-faceted approach:

  • Integrate the GNU Gettext system, and leverage the existing tools for:
    • Letting programmers use the real strings in their source
    • Automation for extracting strings from source
    • Managing the merge of new strings with existing translation files
  • Add helper functions to assist in the common i18n tasks:
    • Support the GNU Gettext mechanisms for plurals and translation context
    • Easy-to-use functions for locale-specific numeric output AND input
    • Easy-to-use functions for locale-specific currency output AND input
    • Easy-to-use functions for locale-specific date/time output AND input
    • Functions that support (customizable) wiki-style strings/translations
    • Functions that assist with quoting when embedding in templates/HTML
    • Support for dealing with your own concept of "null" (or invalid) dates
    • Support for language/country, with auto-backoff. E.g. locale "en_US" means "en_US" or "en"
    • Support for thread-local language settings, for easier integration with web applications
Something went wrong with that request. Please try again.