From 471436073dddfa00e5e2d589aabdc16b1479d238 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Thu, 21 May 2020 08:13:33 +0200 Subject: [PATCH] Fixes for Bing translate token endpoint - thx obliver27 :) Related to #4194 --- libse/Settings.cs | 2 ++ src/Forms/Settings.Designer.cs | 48 ++++++++++++++++++---------------- src/Forms/Settings.cs | 4 +-- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/libse/Settings.cs b/libse/Settings.cs index bd0c67994..1b68feec0 100644 --- a/libse/Settings.cs +++ b/libse/Settings.cs @@ -324,6 +324,7 @@ namespace Nikse.SubtitleEdit.Core OcrAddLetterRow1 = "♪;á;é;í;ó;ö;ő;ú;ü;ű;ç;ñ;å;¿"; OcrAddLetterRow2 = "♫;Á;É;Í;Ó;Ö;Ő;Ú;Ü;Ű;Ç;Ñ;Å;¡"; Interjections = "Ah;Ahem;Ahh;Ahhh;Ahhhh;Eh;Ehh;Ehhh;Hm;Hmm;Hmmm;Huh;Mm;Mmm;Mmmm;Phew;Gah;Oh;Ohh;Ohhh;Ow;Oww;Owww;Ugh;Ughh;Uh;Uhh;Uhhh;Whew"; + MicrosoftTranslatorTokenEndpoint = "https://api.cognitive.microsoft.com/sts/v1.0/issueToken"; GoogleApiV2KeyInfoShow = true; GoogleTranslateNoKeyWarningShow = true; UseGooleApiPaidService = false; @@ -1993,6 +1994,7 @@ $HorzAlign = Center settings.Version.StartsWith("3.5.13", StringComparison.Ordinal)) { settings.Shortcuts.MainTranslateGoogleTranslate = "Control+Shift+G"; + settings.Tools.MicrosoftTranslatorTokenEndpoint = "https://api.cognitive.microsoft.com/sts/v1.0/issueToken"; } } catch (Exception exception) diff --git a/src/Forms/Settings.Designer.cs b/src/Forms/Settings.Designer.cs index 86447fe0f..b75028cea 100644 --- a/src/Forms/Settings.Designer.cs +++ b/src/Forms/Settings.Designer.cs @@ -216,8 +216,8 @@ this.linkLabelGoogleTranslateSignUp = new System.Windows.Forms.LinkLabel(); this.label3 = new System.Windows.Forms.Label(); this.groupBoxBing = new System.Windows.Forms.GroupBox(); + this.comboBoxBoxBingTokenEndpoint = new System.Windows.Forms.ComboBox(); this.labelBingTokenEndpoint = new System.Windows.Forms.Label(); - this.textBoxBingTokenEndpoint = new System.Windows.Forms.TextBox(); this.labelBingApiKey = new System.Windows.Forms.Label(); this.textBoxBingClientSecret = new System.Windows.Forms.TextBox(); this.linkLabelBingSubscribe = new System.Windows.Forms.LinkLabel(); @@ -234,6 +234,7 @@ this.buttonEditDoNotBreakAfterList = new System.Windows.Forms.Button(); this.checkBoxUseDoNotBreakAfterList = new System.Windows.Forms.CheckBox(); this.groupBoxSpellCheck = new System.Windows.Forms.GroupBox(); + this.checkBoxSpellCheckAutoChangeNamesViaSuggestions = new System.Windows.Forms.CheckBox(); this.checkBoxUseAlwaysToFile = new System.Windows.Forms.CheckBox(); this.checkBoxTreatINQuoteAsING = new System.Windows.Forms.CheckBox(); this.checkBoxSpellCheckOneLetterWords = new System.Windows.Forms.CheckBox(); @@ -385,7 +386,6 @@ this.openFileDialogFFmpeg = new System.Windows.Forms.OpenFileDialog(); this.buttonReset = new System.Windows.Forms.Button(); this.toolTipContinuationPreview = new System.Windows.Forms.ToolTip(this.components); - this.checkBoxSpellCheckAutoChangeNamesViaSuggestions = new System.Windows.Forms.CheckBox(); this.tabControlSettings.SuspendLayout(); this.tabPageGeneral.SuspendLayout(); this.groupBoxMiscellaneous.SuspendLayout(); @@ -2841,8 +2841,8 @@ this.groupBoxBing.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxBing.Controls.Add(this.comboBoxBoxBingTokenEndpoint); this.groupBoxBing.Controls.Add(this.labelBingTokenEndpoint); - this.groupBoxBing.Controls.Add(this.textBoxBingTokenEndpoint); this.groupBoxBing.Controls.Add(this.labelBingApiKey); this.groupBoxBing.Controls.Add(this.textBoxBingClientSecret); this.groupBoxBing.Controls.Add(this.linkLabelBingSubscribe); @@ -2854,22 +2854,26 @@ this.groupBoxBing.TabStop = false; this.groupBoxBing.Text = "Bing translator"; // + // comboBoxBoxBingTokenEndpoint + // + this.comboBoxBoxBingTokenEndpoint.FormattingEnabled = true; + this.comboBoxBoxBingTokenEndpoint.Items.AddRange(new object[] { + "https://api.cognitive.microsoft.com/sts/v1.0/issueToken", + "https://.api.cognitive.microsoft.com/sts/v1.0/issueToken"}); + this.comboBoxBoxBingTokenEndpoint.Location = new System.Drawing.Point(9, 101); + this.comboBoxBoxBingTokenEndpoint.Name = "comboBoxBoxBingTokenEndpoint"; + this.comboBoxBoxBingTokenEndpoint.Size = new System.Drawing.Size(375, 21); + this.comboBoxBoxBingTokenEndpoint.TabIndex = 33; + // // labelBingTokenEndpoint // this.labelBingTokenEndpoint.AutoSize = true; - this.labelBingTokenEndpoint.Location = new System.Drawing.Point(6, 82); + this.labelBingTokenEndpoint.Location = new System.Drawing.Point(6, 83); this.labelBingTokenEndpoint.Name = "labelBingTokenEndpoint"; this.labelBingTokenEndpoint.Size = new System.Drawing.Size(81, 13); this.labelBingTokenEndpoint.TabIndex = 32; this.labelBingTokenEndpoint.Text = "Token endpoint"; // - // textBoxBingTokenEndpoint - // - this.textBoxBingTokenEndpoint.Location = new System.Drawing.Point(10, 98); - this.textBoxBingTokenEndpoint.Name = "textBoxBingTokenEndpoint"; - this.textBoxBingTokenEndpoint.Size = new System.Drawing.Size(374, 21); - this.textBoxBingTokenEndpoint.TabIndex = 31; - // // labelBingApiKey // this.labelBingApiKey.AutoSize = true; @@ -3052,6 +3056,16 @@ this.groupBoxSpellCheck.TabStop = false; this.groupBoxSpellCheck.Text = "Spell check"; // + // checkBoxSpellCheckAutoChangeNamesViaSuggestions + // + this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.AutoSize = true; + this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.Location = new System.Drawing.Point(30, 43); + this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.Name = "checkBoxSpellCheckAutoChangeNamesViaSuggestions"; + this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.Size = new System.Drawing.Size(184, 17); + this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.TabIndex = 1; + this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.Text = "Also use \'spell check suggestions\'"; + this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.UseVisualStyleBackColor = true; + // // checkBoxUseAlwaysToFile // this.checkBoxUseAlwaysToFile.AutoSize = true; @@ -4673,16 +4687,6 @@ this.toolTipContinuationPreview.InitialDelay = 500; this.toolTipContinuationPreview.ReshowDelay = 100; // - // checkBoxSpellCheckAutoChangeNamesViaSuggestions - // - this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.AutoSize = true; - this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.Location = new System.Drawing.Point(30, 43); - this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.Name = "checkBoxSpellCheckAutoChangeNamesViaSuggestions"; - this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.Size = new System.Drawing.Size(184, 17); - this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.TabIndex = 1; - this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.Text = "Also use \'spell check suggestions\'"; - this.checkBoxSpellCheckAutoChangeNamesViaSuggestions.UseVisualStyleBackColor = true; - // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -5152,7 +5156,6 @@ private System.Windows.Forms.Label labelRulesProfileName; private System.Windows.Forms.CheckBox checkBoxCpsIncludeWhiteSpace; private System.Windows.Forms.Label labelBingTokenEndpoint; - private System.Windows.Forms.TextBox textBoxBingTokenEndpoint; private System.Windows.Forms.CheckBox checkBoxToolsBreakEarlyComma; private System.Windows.Forms.CheckBox checkBoxToolsBreakEarlyDash; private System.Windows.Forms.CheckBox checkBoxToolsBreakEarlyLineEnding; @@ -5180,5 +5183,6 @@ private System.Windows.Forms.Button buttonWaveformCursorColor; private System.Windows.Forms.Button buttonGapChoose; private System.Windows.Forms.CheckBox checkBoxSpellCheckAutoChangeNamesViaSuggestions; + private System.Windows.Forms.ComboBox comboBoxBoxBingTokenEndpoint; } } \ No newline at end of file diff --git a/src/Forms/Settings.cs b/src/Forms/Settings.cs index 06e29b98e..8b8e175c6 100644 --- a/src/Forms/Settings.cs +++ b/src/Forms/Settings.cs @@ -900,7 +900,7 @@ namespace Nikse.SubtitleEdit.Forms checkBoxCpsIncludeWhiteSpace.Checked = !Configuration.Settings.General.CharactersPerSecondsIgnoreWhiteSpace; textBoxBingClientSecret.Text = Configuration.Settings.Tools.MicrosoftTranslatorApiKey; - textBoxBingTokenEndpoint.Text = Configuration.Settings.Tools.MicrosoftTranslatorTokenEndpoint; + comboBoxBoxBingTokenEndpoint.Text = Configuration.Settings.Tools.MicrosoftTranslatorTokenEndpoint; textBoxGoogleTransleApiKey.Text = toolsSettings.GoogleApiV2Key; buttonReset.Text = Configuration.Settings.Language.Settings.RestoreDefaultSettings; @@ -1799,7 +1799,7 @@ namespace Nikse.SubtitleEdit.Forms toolsSettings.FixShortDisplayTimesAllowMoveStartTime = checkBoxFixShortDisplayTimesAllowMoveStartTime.Checked; toolsSettings.FixCommonErrorsSkipStepOne = checkBoxFceSkipStep1.Checked; toolsSettings.MicrosoftTranslatorApiKey = textBoxBingClientSecret.Text.Trim(); - toolsSettings.MicrosoftTranslatorTokenEndpoint = textBoxBingTokenEndpoint.Text.Trim(); + toolsSettings.MicrosoftTranslatorTokenEndpoint = comboBoxBoxBingTokenEndpoint.Text.Trim(); toolsSettings.GoogleApiV2Key = textBoxGoogleTransleApiKey.Text.Trim(); var wordListSettings = Configuration.Settings.WordLists;