language-enum
language-enum is a robust, exhaustive enum representing a wide variety of global and regional languages. It’s designed for use in applications that require internationalization (i18n), localization, and handling of multiple languages.
Features
- Exhaustive Language Support: Covers major world languages, regional languages, and some languages spoken by smaller populations.
- Serialization & Deserialization: Comes with built-in support for
serdeto easily serialize and deserialize languages. - Flexible
OtherVariant: Allows specifying languages not covered in the predefined enum through theOther(String)variant. - No Dependencies: Apart from optional
serdesupport, the crate is dependency-free.
Installation
Add language-enum to your Cargo.toml:
[]
= "0.1"
To enable serde support for serialization and deserialization:
[]
= { = "0.1", = ["serde"] }
Usage
use Language;
Enum Variants
The Language enum includes a wide range of languages such as:
Major Languages: English, Spanish, Chinese (Mandarin), Arabic, Russian, etc. Regional Languages: Breton, Hawaiian, Basque, and others. Indigenous Languages: Cherokee, Navajo, Maori, and more. It also includes an Other(String) variant to cover any languages not explicitly listed.
Features
Serialization: Serialize and deserialize the enum with serde. Exhaustive: Covers a broad range of languages for various applications. Custom Language Support: Use Language::Other(String) for languages not in the predefined set. License
Licensed under either of:
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Contribution
Unless explicitly stated otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.