Use one locale for tests on all systems

This commit is contained in:
Ian Manske 2025-03-08 18:46:15 -08:00
parent 71a70c75c1
commit 22a7ec5125

View File

@ -22,9 +22,16 @@ pub fn get_system_locale() -> Locale {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
pub fn get_system_locale_string() -> Option<String> { pub fn get_system_locale_string() -> Option<String> {
std::env::var(LOCALE_OVERRIDE_ENV_VAR) std::env::var(LOCALE_OVERRIDE_ENV_VAR).ok().or_else(
.ok() #[cfg(not(test))]
.or_else(sys_locale::get_locale) {
sys_locale::get_locale
},
#[cfg(test)]
{
|| Some(Locale::en_US_POSIX.name().to_owned())
},
)
} }
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]