euv-docs 0.37.4

A documentation site generator powered by euv + euv-ui (Rust/WASM).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::*;

/// Returns the document language associated with a configured locale label.
///
/// # Arguments
///
/// - `&str` - The locale display label from site configuration.
///
/// # Returns
///
/// - `&'static str` - The matching BCP-47 language tag, or the English fallback.
pub(crate) fn document_language_for_label(label: &str) -> &'static str {
    let binding: Option<&(&str, &str)> = DOCUMENT_LANGUAGE_BINDINGS
        .iter()
        .find(|(name, _): &&(&str, &str)| *name == label);
    binding.map_or(DOCUMENT_LANGUAGE_FALLBACK, |(_, tag): &(&str, &str)| *tag)
}