j18n /

Filename Size Date modified Message
45 B
1.1 KB
1.0 KB
512 B
26 B

j18n – internationalisation for Clojure

j18n is a simple i18n library for Clojure. It uses standard Java resource bundles to do the heavy-lifting and as such integrates well with the Java infrastructure.

Basic Usage

Define a resource bundle.

(j18n/defbundle my-bundle)

Or – providing an explicit package name –:

(j18n/defbundle my-bundle "optional.custom.package")

Then initialise the bundle in your application start up procedure.

(defn -main
  [& args]

Then use translate to translate your messages.

(translate :my.message)

You may also use messages from another namespace's bundle:

(translate :some.other.namespace/other.message)

You may assume the following properties file for the sake of the example.

my.message = meine Nachricht

Gradle, lein and other poison

The group and artifact name is “j18n”. So to use with Gradle do:

compile "j18n:j18n:<version>"

With lein/cake:

[j18n <version>]