Пример #1
0
        void cbLanguage_SelectedValueChanged(object sender, EventArgs e)
        {
            ImageComboItem itm  = (ImageComboItem)this.cbLanguage.SelectedItem;
            LocaleItem     lang = (LocaleItem)itm.Tag;

            optset.Language          = lang.LocaleValue;
            this.localizator.Culture = optset.Language;
            this.localizator.Localize(this);
        }
Пример #2
0
        private void LoadLanguageDirectory(string path)
        {
            int i;

            cbLanguage.Items.Clear();

            if (!Directory.Exists(path))
            {
                return;
            }

            string[] langFiles = Directory.GetFiles(path, "*.resources");
            if (langFiles.Length <= 0)
            {
                return;
            }

            for (i = 0; i < langFiles.Length; i++)
            {
                FileInfo finfo = new FileInfo(langFiles[i]);
                string   args  = finfo.Name.Replace(finfo.Extension, "");
                args = args.Replace("lang.", "");

                string         locale_name = (string)locales[args];
                LocaleItem     itm         = new LocaleItem(locale_name, args);
                ImageComboItem cbitm       = new ImageComboItem(itm.LocaleName, LocaleImageIndex(args));
                cbitm.Tag = itm;
                int pos = cbLanguage.Items.Add(cbitm);
            }

            for (i = 0; i < cbLanguage.Items.Count; i++)
            {
                ImageComboItem itm  = (ImageComboItem)cbLanguage.Items[i];
                LocaleItem     litm = (LocaleItem)itm.Tag;
                if (litm.LocaleValue == optset.Language)
                {
                    cbLanguage.SelectedIndex = i;
                    startupLanguageIdx       = i;
                    break;
                }
            }
        }
Пример #3
0
        private void LoadLanguageDirectory(string path)
        {
            int i;
            cbLanguage.Items.Clear();

            if (!Directory.Exists(path)) return;

            string[] langFiles = Directory.GetFiles(path, "*.resources");
            if (langFiles.Length <= 0)
                return;

            for (i = 0; i < langFiles.Length; i++)
            {
                FileInfo finfo = new FileInfo(langFiles[i]);
                string args = finfo.Name.Replace(finfo.Extension, "");
                args = args.Replace("lang.", "");

                string locale_name = (string)locales[args];
                LocaleItem itm = new LocaleItem(locale_name, args);
                ImageComboItem cbitm = new ImageComboItem(itm.LocaleName, LocaleImageIndex(args));
                cbitm.Tag = itm;
                int pos = cbLanguage.Items.Add(cbitm);

            }

            for (i = 0; i < cbLanguage.Items.Count; i++)
            {
                ImageComboItem itm =(ImageComboItem)cbLanguage.Items[i];
                LocaleItem litm = (LocaleItem)itm.Tag;
                if ( litm.LocaleValue == optset.Language)
                {
                    cbLanguage.SelectedIndex = i;
                    startupLanguageIdx = i;
                    break;
                }

            }
        }