Exemple #1
0
        private void InitializeInternationalization()
        {
            // Set up language information
            if (string.IsNullOrWhiteSpace(GW2PAO.Properties.Settings.Default.Language))
            {
                var lang = LanguageExtensions.FromTwoLetterISOLanguageName(CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);
                GW2PAO.Properties.Settings.Default.Language = lang.ToTwoLetterISOLanguageName();
                GW2PAO.Properties.Settings.Default.Save();
            }

            // Note: this conversion, while it may seem redundant, ensures that we use only use a known language
            // If the CurrentUICulture is something other than the supported languages, this call defaults it to english.
            var savedLang = LanguageExtensions.FromTwoLetterISOLanguageName(GW2PAO.Properties.Settings.Default.Language);

            CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(savedLang.ToTwoLetterISOLanguageName());
        }
 /// <summary>
 /// Determines if the current language can be applied (e.g. if it is different)
 /// </summary>
 private bool CanApplyLanguage()
 {
     return(LanguageExtensions.FromTwoLetterISOLanguageName(Settings.Default.Language) != this.currentLanguage);
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 public GeneralSettingsViewModel()
 {
     this.ApplyLanguageCommand = new DelegateCommand(this.ApplyLanguage, this.CanApplyLanguage);
     this.currentLanguage      = LanguageExtensions.FromTwoLetterISOLanguageName(Settings.Default.Language);
 }