Parse, write and match language tags by BCP 47: the tags of RFC 5646 and the matching of RFC 4647.
A tag is a plain map of the subtags it has, in canonical case:
A grandfathered tag such as i-klingon is a map of :grandfathered alone.
The functions that match tags take a language priority list: an Accept-Language value such as "da, en;q=0.8", or a coll of language ranges in order of priority such as ["da" "en"]. They return the tags as given. With a function that returns the tag of an item, they match items instead, e.g. labels by their language. A nil tag matches nothing.
Parse, write and match language tags by BCP 47: the tags of RFC 5646
and the matching of RFC 4647.
A tag is a plain map of the subtags it has, in canonical case:
- :language, e.g. "zh"
- :extlangs, the extended languages, e.g. ["yue"]
- :script, e.g. "Hant"
- :region, e.g. "HK" or "419"
- :variants, e.g. ["1901"]
- :extensions, a map of each singleton to its subtags, e.g.
{"u" ["co" "pinyin"]}
- :private-use, the subtags after x, e.g. ["private"]
A grandfathered tag such as i-klingon is a map of :grandfathered alone.
The functions that match tags take a language priority list: an
Accept-Language value such as "da, en;q=0.8", or a coll of language
ranges in order of priority such as ["da" "en"]. They return the tags
as given. With a function that returns the tag of an item, they match
items instead, e.g. labels by their language. A nil tag matches
nothing.Check, canonicalize and match language tags by the IANA Language Subtag Registry of file-date.
The functions take tags as text, as the root namespace's do, and those that write a tag also take its map. Validity depends on the registry, so a tag with a subtag newer than file-date isn't valid here until a later release of the library.
The matching functions work as the root namespace's, but compare ranges and tags in extlang form, so that e.g. iw matches he and zh matches yue. They return the tags as given.
Check, canonicalize and match language tags by the IANA Language Subtag Registry of file-date. The functions take tags as text, as the root namespace's do, and those that write a tag also take its map. Validity depends on the registry, so a tag with a subtag newer than file-date isn't valid here until a later release of the library. The matching functions work as the root namespace's, but compare ranges and tags in extlang form, so that e.g. iw matches he and zh matches yue. They return the tags as given.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |