Internationalisation.
Internationalisation.
Extensible configuration for i18n.
Extensible configuration for i18n.
The default language to seek. Deprecated, prefer (:default-language *config*)
.
The default language to seek. Deprecated, prefer `(:default-language *config*)`.
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*)`.
Grammar for Accept-Language
headers
Grammar for `Accept-Language` headers
(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.
(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.
(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.
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.
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.
Parse an Accept-Language
header
Parse an `Accept-Language` header
(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.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close