Minor fix in Google translate

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@473 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-06-07 20:11:53 +00:00
parent a39385dd81
commit b2897ea4fb
3 changed files with 13 additions and 1 deletions

View File

@ -176,6 +176,7 @@
this.Name = "GoogleOrMicrosoftTranslate";
this.Text = "GoogleOrMicrosoftTranslate";
this.Shown += new System.EventHandler(this.GoogleOrMicrosoftTranslate_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GoogleOrMicrosoftTranslate_KeyDown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -2,12 +2,14 @@
using System.Windows.Forms;
using Nikse.SubtitleEdit.Logic;
using System.Drawing;
using System.ComponentModel;
namespace Nikse.SubtitleEdit.Forms
{
public sealed partial class GoogleOrMicrosoftTranslate : Form
{
public string TranslatedText { get; set; }
private string _googleText = null;
public GoogleOrMicrosoftTranslate()
{
@ -18,7 +20,7 @@ namespace Nikse.SubtitleEdit.Forms
RemovedLanguagesNotInMicrosoftTranslate(comboBoxTo);
labelFrom.Text = Configuration.Settings.Language.GoogleOrMicrosoftTranslate.From;
labelTo.Text = Configuration.Settings.Language.GoogleOrMicrosoftTranslate.From;
labelTo.Text = Configuration.Settings.Language.GoogleOrMicrosoftTranslate.To;
labelSourceText.Text = Configuration.Settings.Language.GoogleOrMicrosoftTranslate.SourceText;
buttonGoogle.Text = Configuration.Settings.Language.GoogleOrMicrosoftTranslate.GoogleTranslate;
buttonMicrosoft.Text = Configuration.Settings.Language.GoogleOrMicrosoftTranslate.MicrosoftTranslate;
@ -96,6 +98,8 @@ namespace Nikse.SubtitleEdit.Forms
string from = (comboBoxFrom.SelectedItem as Nikse.SubtitleEdit.Forms.GoogleTranslate.ComboBoxItem).Value;
string to = (comboBoxTo.SelectedItem as Nikse.SubtitleEdit.Forms.GoogleTranslate.ComboBoxItem).Value;
string languagePair = from + "|" + to;
buttonGoogle.Text = string.Empty;
buttonGoogle.Text = Forms.GoogleTranslate.TranslateTextViaApi(textBoxSourceText.Text, languagePair);
GoogleTranslate gt = new GoogleTranslate();
@ -137,5 +141,11 @@ namespace Nikse.SubtitleEdit.Forms
DialogResult = DialogResult.OK;
}
private void GoogleOrMicrosoftTranslate_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
DialogResult = DialogResult.Cancel;
}
}
}

View File

@ -291,6 +291,7 @@ namespace Nikse.SubtitleEdit.Forms
test = test.Replace("\\u0026#39;", "'");
test = test.Replace("\\u0026amp;", "&");
test = test.Replace("\\u0026quot;", "\"");
test = test.Replace("\\u0026apos;", "'");
test = test.Replace("\\u0026lt;", "<");
test = test.Replace("\\u0026gt;", ">");
test = test.Replace("\\u003d", "=");