private Language GetLanguage() { var englishLanguage = _languageProvider.FindBestLanguage("en"); var languageIso = _applicationLanguageProvider.GetApplicationLanguage(); var language = _languageProvider.GetAvailableLanguages().FirstOrDefault(lang => lang.Iso2 == languageIso); return(language ?? englishLanguage); }
public PdfCreatorSettings LoadPdfCreatorSettings() { MoveSettingsIfRequired(); var regStorage = BuildStorage(); var profileBuilder = new DefaultProfileBuilder(); var settings = profileBuilder.CreateEmptySettings(regStorage); var settingsUpgrader = new SettingsUpgradeHelper(SettingsVersion); if (UserSettingsExist()) { settings.LoadData(regStorage, "", settingsUpgrader.UpgradeSettings); } if (!CheckValidSettings(settings)) { var defaultLanguage = _languageDetector.FindDefaultLanguage(); if (!_languageProvider.HasTranslation(defaultLanguage)) { defaultLanguage = "English"; } var defaultSettings = profileBuilder.CreateDefaultSettings(FindPrimaryPrinter(), regStorage, defaultLanguage); if (DefaultUserSettingsExist()) { settings = LoadDefaultUserSettings(defaultSettings, profileBuilder, regStorage); } else { settings = defaultSettings; } } CheckAndAddMissingDefaultProfile(settings, profileBuilder); CheckPrinterMappings(settings); CheckTitleReplacement(settings); if (settings.ApplicationSettings.Language == "") { var language = _languageProvider.FindBestLanguage(CultureInfo.CurrentCulture); if (language != null) { settings.ApplicationSettings.Language = Path.GetFileNameWithoutExtension(language.FileName); } } TranslateProfilenames(settings); LogProfiles(settings); return(settings); }