Esempio n. 1
0
		public static void LoadLanguage(Form parent, bool force) {
			if (force || Properties.Settings.Default.SelectedLanguage == ELanguage.None) {
				using (frmLanguage frm = new frmLanguage(Properties.Settings.Default.SelectedLanguage)) {
					if (frm.ShowDialog(parent) == System.Windows.Forms.DialogResult.OK) {
						string lang = frm.SelectedLanguage.FirstCharToUpper();
						Properties.Settings.Default.SelectedLanguage = (ELanguage)Enum.Parse(typeof(ELanguage), lang);
					}
				}
			}

			// Default to english
			if (Properties.Settings.Default.SelectedLanguage == ELanguage.None) {
				Properties.Settings.Default.SelectedLanguage = ELanguage.English;
			}

			if (Language == null || Language.Language != Properties.Settings.Default.SelectedLanguage) {
				// Initialize locale helper
				ResourceManager mgrLocales = null;
				ResourceManager mgrResources = null;
				CultureInfo culture = null;
				switch (Properties.Settings.Default.SelectedLanguage) {
					case ELanguage.German:
						mgrLocales = locale_de.ResourceManager;
						mgrResources = Properties.Resources.ResourceManager;
						culture = locale_de.Culture;
						break;
					case ELanguage.English:
						mgrLocales = locale_en.ResourceManager;
						mgrResources = Properties.Resources.ResourceManager;
						culture = locale_en.Culture;
						break;
				}
				Language = new LocaleHelper(Properties.Settings.Default.SelectedLanguage, mgrLocales, mgrResources, culture);
			}
		}
Esempio n. 2
0
        public static void LoadLanguage(Form parent, bool force)
        {
            if (force || Properties.Settings.Default.SelectedLanguage == ELanguage.None)
            {
                using (frmLanguage frm = new frmLanguage(Properties.Settings.Default.SelectedLanguage)) {
                    if (frm.ShowDialog(parent) == System.Windows.Forms.DialogResult.OK)
                    {
                        string lang = frm.SelectedLanguage.FirstCharToUpper();
                        Properties.Settings.Default.SelectedLanguage = (ELanguage)Enum.Parse(typeof(ELanguage), lang);
                    }
                }
            }

            // Default to english
            if (Properties.Settings.Default.SelectedLanguage == ELanguage.None)
            {
                Properties.Settings.Default.SelectedLanguage = ELanguage.English;
            }

            if (Language == null || Language.Language != Properties.Settings.Default.SelectedLanguage)
            {
                // Initialize locale helper
                ResourceManager mgrLocales   = null;
                ResourceManager mgrResources = null;
                CultureInfo     culture      = null;
                switch (Properties.Settings.Default.SelectedLanguage)
                {
                case ELanguage.German:
                    mgrLocales   = locale_de.ResourceManager;
                    mgrResources = Properties.Resources.ResourceManager;
                    culture      = locale_de.Culture;
                    break;

                case ELanguage.English:
                    mgrLocales   = locale_en.ResourceManager;
                    mgrResources = Properties.Resources.ResourceManager;
                    culture      = locale_en.Culture;
                    break;
                }
                Language = new LocaleHelper(Properties.Settings.Default.SelectedLanguage, mgrLocales, mgrResources, culture);
            }
        }