Class AppLangHelper
- Namespace
- SunamoLang.SunamoI18N
- Assembly
- SunamoLang.dll
Helper class for application language settings and culture management.
public static class AppLangHelper
- Inheritance
-
AppLangHelper
- Inherited Members
Properties
CurrentCulture
Gets or sets the current culture information.
public static CultureInfo? CurrentCulture { get; set; }
Property Value
CurrentUICulture
Gets or sets the current UI culture information.
public static CultureInfo? CurrentUICulture { get; set; }
Property Value
SelectedInComboBox
Gets or sets the currently selected language in the combo box.
public static AppLang? SelectedInComboBox { get; set; }
Property Value
Methods
GetCultureInfo(Langs)
Returns the CultureInfo for the specified language.
public static CultureInfo GetCultureInfo(Langs lang)
Parameters
langLangsThe language enum value.
Returns
- CultureInfo
The corresponding CultureInfo instance.
GetLang(CultureInfo)
Returns the Langs enum value based on the provided CultureInfo.
public static Langs GetLang(CultureInfo cultureInfo)
Parameters
cultureInfoCultureInfoThe CultureInfo to extract language from.
Returns
- Langs
The corresponding Langs enum value.
GetLang(string)
Returns the language in which content should be displayed. Supports both two-letter and five-letter (e.g., en-US) language codes.
public static Langs GetLang(string text)
Parameters
textstringThe language code string.
Returns
- Langs
The corresponding Langs enum value.
GetLang3(string)
Returns the language enum value from either a two-letter or five-letter language code.
public static Langs GetLang3(string languageCode)
Parameters
languageCodestringThe language code (e.g., "en" or "en-US").
Returns
- Langs
The corresponding Langs enum value.
ItemsToAddToComboBox(string)
Returns a list of AppLang items to populate a language selection ComboBox.
public static List<AppLang> ItemsToAddToComboBox(string settingsAppLang)
Parameters
settingsAppLangstringThe current language settings string.
Returns
ToString(AppLang)
Returns the language name for display (e.g., in a ComboBox for language selection). If the language type is not fixed, returns the appropriate text based on OS language.
public static string ToString(AppLang appLang)
Parameters
appLangAppLangThe current AppLang instance.
Returns
- string
The display name for the language.