/// <summary>
        /// Handler for the SpellChecker category
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void buttonLanguage_Click(object sender, EventArgs e)
        {
            bool isDefault = false;

            var installedLanguages = ResourceUtils.EnumerateInstalledLanguages();

            if (installedLanguages.Count() > 1)
            {
                Hide();
                var cultureInfo = LanguageSelectForm.SelectLanguage();
                Show();
                if (cultureInfo == null)
                {
                    ResourceUtils.SetEnglishCulture();
                    cultureInfo = CultureInfo.DefaultThreadCurrentUICulture;
                }
                else
                {
                    ResourceUtils.SetCulture(cultureInfo.Name);
                    isDefault = LanguageSelectForm.IsDefault;
                }

                if (EvtLanguageChanged != null)
                {
                    EvtLanguageChanged(this, new PreferencesLanguageChanged(cultureInfo, isDefault));
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Displays the language form to enable the user to select
        /// the preferred language
        /// </summary>
        /// <returns>The selected culture</returns>
        public static CultureInfo SelectLanguage()
        {
            var cultureInfos = ResourceUtils.EnumerateInstalledLanguages();

            if (cultureInfos.Count() == 1)
            {
                return(cultureInfos.ElementAt(0));
            }

            var form = new LanguageSelectForm();

            if (form.ShowDialog() == DialogResult.Cancel || form.SelectedCulture == null)
            {
                return(null);
            }

            IsDefault = form.checkBoxSetAsDefault.Checked;

            return(form.SelectedCulture);
        }