Simple internationalization (i18n) and localization (L10n) library for Clojure/Script. Wraps standard Java/Script facilities when possible.
Simple internationalization (i18n) and localization (L10n) library for Clojure/Script. Wraps standard Java/Script facilities when possible.
(default-tfmt-str loc fmt & args)
(default-tfmt-str _loc fmt & args)
Implementation detail. Based on enc/format
.
Implementation detail. Based on `enc/format`.
Implementation detail. Compiles text translations stored in simple development-friendly Clojure map into form required by localized text translator: {:en {:example {:foo <tr>}}} => {:example/foo {:en <decorated-tr>}}
Implementation detail. Compiles text translations stored in simple development-friendly Clojure map into form required by localized text translator: {:en {:example {:foo <tr>}}} => {:example/foo {:en <decorated-tr>}}
(dict-compile* dict & [opts])
Compile-time compiler.
Compile-time compiler.
Example/test config as passed to make-t
, Ring middleware, etc.
:dictionary should be a map, or named resource containing a map of form {:locale {:ns1 ... {:nsN {:key<decorator> text ...} ...} ...} ...}}.
Named resource will be watched for changes when :dev-mode?
is true.
Example/test config as passed to `make-t`, Ring middleware, etc. :dictionary should be a map, or named resource containing a map of form {:locale {:ns1 ... {:nsN {:key<decorator> text ...} ...} ...} ...}}. Named resource will be watched for changes when `:dev-mode?` is true.
(fmt loc x & [style])
Formats Date/Number as a string.
style
is <:#{date time dt}-#{default short medium long full}>,
e.g. :date-full, :time-short, etc. (default :date-default).
Formats Date/Number as a string. `style` is <:#{date time dt}-#{default short medium long full}>, e.g. :date-full, :time-short, etc. (default :date-default).
(fmt-msg loc pattern & args)
Creates a localized MessageFormat and uses it to format given pattern string, substituting arguments as per MessageFormat spec.
Creates a localized MessageFormat and uses it to format given pattern string, substituting arguments as per MessageFormat spec.
(fmt-str loc fmt & args)
Like clojure.core/format but takes a locale, doesn't throw on nil pattern.
Like clojure.core/format but takes a locale, doesn't throw on nil pattern.
(fmt-str _loc fmt & args)
Alpha - subject to change.
Alpha - subject to change.
Experimental. Useful format for [sorted] lists, stitching into maps.
Experimental. Useful format for [sorted] lists, stitching into maps.
Experimental. Useful format for [sorted] lists, stitching into maps.
Experimental. Useful format for [sorted] lists, stitching into maps.
Experimental. Useful format for [sorted] lists, stitching into maps.
Experimental. Useful format for [sorted] lists, stitching into maps.
Returns valid Locale matching given name string/keyword, or throws an
exception if none could be found. loc
should be of form :en, :en-US,
:en-US-variant, or :jvm-default.
Returns valid Locale matching given name string/keyword, or throws an exception if none could be found. `loc` should be of form :en, :en-US, :en-US-variant, or :jvm-default.
"en_gb-var1" -> :en-gb-var1, etc.
"en_gb-var1" -> :en-gb-var1, etc.
(lcomparator loc & [style])
Returns localized comparator.
Returns localized comparator.
(load-dictionary-from-map-resource!)
(load-dictionary-from-map-resource! resource-name & [merge?])
DEPRECATED.
DEPRECATED.
(lsort loc coll & [style])
Localized sort. style
e/o #{:asc :desc} (default :asc).
Localized sort. `style` e/o #{:asc :desc} (default :asc).
(normalize s & [form])
Transforms Unicode string into W3C-recommended standard de/composition form allowing easier searching and sorting of strings. Normalization is considered good hygiene when communicating with a DB or other software.
Transforms Unicode string into W3C-recommended standard de/composition form allowing easier searching and sorting of strings. Normalization is considered good hygiene when communicating with a DB or other software.
(parse loc s & [style])
Parses date/number string as a Date/Number. See fmt
for possible style
s
(default :number).
Parses date/number string as a Date/Number. See `fmt` for possible `style`s (default :number).
(parse-Locale loc)
DEPRECATED: Use locale
instead.
DEPRECATED: Use `locale` instead.
Merges scope keywords: (scope :a.b :c/d :e) => :a.b.c.d/e
Merges scope keywords: (scope :a.b :c/d :e) => :a.b.c.d/e
(t loc tconfig k-or-ks & fmt-args)
DEPRECATED. Use make-t
instead.
DEPRECATED. Use `make-t` instead.
(translate loc tconfig scope k-or-ks & fmt-args)
DEPRECATED. Use make-t
instead.
DEPRECATED. Use `make-t` instead.
(try-jvm-locale loc & [lang-only?])
Like jvm-locale
but returns nil if no valid matching Locale could be found.
Like `jvm-locale` but returns nil if no valid matching Locale could be found.
(with-scope translation-scope & body)
DEPRECATED.
DEPRECATED.
(with-tscope translation-scope & body)
Executes body with given translation scope binding.
Executes body with given translation scope binding.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close