diff --git a/EduNetworkBuilder/TranslationWindow.Designer.cs b/EduNetworkBuilder/TranslationWindow.Designer.cs index c1d27d8..d5b84b1 100644 --- a/EduNetworkBuilder/TranslationWindow.Designer.cs +++ b/EduNetworkBuilder/TranslationWindow.Designer.cs @@ -39,18 +39,18 @@ this.tb2Title = new System.Windows.Forms.TextBox(); this.tcTabPages = new System.Windows.Forms.TabControl(); this.tpMessageTitle = new System.Windows.Forms.TabPage(); - this.tpFormStuff = new System.Windows.Forms.TabPage(); - this.tb2URL = new System.Windows.Forms.TextBox(); this.tb1URL = new System.Windows.Forms.TextBox(); - this.btnChooseDir = new System.Windows.Forms.Button(); - this.lblFormDir = new System.Windows.Forms.Label(); + this.tb2URL = new System.Windows.Forms.TextBox(); + this.tpFormStuff = new System.Windows.Forms.TabPage(); this.panelTranslateFormItems = new System.Windows.Forms.Panel(); - this.cbFormLang1Choice = new System.Windows.Forms.ComboBox(); - this.cbFormLang2Choice = new System.Windows.Forms.ComboBox(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.lblFormItem = new System.Windows.Forms.Label(); - this.tbFormItem1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox(); + this.tbFormItem1 = new System.Windows.Forms.TextBox(); + this.lblFormItem = new System.Windows.Forms.Label(); + this.cbFormItemChoice = new System.Windows.Forms.ComboBox(); + this.cbFormLang2Choice = new System.Windows.Forms.ComboBox(); + this.cbFormLang1Choice = new System.Windows.Forms.ComboBox(); + this.lblFormDir = new System.Windows.Forms.Label(); + this.btnChooseDir = new System.Windows.Forms.Button(); this.tcTabPages.SuspendLayout(); this.tpMessageTitle.SuspendLayout(); this.tpFormStuff.SuspendLayout(); @@ -181,6 +181,22 @@ this.tpMessageTitle.Text = "Messages"; this.tpMessageTitle.UseVisualStyleBackColor = true; // + // tb1URL + // + this.tb1URL.Location = new System.Drawing.Point(6, 208); + this.tb1URL.Name = "tb1URL"; + this.tb1URL.Size = new System.Drawing.Size(438, 22); + this.tb1URL.TabIndex = 19; + this.tb1URL.Leave += new System.EventHandler(this.tb1URL_Leave); + // + // tb2URL + // + this.tb2URL.Location = new System.Drawing.Point(6, 413); + this.tb2URL.Name = "tb2URL"; + this.tb2URL.Size = new System.Drawing.Size(438, 22); + this.tb2URL.TabIndex = 18; + this.tb2URL.Leave += new System.EventHandler(this.tb2URL_Leave); + // // tpFormStuff // this.tpFormStuff.Controls.Add(this.panelTranslateFormItems); @@ -194,47 +210,12 @@ this.tpFormStuff.Text = "Forms"; this.tpFormStuff.UseVisualStyleBackColor = true; // - // tb2URL - // - this.tb2URL.Location = new System.Drawing.Point(6, 413); - this.tb2URL.Name = "tb2URL"; - this.tb2URL.Size = new System.Drawing.Size(438, 22); - this.tb2URL.TabIndex = 18; - this.tb2URL.Leave += new System.EventHandler(this.tb2URL_Leave); - // - // tb1URL - // - this.tb1URL.Location = new System.Drawing.Point(6, 208); - this.tb1URL.Name = "tb1URL"; - this.tb1URL.Size = new System.Drawing.Size(438, 22); - this.tb1URL.TabIndex = 19; - this.tb1URL.Leave += new System.EventHandler(this.tb1URL_Leave); - // - // btnChooseDir - // - this.btnChooseDir.Location = new System.Drawing.Point(28, 20); - this.btnChooseDir.Name = "btnChooseDir"; - this.btnChooseDir.Size = new System.Drawing.Size(75, 23); - this.btnChooseDir.TabIndex = 0; - this.btnChooseDir.Text = "..."; - this.btnChooseDir.UseVisualStyleBackColor = true; - this.btnChooseDir.Click += new System.EventHandler(this.btnChooseDir_Click); - // - // lblFormDir - // - this.lblFormDir.AutoSize = true; - this.lblFormDir.Location = new System.Drawing.Point(109, 23); - this.lblFormDir.Name = "lblFormDir"; - this.lblFormDir.Size = new System.Drawing.Size(117, 17); - this.lblFormDir.TabIndex = 1; - this.lblFormDir.Text = "Choose Directory"; - // // panelTranslateFormItems // this.panelTranslateFormItems.Controls.Add(this.textBox1); this.panelTranslateFormItems.Controls.Add(this.tbFormItem1); this.panelTranslateFormItems.Controls.Add(this.lblFormItem); - this.panelTranslateFormItems.Controls.Add(this.comboBox1); + this.panelTranslateFormItems.Controls.Add(this.cbFormItemChoice); this.panelTranslateFormItems.Controls.Add(this.cbFormLang2Choice); this.panelTranslateFormItems.Controls.Add(this.cbFormLang1Choice); this.panelTranslateFormItems.Location = new System.Drawing.Point(6, 88); @@ -242,38 +223,16 @@ this.panelTranslateFormItems.Size = new System.Drawing.Size(434, 338); this.panelTranslateFormItems.TabIndex = 2; // - // cbFormLang1Choice + // textBox1 // - this.cbFormLang1Choice.FormattingEnabled = true; - this.cbFormLang1Choice.Location = new System.Drawing.Point(28, 89); - this.cbFormLang1Choice.Name = "cbFormLang1Choice"; - this.cbFormLang1Choice.Size = new System.Drawing.Size(121, 24); - this.cbFormLang1Choice.TabIndex = 0; - // - // cbFormLang2Choice - // - this.cbFormLang2Choice.FormattingEnabled = true; - this.cbFormLang2Choice.Location = new System.Drawing.Point(28, 227); - this.cbFormLang2Choice.Name = "cbFormLang2Choice"; - this.cbFormLang2Choice.Size = new System.Drawing.Size(121, 24); - this.cbFormLang2Choice.TabIndex = 1; - // - // comboBox1 - // - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(106, 3); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(306, 24); - this.comboBox1.TabIndex = 3; - // - // lblFormItem - // - this.lblFormItem.AutoSize = true; - this.lblFormItem.Location = new System.Drawing.Point(21, 6); - this.lblFormItem.Name = "lblFormItem"; - this.lblFormItem.Size = new System.Drawing.Size(34, 17); - this.lblFormItem.TabIndex = 4; - this.lblFormItem.Text = "Item"; + this.textBox1.AcceptsReturn = true; + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Location = new System.Drawing.Point(28, 257); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(384, 72); + this.textBox1.TabIndex = 6; // // tbFormItem1 // @@ -286,16 +245,57 @@ this.tbFormItem1.Size = new System.Drawing.Size(384, 72); this.tbFormItem1.TabIndex = 5; // - // textBox1 + // lblFormItem // - this.textBox1.AcceptsReturn = true; - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(28, 257); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(384, 72); - this.textBox1.TabIndex = 6; + this.lblFormItem.AutoSize = true; + this.lblFormItem.Location = new System.Drawing.Point(21, 6); + this.lblFormItem.Name = "lblFormItem"; + this.lblFormItem.Size = new System.Drawing.Size(34, 17); + this.lblFormItem.TabIndex = 4; + this.lblFormItem.Text = "Item"; + // + // cbFormItemChoice + // + this.cbFormItemChoice.FormattingEnabled = true; + this.cbFormItemChoice.Location = new System.Drawing.Point(106, 3); + this.cbFormItemChoice.Name = "cbFormItemChoice"; + this.cbFormItemChoice.Size = new System.Drawing.Size(306, 24); + this.cbFormItemChoice.TabIndex = 3; + // + // cbFormLang2Choice + // + this.cbFormLang2Choice.FormattingEnabled = true; + this.cbFormLang2Choice.Location = new System.Drawing.Point(28, 227); + this.cbFormLang2Choice.Name = "cbFormLang2Choice"; + this.cbFormLang2Choice.Size = new System.Drawing.Size(121, 24); + this.cbFormLang2Choice.TabIndex = 1; + // + // cbFormLang1Choice + // + this.cbFormLang1Choice.FormattingEnabled = true; + this.cbFormLang1Choice.Location = new System.Drawing.Point(28, 89); + this.cbFormLang1Choice.Name = "cbFormLang1Choice"; + this.cbFormLang1Choice.Size = new System.Drawing.Size(121, 24); + this.cbFormLang1Choice.TabIndex = 0; + // + // lblFormDir + // + this.lblFormDir.AutoSize = true; + this.lblFormDir.Location = new System.Drawing.Point(109, 23); + this.lblFormDir.Name = "lblFormDir"; + this.lblFormDir.Size = new System.Drawing.Size(117, 17); + this.lblFormDir.TabIndex = 1; + this.lblFormDir.Text = "Choose Directory"; + // + // btnChooseDir + // + this.btnChooseDir.Location = new System.Drawing.Point(28, 20); + this.btnChooseDir.Name = "btnChooseDir"; + this.btnChooseDir.Size = new System.Drawing.Size(75, 23); + this.btnChooseDir.TabIndex = 0; + this.btnChooseDir.Text = "..."; + this.btnChooseDir.UseVisualStyleBackColor = true; + this.btnChooseDir.Click += new System.EventHandler(this.btnChooseDir_Click); // // TranslationWindow // @@ -342,7 +342,7 @@ private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox tbFormItem1; private System.Windows.Forms.Label lblFormItem; - private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.ComboBox cbFormItemChoice; private System.Windows.Forms.ComboBox cbFormLang2Choice; private System.Windows.Forms.ComboBox cbFormLang1Choice; private System.Windows.Forms.Label lblFormDir; diff --git a/EduNetworkBuilder/TranslationWindow.cs b/EduNetworkBuilder/TranslationWindow.cs index 905b809..ca1463d 100644 --- a/EduNetworkBuilder/TranslationWindow.cs +++ b/EduNetworkBuilder/TranslationWindow.cs @@ -42,6 +42,9 @@ namespace EduNetworkBuilder cb1Language.Items.Clear(); cb2Language.Items.Clear(); + cbFormLang1Choice.Items.Clear(); + cbFormLang2Choice.Items.Clear(); + panelTranslateFormItems.Enabled = false; NBSettings mySettings = NB.GetSettings(); @@ -55,13 +58,18 @@ namespace EduNetworkBuilder { cb1Language.Items.Add(LanguageChoices[i, 0]); cb2Language.Items.Add(LanguageChoices[i, 0]); - if(mySettings.LastTrans1Lang == LanguageChoices[i, 1]) + cbFormLang1Choice.Items.Add(LanguageChoices[i, 0]); + cbFormLang2Choice.Items.Add(LanguageChoices[i, 0]); + + if (mySettings.LastTrans1Lang == LanguageChoices[i, 1]) { cb1Language.SelectedItem = LanguageChoices[i, 0]; + cbFormLang1Choice.SelectedItem = LanguageChoices[i, 0]; } if (mySettings.LastTrans2Lang == LanguageChoices[i, 1]) { cb2Language.SelectedItem = LanguageChoices[i, 0]; + cbFormLang2Choice.SelectedItem = LanguageChoices[i, 0]; } } if (cb1Language.SelectedIndex == -1) cb1Language.SelectedIndex = 0; @@ -299,6 +307,27 @@ namespace EduNetworkBuilder TranslationResxFile TRF = new TranslationResxFile(currentFile); TranslationResxFiles.Add(TRF); } + PopulateFormTranslationItems(); + } + + private void PopulateFormTranslationItems() + { + cbFormItemChoice.Items.Clear(); + TranslationResxFile en = FileFromLangCode("en"); + if(en != null) + { + foreach(TranslationItem TI in en.Items) + { + cbFormItemChoice.Items.Add(TI.Key); + } + } + } + + private TranslationResxFile FileFromLangCode(string code) + { + foreach (TranslationResxFile one in TranslationResxFiles) + if (one.language == code) return one; + return null; } private void btnChooseDir_Click(object sender, EventArgs e) @@ -332,7 +361,7 @@ namespace EduNetworkBuilder public class TranslationResxFile { public string filename; - List Items = new List(); + public List Items = new List(); public string language = ""; string beginning = "translated: ";