Skip to content

Rust library to convert between ISO 639 codes and English language names

License

Notifications You must be signed in to change notification settings

humenda/isolang-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ISO 639 language codes

Build Status · Documentation

Introduction

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 supports conversion from 639-1 and 639-3 and also into these formats, as well as into English names.

This crate contains the ISO 639 table in statically embedded tables. This is possibly large, but can outweight the benefits, when handling different language code formats, e.g. when handling API data from Wikipedia and FreeDict.

Conditional compilation to reduce code size is not supported at the moment.

This crate is licensed under the Apache 2.0 license, please see LICENSE.md for the details.

Use

Cargo.toml:

[dependencies]
isolang = "0.1"

Example

use isolang::Language;

assert_eq!(Language::from_639_1("de").unwrap().to_name(), "German");
assert_eq!(Language::from_639_3("spa").unwrap().to_639_1(), Some("es"));

About

Rust library to convert between ISO 639 codes and English language names

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages