mirror of
https://github.com/stalwartlabs/stalwart.git
synced 2026-03-17 14:34:03 +00:00
14 lines
377 B
Rust
14 lines
377 B
Rust
/*
|
|
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
|
*/
|
|
|
|
include!(concat!(env!("OUT_DIR"), "/locales.rs"));
|
|
|
|
pub fn locale_or_default(name: &str) -> &'static Locale {
|
|
locale(name)
|
|
.or_else(|| name.split_once('_').and_then(|(lang, _)| locale(lang)))
|
|
.unwrap_or(&EN_LOCALES)
|
|
}
|