Rust library to convert between ISO 639 codes and English language names
Rust
40
137 commits
updated Feb 15, 2026
When dealing with different language inputs and APIs, different standards are used to identify a language. Converting between these in an automated way can be tedious. This crate provides an enum which enables conversion between the standards 639-1, 639-2t, 639-2b and 639-3, as well as conversion into English and local names (autonyms).
This crate contains the ISO 639 table in statically embedded tables. This increases binary size, but allows for very efficient look-up if performance matters. If size is a concern, both and the English names and local names can be enabled or disabled individually.
This crate is licensed under the Apache 2.0 license, please see LICENSE.md for the details.
Cargo.toml:
[dependencies]
isolang = "2.0"
use isolang::Language;
assert_eq!(Language::from_639_1("de").unwrap().to_name(), "German");
assert_eq!(Language::from_639_2b("fre").unwrap().to_name(), "French");
assert_eq!(Language::from_639_2t("fra").unwrap().to_name(), "French");
assert_eq!(Language::from_639_3("spa").unwrap().to_639_1(), Some("es"));
// undefined language (ISO code und)
assert_eq!(Language::default(), Language::Und);
use isolang::Language;
// `to_name()` is available if compiled with the `english_names` feature.
assert_eq!(Language::from_str("es").unwrap().to_name(), "Spanish");
assert_eq!(Language::from_str("spa").unwrap().to_name(), "Spanish");
// `from_str(lowercase_name)` is available if compiled with the `english_names` and `lowercase_names` features.
assert_eq!(Language::from_str("spanish").unwrap().to_name(), "Spanish");
// `from_str(local_name)` is available if compiled with the `english_names`, `lowercase_names` and `local_names` features.
assert_eq!(Language::from_str("español").unwrap().to_name(), "Spanish");
Please take a look at the commented Cargo.toml file for a up-to-date list of supported features.
This crate also supports serializing the Language enum. To enable this please
add the following lines to your Cargo.toml (instead of the above code):
[dependencies.isolang]
features = ["serde"]
version = "2.0"
The data is downloaded from https://iso639-3.sil.org/code_tables/download_tables.
194 followers · starred Dec 2025
61 followers · starred Mar 2019
326 followers · starred Apr 2023
Rust library to convert between ISO 639 codes and English language names
Rust
40
137 commits
updated Feb 15, 2026
When dealing with different language inputs and APIs, different standards are used to identify a language. Converting between these in an automated way can be tedious. This crate provides an enum which enables conversion between the standards 639-1, 639-2t, 639-2b and 639-3, as well as conversion into English and local names (autonyms).
This crate contains the ISO 639 table in statically embedded tables. This increases binary size, but allows for very efficient look-up if performance matters. If size is a concern, both and the English names and local names can be enabled or disabled individually.
This crate is licensed under the Apache 2.0 license, please see LICENSE.md for the details.
Cargo.toml:
[dependencies]
isolang = "2.0"
use isolang::Language;
assert_eq!(Language::from_639_1("de").unwrap().to_name(), "German");
assert_eq!(Language::from_639_2b("fre").unwrap().to_name(), "French");
assert_eq!(Language::from_639_2t("fra").unwrap().to_name(), "French");
assert_eq!(Language::from_639_3("spa").unwrap().to_639_1(), Some("es"));
// undefined language (ISO code und)
assert_eq!(Language::default(), Language::Und);
use isolang::Language;
// `to_name()` is available if compiled with the `english_names` feature.
assert_eq!(Language::from_str("es").unwrap().to_name(), "Spanish");
assert_eq!(Language::from_str("spa").unwrap().to_name(), "Spanish");
// `from_str(lowercase_name)` is available if compiled with the `english_names` and `lowercase_names` features.
assert_eq!(Language::from_str("spanish").unwrap().to_name(), "Spanish");
// `from_str(local_name)` is available if compiled with the `english_names`, `lowercase_names` and `local_names` features.
assert_eq!(Language::from_str("español").unwrap().to_name(), "Spanish");
Please take a look at the commented Cargo.toml file for a up-to-date list of supported features.
This crate also supports serializing the Language enum. To enable this please
add the following lines to your Cargo.toml (instead of the above code):
[dependencies.isolang]
features = ["serde"]
version = "2.0"
The data is downloaded from https://iso639-3.sil.org/code_tables/download_tables.
194 followers · starred Dec 2025
61 followers · starred Mar 2019
326 followers · starred Apr 2023