Liking cljdoc? Tell your friends :D

dk.simongray.langtag

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.

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.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close