Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple internationalization for Clojure
Clojure
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/clji18n
test/clji18n/test
.gitignore
README.markdown
epl-v10.html
project.clj

README.markdown

clji18n

Simple internationalization for Clojure

Usage

Create maps with internationalized resources (e.g. strings)


(def en-resources {:hi "hello {0}", "bye" "bye"})
(def es-resources {:hi "hola {0}", "bye" "adiós"})
(def es-ar-resources {"bye" "chau"})

Keys and values could be anything, but it's probably useful to use keywords or strings as keys.

Create a tree of resource bundles


(def tree (make-resource-tree en-resources
                              (locale "es") es-resources)
                              (locale "es" "AR") es-ar-resources))

Get your internationalized resources


(with-locale (locale "es" "AR")
  (with-resources tree
    (println (_ :hi "Rich") (_ "bye"))))

That would print "hola Rich" and "chau". :hi key is get from es-ar-resources bundle, "bye" key is get from the parent bundle es-resources.

There is and will be more to clji18n. To be documented...

Installation

Add [clji18n "0.1.1"] to your project.clj

License

Copyright (C) 2010 Sebastián Galkin

Distributed under the Eclipse Public License, the same as Clojure.

Something went wrong with that request. Please try again.