This commit is contained in:
ByteDream 2023-03-23 01:17:41 +01:00
parent 90212c4ec0
commit 0a40f3c40f
30 changed files with 3651 additions and 2982 deletions

View file

@ -13,3 +13,17 @@ pub fn system_locale() -> Locale {
Locale::en_US
}
}
/// Check if [`Locale::Custom("all")`] is in the provided locale list and return [`Locale::all`] if
/// so. If not, just return the provided locale list.
pub fn all_locale_in_locales(locales: Vec<Locale>) -> Vec<Locale> {
if locales
.iter()
.find(|l| l.to_string().to_lowercase().trim() == "all")
.is_some()
{
Locale::all()
} else {
locales
}
}