iso639-rust
A comprehensive, fast, and idiomatic Rust library for ISO 639 language codes — supporting language identification, conversion between two-letter and three-letter codes, detection of deprecated codes, and more.
This crate is a Rust port inspired by the popular iso639-lang Python library, covering ISO 639-1, ISO 639-2, ISO 639-3 and ISO 639-5 standards.
Features
- Lookup languages by any ISO 639 code or reference name (two-letter, three-letter, or name)
- Access language metadata (
name,pt1(2-letter code),pt2b,pt2t,pt3(3-letter code),pt5) - Detect deprecated language codes with detailed reasons and suggested replacements
- Retrieve language scope, type, macrolanguage, and individual languages of macrolanguages
- Convert between two-letter and three-letter language codes easily
- Iterate over all ISO 639 recognized languages
- Query all alternate names of a language
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage
Lookup Languages
use ;
let lang = new.unwrap;
assert_eq!;
assert_eq!;
assert_eq!;
Convert 2-letter to 3-letter
let french = new.unwrap;
println!; // prints "fra"
println!; // prints "French"
Contributing
Contributions welcome! If you find bugs, or want to improve data handling and add features, please open an issue or submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Inspired by and based on the excellent Python library iso639-lang by Laurent Beaudoux