Liking cljdoc? Tell your friends :D

scot.weft.i18n.core

Internationalisation.

Internationalisation.
raw docstring

*config*clj

Extensible configuration for i18n.

Extensible configuration for i18n.
sourceraw docstring

*default-language*clj

The default language to seek. Deprecated, prefer (:default-language *config*).

The default language to seek. Deprecated, prefer `(:default-language *config*)`.
sourceraw docstring

*resource-path*clj

The default path within the resources space on which translation files will be sought. Deprecated, prefer (:resource-path *config*).

The default path within the resources space on which translation files 
will be sought. Deprecated, prefer `(:resource-path *config*)`.
sourceraw docstring

accept-language-grammarclj

Grammar for Accept-Language headers

Grammar for `Accept-Language` headers
sourceraw docstring

acceptable-languagesclj

(acceptable-languages accept-language-header)

Generate an ordered list of acceptable languages, most-preferred first.

  • accept-language-header should be the value of an RFC2616 Accept-Language header.

Returns a list of maps as generated by generate-accept-languages, in descending order of preference.

Generate an ordered list of acceptable languages, most-preferred first.

* `accept-language-header` should be the value of an RFC2616 `Accept-Language` header.

Returns a list of maps as generated by `generate-accept-languages`, in descending order
of preference.
sourceraw docstring

find-language-file-nameclj

(find-language-file-name language-spec resource-path)

Find the name of a messages file on this resource path which matches this language-spec.

  • language-spec should be either a map as generated by generate-accept-languages, or else a string;
  • resource-path should be the path name of the directory in which message files are stored, within the resources on the classpath.

Returns the name of an appropriate file if any is found, else nil.

Find the name of a messages file on this resource path which matches this `language-spec`.

* `language-spec` should be either a map as generated by `generate-accept-languages`, or
else a string;
* `resource-path` should be the path name of the directory in which message files are stored,
within the resources on the classpath.

Returns the name of an appropriate file if any is found, else nil.
sourceraw docstring

generate-accept-languagesclj

(generate-accept-languages parse-tree)

From a parse-tree generated by the language-specifier-grammar, generate a list of maps each having a :language key, a :preference key and a :qualifier key.

From a `parse-tree` generated by the `language-specifier-grammar`, generate
a list of maps each having a `:language` key, a `:preference` key and a
`:qualifier` key.
sourceraw docstring

get-messageclj

Return the message keyed by this token from the most acceptable messages collection
we have given this accept-language-header, if passed, or the current default language otherwise. If no message is found, return the token.

  • token should be a clojure keyword identifying the message to be retrieved;
  • accept-language-header should be the value of an RFC2616 Accept-Language header;
  • resource-path should be the fully-qualified path name of the directory in which message files are stored;
  • default-locale should be a locale specifier to use if no acceptable locale can be identified.
Return the message keyed by this `token` from the most acceptable messages collection  
we have given this `accept-language-header`, if passed, or the current default language 
otherwise. If no message is found, return the token.

* `token` should be a clojure keyword identifying the message to be retrieved;
* `accept-language-header` should be the value of an RFC2616 `Accept-Language` header;
* `resource-path` should be the fully-qualified path name of the directory in which
  message files are stored;
* `default-locale` should be a locale specifier to use if no acceptable locale can be
  identified.
sourceraw docstring

get-messagesclj

Return the most acceptable messages collection we have given this accept-language-header

  • accept-language-header should be the value of an RFC2616 Accept-Language header;
  • resource-path should be the fully-qualified path name of the directory in which message files are stored;
  • default-locale should be a locale specifier to use if no acceptable locale can be identified.

Returns a map of message keys to strings.; if no useable file is found, returns nil.

Return the most acceptable messages collection we have given this `accept-language-header`

* `accept-language-header` should be the value of an RFC2616 `Accept-Language` header;
* `resource-path` should be the fully-qualified path name of the directory in which
message files are stored;
* `default-locale` should be a locale specifier to use if no acceptable locale can be
identified.

Returns a map of message keys to strings.; if no useable file is found, returns nil.
sourceraw docstring

parse-accept-language-headerclj

Parse an Accept-Language header

Parse an `Accept-Language` header
sourceraw docstring

raw-get-messagesclj

(raw-get-messages accept-language-header resource-path default-locale)

Return the most acceptable messages collection we have given this accept-language-header. Do not use this function directly, use the memoized variant get-messages, as performance will be very much better.

  • accept-language-header should be the value of an RFC2616 Accept-Language header;
  • resource-path should be the fully-qualified path name of the directory in which message files are stored;
  • default-locale should be a locale specifier to use if no acceptable locale can be identified.

Returns a map of message keys to strings; if no useable file is found, returns nil.

Return the most acceptable messages collection we have given this `accept-language-header`.
Do not use this function directly, use the memoized variant `get-messages`, as performance
will be very much better.

* `accept-language-header` should be the value of an RFC2616 `Accept-Language` header;
* `resource-path` should be the fully-qualified path name of the directory in which
message files are stored;
* `default-locale` should be a locale specifier to use if no acceptable locale can be
identified.

Returns a map of message keys to strings; if no useable file is found, returns nil.
sourceraw docstring

slurp-resourceclj

(slurp-resource name)

Slurp the resource of this name and return its contents as a string; but if it doesn't exist log the fact and return nil, rather than throwing an exception.

Slurp the resource of this name and return its contents as a string; but if it doesn't
exist log the fact and return nil, rather than throwing an exception.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close