public static void LookupLanguages() { // Create 'languages' folder if not existing: Directory.CreateDirectory(LanguageFolder); // Look into the folder and add all language files to the dropdown menu: Localization.translations.Clear(); Localization.comboBoxTranslations.Clear(); foreach (string filePath in Directory.GetFiles(LanguageFolder)) { try { if (filePath.EndsWith(".xml") && !filePath.EndsWith(".template.xml")) { Translation translation = new Translation(); translation.Load(filePath); Localization.translations.Add(translation); Localization.comboBoxTranslations.Add(translation.Name); //Localization.comboBoxTranslations.Add($"{translation.Name} [{translation.Version}]"); } } catch (Exception exc) { MsgBox.Popup("Loading translation failed", $"The translation '{Path.GetFileNameWithoutExtension(filePath)}' couldn't be loaded.\n{exc.GetType()}: {exc.Message}", MessageBoxIcon.Warning); } } // Set language: string selectedLanguageISO = IniFiles.Config.GetString("Preferences", "sLanguage", CultureInfo.CurrentUICulture.Name); int languageIndex = GetTranslationIndex(selectedLanguageISO); int enUSIndex = GetTranslationIndex("en-US"); Localization.comboBoxTranslations.SelectedIndex = languageIndex > -1 ? languageIndex : enUSIndex; Localization.Locale = selectedLanguageISO; }