make date format supports locale (#6306)

* add --locale flag to make output support locale

* implement again based on nu-utils get_system_locale_string

* add comment
This commit is contained in:
WindSoilder
2022-08-14 21:07:04 +08:00
committed by GitHub
parent 6145f734b7
commit 21770367e2
5 changed files with 82 additions and 6 deletions

View File

@ -27,13 +27,13 @@ pub fn get_system_locale() -> Locale {
}
#[cfg(debug_assertions)]
fn get_system_locale_string() -> Option<String> {
pub fn get_system_locale_string() -> Option<String> {
std::env::var(LOCALE_OVERRIDE_ENV_VAR)
.ok()
.or_else(sys_locale::get_locale)
}
#[cfg(not(debug_assertions))]
fn get_system_locale_string() -> Option<String> {
pub fn get_system_locale_string() -> Option<String> {
sys_locale::get_locale()
}