Skip to content

Enumerate supported languages

Consumers that need a localized list of the languages a SAIF application supports read mdlLanguages.SupportedLanguages, which iterates the configured SupportedCultures culture codes and returns one clsLanguage per culture, pairing the raw culture code with a localized display description sourced from the Common_UI resource set.

Field Value
Operation ID OP-RES-03
Trigger Caller reads the read-only module property mdlLanguages.SupportedLanguages
Inputs The module-level SupportedCultures array (currently {"en", "es"})
Outputs IEnumerable(Of clsLanguage), materialized as an array, with one entry per supported culture
Primary components mdlLanguages.SupportedLanguages, clsLanguage, Common_UI
Entry point Resources\SAIF.Resources\mdlLanguages.vb

Steps

  1. Caller reads the property. Accessing SupportedLanguages begins building a new List(Of clsLanguage).
  2. Iterate configured cultures. The property loops over the module-level SupportedCultures array in declared order (English first, then Spanish, per the current configuration).
  3. Resolve a localized description per culture.
  4. If the culture code equals CULTURE_SPANISH ("es"): the loop adds a new clsLanguage(culture, Common_UI.Spanish), using the Spanish-localized display string.
  5. Otherwise (including CULTURE_ENGLISH, "en"): the loop adds a new clsLanguage(culture, Common_UI.English), using the English-localized display string.
  6. Return the results. The accumulated list is converted to an array and returned to the caller.

Process flow

The following diagram visualizes the language-list construction flow.

flowchart TD
    Start([Caller reads SupportedLanguages]) --> Init[Create empty language list]
    Init --> Loop[Iterate SupportedCultures array]
    Loop --> Check{Culture code<br>equals Spanish?}
    Check -->|Yes| AddEs[Add clsLanguage with<br>Common_UI.Spanish description]
    Check -->|No| AddOther[Add clsLanguage with<br>Common_UI.English description]
    AddEs --> More{More cultures?}
    AddOther --> More
    More -->|Yes| Loop
    More -->|No| Return([Return array of clsLanguage]))

Failure and edge-case behavior

  • Any culture code other than the Spanish constant ("es") falls into the Case Else branch and is described using the English resource string, so a supported culture that is neither English nor Spanish would still be labeled with the English description rather than its own language name.*
  • Adding a new supported culture requires both appending it to SupportedCultures and adding a matching Case branch in SupportedLanguages; the module's own todo comments flag this as a manual, two-part extension point.
  • The returned collection order always follows the declared order of SupportedCultures, so English is listed before Spanish under the current configuration.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • Resources\SAIF.Resources\mdlLanguages.vb
  • Resources\SAIF.Resources\clsLanguage.vb
  • Resources\SAIF.Resources\Common\Common_UI.Designer.vb