[][src]Crate env_lang

env-lang

Build Status codecov License:MIT env-lang Latest Version

return env LANG' struct with language, localisation, charset and variant

Example

extern crate env_lang;
use env_lang::{to_struct, EnvLang};
fn main() {
    let lang_env = "fr_FR.UTF-8@euro"; // or std::env::var("LANG")
    let result: EnvLang = to_struct(&lang_env).unwrap();
    assert!(result == EnvLang{
        language: Some("fr"),
        localisation: Some("FR"),
        charset: Some("UTF-8"),
        variant: Some("euro")
    });
}

github: https://github.com/AlbanMinassian/env-lang

license

MIT

Structs

EnvLang
EnvLangError

Enums

EnvLangErrorKind

Functions

to_struct

return struct EnvLang or an error EnvLangErrorKind