Crate iso639_1

source ·
Expand description

iso639-1

Build Status codecov License:MIT iso639-1 Latest Version

iso639 v1 enum and utils (for Rust)

Iso 639-1

ISO 639-1:2002, Codes for the representation of names of languages — Part 1: Alpha-2 code, is the first part of the ISO 639 series of international standards for language codes. Part 1 covers the registration of two-letter codes. There are 184 two-letter codes registered as of October 2015. The registered codes cover the world’s major languages. (source https://en.wikipedia.org/wiki/ISO_639-1)

Example

extern crate iso639_1;
use iso639_1::{Iso639_1, from_iso639_1, to_iso639_3};
pub fn main() {
    assert!(Iso639_1::Fr != Iso639_1::En);
    assert!(from_iso639_1("fr").unwrap() == Iso639_1::Fr);
    assert!(to_iso639_3("fr").unwrap() == "fra");
}

github: https://github.com/AlbanMinassian/iso639

license

MIT

Structs

Enums

Functions

return enum Iso639_1 switch iso639-1 string (2 chars) - or error Iso639v1Error
get iso639-3 string (3 chars) switch iso639-1 string (2 chars) - or error Iso639v1Error