示例#1
0
        private void LanguagePackPicker_Load(object sender, EventArgs e)
        {
            LocalizationLoader.ApplyLanguage(Controls, RuntimeSettings.Language);
            var loc = new LocalizationLoader();

            var n = 0;

            // Default language: English
            {
                var cb = new FirefoxRadioButton
                {
                    Location = new Point(10, 25 + n * 33),
                    Text     = "English (Official)",
                    Tag      = string.Empty,
                    Checked  = string.IsNullOrEmpty(_settings.GetLocal().LocalizationFile),
                    TabIndex = n,
                    TabStop  = true
                };

                groupBox1.Controls.Add(cb);
                _checkboxes.Add(cb);
                n++;
            }

            foreach (var path in _paths)
            {
                if (Directory.Exists(Path.Combine(path, "localization")))
                {
                    foreach (var file in Directory.EnumerateFiles(Path.Combine(path, "localization"), "*.zip"))
                    {
                        loc.CheckLanguage(file, out var author, out var language);

                        var cb = new FirefoxRadioButton
                        {
                            Location = new Point(10, 25 + n * 33),
                            Text     = RuntimeSettings.Language.GetTag("iatag_ui_language_by_author", language, author),
                            Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
                            Width    = groupBox1.Width - pictureBox1.Width,
                            Tag      = file,
                            Checked  = file == _settings.GetLocal().LocalizationFile,
                            TabIndex = n,
                            TabStop  = true
                        };

                        groupBox1.Controls.Add(cb);
                        _checkboxes.Add(cb);
                        n++;
                    }
                }
            }

            Height += n * 33;
        }
示例#2
0
        private void LanguagePackPicker_Load(object sender, EventArgs e)
        {
            LocalizationLoader loc = new LocalizationLoader();

            int n = 0;

            // Default language: English
            {
                FirefoxRadioButton cb = new FirefoxRadioButton {
                    Location = new Point(10, 25 + n * 33),
                    Text     = "English (Official)",
                    Tag      = string.Empty,
                    Checked  = string.IsNullOrEmpty(Properties.Settings.Default.LocalizationFile)
                };

                cb.TabIndex = n;
                cb.TabStop  = true;
                groupBox1.Controls.Add(cb);
                _checkboxes.Add(cb);
                n++;
            }

            foreach (var path in _paths)
            {
                if (Directory.Exists(Path.Combine(path, "localization")))
                {
                    foreach (var file in Directory.EnumerateFiles(Path.Combine(path, "localization"), "*.zip"))
                    {
                        string author;
                        string language;
                        loc.CheckLanguage(file, out author, out language);

                        FirefoxRadioButton cb = new FirefoxRadioButton {
                            Location = new Point(10, 25 + n * 33),
                            Text     = string.Format("{0} by {1}", language, author),
                            Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
                            Width    = groupBox1.Width - pictureBox1.Width,
                            Tag      = file,
                            Checked  = file == Properties.Settings.Default.LocalizationFile
                        };

                        cb.TabIndex = n;
                        cb.TabStop  = true;
                        groupBox1.Controls.Add(cb);
                        _checkboxes.Add(cb);
                        n++;
                    }
                }
            }

            this.Height += n * 33;
        }
示例#3
0
        private void LanguagePackPicker_Load(object sender, EventArgs e)
        {
            LocalizationLoader.ApplyLanguage(Controls, RuntimeSettings.Language);
            var loc = new LocalizationLoader();

            var n = 0;

            // Default language: English
            {
                var cb = new FirefoxRadioButton {
                    Location = new Point(10, 25 + n * 33),
                    Text     = "English (Official)",
                    Tag      = string.Empty,
                    Checked  = string.IsNullOrEmpty(_settings.GetLocal().LocalizationFile),
                    TabIndex = n,
                    TabStop  = true
                };

                groupBox1.Controls.Add(cb);
                _checkboxes.Add(cb);
                n++;
            }

            foreach (var path in _paths)
            {
                if (Directory.Exists(Path.Combine(path, "localization")))
                {
                    foreach (var file in Directory.EnumerateFiles(Path.Combine(path, "localization"), "*.zip"))
                    {
                        loc.CheckLanguage(file, out var author, out var language);

                        var isFullyTranslatedTag = LocalizationLoader.IsFullySupportedTranslation(file) ? "" : "[Partial] ";
                        var cb = new FirefoxRadioButton {
                            Location = new Point(10, 25 + n * 33),
                            Text     = isFullyTranslatedTag + RuntimeSettings.Language.GetTag("iatag_ui_language_by_author", language, author),
                            Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
                            Width    = groupBox1.Width - pictureBox1.Width,
                            Tag      = file,
                            Checked  = file == _settings.GetLocal().LocalizationFile,
                            TabIndex = n,
                            TabStop  = true
                        };

                        groupBox1.Controls.Add(cb);
                        _checkboxes.Add(cb);
                        n++;
                    }
                }
            }


            var delta = Math.Min(Math.Max(0, n - 5), 15) * 33; // We already have space for 5, only expand if we exceed this.

            if (delta > 0)
            {
                var newHeight = Height + delta;
                MaximumSize         = new Size(MaximumSize.Width, newHeight);
                MinimumSize         = new Size(MinimumSize.Width, newHeight);
                Height              = newHeight;
                lblWarning.Location = new Point(lblWarning.Location.X, lblWarning.Location.Y + delta);
            }
        }