resolve_locale

Function resolve_locale 

Source
pub fn resolve_locale(
    settings_locale: &str,
    i18n_config_path: &PathBuf,
) -> String
Expand description

What: Resolve the effective locale to use, following fallback chain.

Inputs:

  • settings_locale: Locale from settings.conf (empty string means auto-detect)
  • i18n_config_path: Path to config/i18n.yml

Output:

  • Resolved locale code (e.g., “de-DE”)

Details:

  • Priority: settings_locale -> system locale -> default from i18n.yml
  • Applies fallback chain from i18n.yml (e.g., de-CH -> de-DE -> en-US)
  • Validates locale format (basic check for valid locale code structure)