diff --git a/src/.vs/XmlContentTranslator/v16/.suo b/src/.vs/XmlContentTranslator/v16/.suo new file mode 100644 index 0000000..8bae89a Binary files /dev/null and b/src/.vs/XmlContentTranslator/v16/.suo differ diff --git a/src/XmlContentTranslator/Main.Designer.cs b/src/XmlContentTranslator/Main.Designer.cs index 04426d4..f4f702a 100644 --- a/src/XmlContentTranslator/Main.Designer.cs +++ b/src/XmlContentTranslator/Main.Designer.cs @@ -90,19 +90,19 @@ private void InitializeComponent() this.translateViaGoogleToolStripMenuItem, this.setValueFromMasterToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(216, 48); + this.contextMenuStrip1.Size = new System.Drawing.Size(215, 48); // // translateViaGoogleToolStripMenuItem // this.translateViaGoogleToolStripMenuItem.Name = "translateViaGoogleToolStripMenuItem"; - this.translateViaGoogleToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.translateViaGoogleToolStripMenuItem.Size = new System.Drawing.Size(214, 22); this.translateViaGoogleToolStripMenuItem.Text = "Translate via google"; this.translateViaGoogleToolStripMenuItem.Click += new System.EventHandler(this.translateViaGoogleToolStripMenuItem_Click); // // setValueFromMasterToolStripMenuItem // this.setValueFromMasterToolStripMenuItem.Name = "setValueFromMasterToolStripMenuItem"; - this.setValueFromMasterToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.setValueFromMasterToolStripMenuItem.Size = new System.Drawing.Size(214, 22); this.setValueFromMasterToolStripMenuItem.Text = "Transfer value from master"; this.setValueFromMasterToolStripMenuItem.Click += new System.EventHandler(this.setValueFromMasterToolStripMenuItem_Click); // @@ -203,7 +203,7 @@ private void InitializeComponent() this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.googleTranslateSelectedLinesToolStripMenuItem}); this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; - this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 20); + this.toolsToolStripMenuItem.Size = new System.Drawing.Size(46, 20); this.toolsToolStripMenuItem.Text = "&Tools"; // // googleTranslateSelectedLinesToolStripMenuItem @@ -332,10 +332,11 @@ private void InitializeComponent() this.MainMenuStrip = this.menuStrip1; this.MinimumSize = new System.Drawing.Size(820, 350); this.Name = "Main"; - this.Text = "XML Content Translator 1.8"; + this.Text = "XML Content Translator 1.9"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1FormClosing); this.Load += new System.EventHandler(this.Form1Load); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1KeyDown); + this.Resize += new System.EventHandler(this.Main_Resize); this.contextMenuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); diff --git a/src/XmlContentTranslator/Main.cs b/src/XmlContentTranslator/Main.cs index ee27ad5..3c8a02f 100644 --- a/src/XmlContentTranslator/Main.cs +++ b/src/XmlContentTranslator/Main.cs @@ -554,11 +554,11 @@ public static string TranslateTextViaScreenScraping(string input, string languag input = input.Replace("'", "'"); //string url = String.Format("https://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}", HttpUtility.UrlEncode(input), languagePair); - string url = String.Format("https://translate.google.com/?hl=en&eotf=1&sl={0}&tl={1}&q={2}", languagePair.Substring(0, 2), languagePair.Substring(3), HttpUtility.UrlEncode(input)); + var url = $"https://translate.google.com/?hl=en&eotf=1&sl={languagePair.Substring(0, 2)}&tl={languagePair.Substring(3)}&q={HttpUtility.UrlEncode(input)}"; var webClient = new WebClient { Encoding = Encoding.Default }; - string result = webClient.DownloadString(url); - int startIndex = result.IndexOf(" 0) { @@ -577,7 +577,7 @@ public static string TranslateTextViaScreenScraping(string input, string languag } } } - string res = sb.ToString(); + var res = sb.ToString(); res = res.Replace("
", Environment.NewLine); res = res.Replace("
", Environment.NewLine); res = res.Replace("< BR />", Environment.NewLine); @@ -615,6 +615,7 @@ private void GoogleTranslateSelectedLines() foreach (ListViewItem item in listViewLanguageTags.SelectedItems) { oldText = item.SubItems[1].Text; + oldText = string.Join(Environment.NewLine, oldText.SplitToLines()); oldLines.Add(oldText); var urlEncode = HttpUtility.UrlEncode(sb + newText); if (urlEncode.Length >= 1000) @@ -1016,5 +1017,9 @@ private void listViewLanguageTags_DoubleClick(object sender, EventArgs e) } } + private void Main_Resize(object sender, EventArgs e) + { + listViewLanguageTags.Columns[listViewLanguageTags.Columns.Count - 1].Width = -2; + } } } \ No newline at end of file diff --git a/src/XmlContentTranslator/Properties/AssemblyInfo.cs b/src/XmlContentTranslator/Properties/AssemblyInfo.cs index d6e45d2..80fc04b 100644 --- a/src/XmlContentTranslator/Properties/AssemblyInfo.cs +++ b/src/XmlContentTranslator/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.0.0")] -[assembly: AssemblyFileVersion("1.7.0.0")] +[assembly: AssemblyVersion("1.9.0.0")] +[assembly: AssemblyFileVersion("1.9.0.0")] diff --git a/src/XmlContentTranslator/Properties/Resources.Designer.cs b/src/XmlContentTranslator/Properties/Resources.Designer.cs index 28e5b20..b228607 100644 --- a/src/XmlContentTranslator/Properties/Resources.Designer.cs +++ b/src/XmlContentTranslator/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace XmlContentTranslator.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/src/XmlContentTranslator/Properties/Settings.Designer.cs b/src/XmlContentTranslator/Properties/Settings.Designer.cs index 8879cd0..1248709 100644 --- a/src/XmlContentTranslator/Properties/Settings.Designer.cs +++ b/src/XmlContentTranslator/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace XmlContentTranslator.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/src/XmlContentTranslator/Translator/Formatting.cs b/src/XmlContentTranslator/Translator/Formatting.cs index 51422cd..d630ad4 100644 --- a/src/XmlContentTranslator/Translator/Formatting.cs +++ b/src/XmlContentTranslator/Translator/Formatting.cs @@ -49,7 +49,7 @@ public string SetTagsAndReturnTrimmed(string text, string source) char.IsLetterOrDigit(lines[0][lines[0].Length - 1]) && char.IsLower(lines[1][0])) { - text = text.Replace(Environment.NewLine, " ").Replace(" ", " "); + text = string.Join(" ", text.SplitToLines()).Replace(" ", " "); AutoBreak = true; } } diff --git a/src/XmlContentTranslator/XmlContentTranslator.csproj b/src/XmlContentTranslator/XmlContentTranslator.csproj index e1cc092..676a8db 100644 --- a/src/XmlContentTranslator/XmlContentTranslator.csproj +++ b/src/XmlContentTranslator/XmlContentTranslator.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,7 +10,7 @@ Properties XmlContentTranslator XmlContentTranslator - v4.0 + v4.6.2 512 Web_XML.ico @@ -28,6 +28,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -36,6 +37,7 @@ TRACE prompt 4 + false diff --git a/src/XmlContentTranslator/app.config b/src/XmlContentTranslator/app.config index fcd0c93..2a0024f 100644 --- a/src/XmlContentTranslator/app.config +++ b/src/XmlContentTranslator/app.config @@ -1,3 +1,3 @@ - +