Page
Library
Module
Module type
Parameter
Class
Class type
Source
Iso639.Lang_or_family
SourceIndividual and collective languages as a unified type.
This module defines an abstract denotation of language codes of ISO 639-3 and ISO 639-5 and provides conversions to and from 2- and 3-letter codes defined in parts 1, 2, 3, and 5 of the standard.
If you only want to represent individual languages, consider using the Lang
module instead.
This type represents an individual language or macrolanguage from ISO 639-3 or a language group from ISO 639-5.
equal lang1 lang2
is true if lang1
and lang2
refer to the same individual, macro-, or collective language.
Total order corresponding to lexicographic order of codes within ISO 639-3 and ISO 639-5. The order of elements belonging to different parts of the standard is left unspecified for now, and may change between versions until this notice is removed.
pp ppf lang
prints the ISO 639-3 or 639-5 language code on ppf
.
scope lang
is `Individual
, `Macro
, or `Special
if lang
corresponds to an individual language, macro language, or special language code from ISO 639-3, and `Collective
if lang
corresponds to a language group or family form ISO 693-5.
An injective mapping to 16 bit integers. The result can be used for serialization, but note that the representation may change between versions until this notice is removed. An alternative for permanent storge or operability between versions, is to use to_part3
or to_part5
or both.
An unchecked variant of of_int_exn
. Integers which do not represent ISO language codes are mapped to subterranean languages which at runtime tend to erupt through the logic of the program in unpredictable ways.
of_string s
is the language or language family represented by the ISO 639-3 or 639-5 language code s
.
to_string lang
is the ISO 639-3 language code of lang
if lang
is an individual or macrolanguage and the 639-5 language code of lang
if lang
is a language group or family.
to_iso639p1 lang
is the two-letter ISO 639-2 code for lang
if it exists.
of_iso639p1 s
is the language represented by the ISO 639-1 language code s
.
to_part3t_string lang
is the three-letter ISO 639-2T code for lang
.
to_part3b_string lang
is the three-letter ISO 639-2B code for lang
.
of_iso639p2 s
is the language represented by the ISO 639 part 2T or 2B language code s
.
is_iso639p3 lang
is true iff lang
is represented in ISO 639-3, i.e. an individual language or macro language.
to_iso639p3 lang
is the three-letter ISO 639-3 code for lang
. The result coincides with the ISO 639-2 code if it exist, and may clash with an ISO 639-5 code for a language group.
of_string s
is the language represented by the ISO 639-3 language code s
.
is_iso639p3 lang
is true iff lang
is represented in ISO 693-5, i.e. a language family or group.
to_iso639p5 lang
is the three-letter ISO 639-5 code for lang
. The result coincides with the ISO 639-2 code if it exist, and may clash with an ISO 639-3 code for an individual language or macrolanguage.