diff --git a/src/lib.rs b/src/lib.rs index fb9bcaef..88944ef6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,9 +84,14 @@ pub fn commit(repo: Repository, oid: Oid, msg: &str) -> result::Result String { - let re = Regex::new(r"_.*$").unwrap(); - String::from(re.replace(lang.as_str(), "")) +pub fn locale_to_language(lang: String) -> String { + let re = Regex::new(r"[-_\.].*$").unwrap(); + let locale_frag = lang.as_str().to_lowercase(); + let lang = re.replace(&locale_frag, ""); + match &lang[..] { + "c" => String::from("en"), + _ => String::from(lang), + } } /// Output welcome header at start of run before moving on to actual commands diff --git a/src/make/mod.rs b/src/make/mod.rs index c7a29430..e4f3f99c 100644 --- a/src/make/mod.rs +++ b/src/make/mod.rs @@ -59,7 +59,7 @@ pub fn run(target: Vec) -> Result<()> { .env("CASILE_JOBS", cpus) .env("CASILEDIR", CONFIGURE_DATADIR) .env("CONTAINERIZED", status::is_container().to_string()) - .env("LANGUAGE", lang_to_language(CONF.get_string("language")?)) + .env("LANGUAGE", locale_to_language(CONF.get_string("language")?)) .env("PROJECT", gitname) .env("PROJECTDIR", CONF.get_string("path")?) .env("PROJECTVERSION", git_version);