initialize_locale_system

Function initialize_locale_system 

Source
pub fn initialize_locale_system(
    app: &mut AppState,
    locale_pref: &str,
    _prefs: &Settings,
)
Expand description

What: Initialize the locale system: resolve locale, load translations, set up fallbacks.

Inputs:

  • app: Application state to populate with locale and translations
  • locale_pref: Locale preference from settings.conf (empty = auto-detect)
  • _prefs: Settings struct (unused but kept for future use)

Output:

  • Populates app.locale, app.translations, and app.translations_fallback

Details:

  • Resolves locale using fallback chain (settings -> system -> default)
  • Loads English fallback translations first (required)
  • Loads primary locale translations if different from English
  • Handles errors gracefully: falls back to English if locale file missing/invalid
  • Logs warnings for missing files but continues execution