package iso639

  1. Overview
  2. Docs
Language Codes for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

iso639-v0.0.5.tbz
sha256=6056e5da2f82fa775fb637008219b0825cc48b41a3df902f79036a5e2a1a7385
sha512=aa5e91457289035f8369fdbaf138e271a45ebf0458729cd4afbe662c133776c63d025704abee0ed48790a6d90fdcb6e368d7f9088dd78bf774480d55f80a514d

Description

This library implements a type to identify languages and macrolanguages from ISO 639-3 and language groups from ISO 639-5, and provides conversions to and from two- and three-letter codes defined by these and other parts of ISO 639.

Published: 14 Aug 2021

README

Identification of Languages and Language Groups for OCaml

Synopsis

This library defines abstract types for languages and language families covered by ISO 639 and provides related functionality and conversions.

  • Lang.t maps one-to-one to ISO 639-3 language codes, which covers individual languages and macrolanguages.

  • Lang_family.t maps one-to-one to ISO 639-5 language codes, which covers language families and groups.

  • Lang_or_family.t is the sum of the two above types.

Example

# #require "iso639";;
# open Iso639;;
# #install_printer Lang.pp;;

# let por = Lang.of_string_exn "por";;
val por : Lang.t = por
# Lang.to_iso639p1 por;;
- : string option = Some "pt"
# Lang.macrolanguage por;;
- : Lang.t option = None
# Lang.macrolanguage_members por;;
- : Lang.t list = []

# let nor = Lang.of_string_exn "nor";;
val nor : Lang.t = nor
# Lang.macrolanguage_members nor;;
- : Lang.t list = [nob; nno]
# Lang.macrolanguage (Lang.of_string_exn "nob");;
- : Lang.t option = Some nor

Limitations

Only part of ISO 639 which are expected to be commonly used by applications are implemented.

The library does not include the English end French names of languages, and there is no plan to add them, as this would significantly increase the size of the library.

Dependencies (2)

  1. dune >= "1.1"
  2. ocaml >= "4.04.2"

Dev Dependencies

None

Used by (1)

  1. confero

Conflicts

None