Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update README for new locale-fallback capability

  • Loading branch information...
commit b6a7cf33d02d98b9a0bc4e92d460866eb5d87670 1 parent 46f21ce
@ptaoussanis authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 README.md
View
10 README.md
@@ -37,7 +37,7 @@ Add the necessary dependency to your [Leiningen][] `project.clj` and `require` t
### Translation
-The `make-t` fn handles translations. You give it a config map which includes your dictionary, and get back a `(fn [locale k-or-ks & fmt-args])`:
+The `make-t` fn handles translations. You give it a config map which includes your dictionary, and get back a `(fn [locale-or-locales k-or-ks & fmt-args])`:
```clojure
(def my-tconfig
@@ -105,6 +105,14 @@ You can also specify fallback keys that'll be tried before other locales. `(t :e
6. `:example/bar` in the fallback locale.
7. `:missing` in any of the above locales.
+And even fallback locales. `(t [:fr-FR :en-US] :example/foo)` searches:
+ 1. `:example/foo` in the `:fr-FR` locale.
+ 2. `:example/foo` in the `:en-US` locale.
+ 3. `:example/foo` in the `:fr` locale.
+ 4. `:example/foo` in the `:en` locale.
+ 5. `:example/foo` in the fallback locale.
+ 6. `:missing` in any of the above locales.
+
In all cases, translation requests are logged upon fallback to fallback locale or :missing key.
#### ClojureScript translation support (still experimental!)
Please sign in to comment.
Something went wrong with that request. Please try again.