Work on translate

This commit is contained in:
niksedk 2023-10-01 18:01:22 +02:00
parent f29a63be58
commit aa19d68c7e
6 changed files with 28 additions and 8 deletions

View File

@ -1926,7 +1926,8 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemSelectedLines.Text = _language.Menu.ContextMenu.SelectedLines;
toolStripMenuItemAutoTranslate.Text = _language.Menu.AutoTranslate.Title;
genericTranslateToolStripMenuItem.Text = _language.Menu.AutoTranslate.AutoTranslate;
genericTranslateToolStripMenuItem.Text = _language.Menu.AutoTranslate.AutoTranslate + " (OLD)";
autotranslateNLLBToolStripMenuItem.Text = _language.Menu.AutoTranslate.AutoTranslate + " (NEW)";
autotranslateViaCopypasteToolStripMenuItem.Text = _language.Menu.AutoTranslate.AutoTranslateViaCopyPaste;
translateToolStripMenuItem.Text = _language.Menu.AutoTranslate.AutoTranslate;
toolStripMenuItemTranslateSelected.Text = _language.Menu.ContextMenu.TranslateSelectedLines;

View File

@ -392,7 +392,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
listBoxSection.Items[VideoPlayerSection] = language.VideoPlayer;
listBoxSection.Items[WaveformAndSpectrogramSection] = language.WaveformAndSpectrogram;
listBoxSection.Items[ToolsSection] = language.Tools;
listBoxSection.Items[AutoTranslateSection] = language.AutoTranslate;
listBoxSection.Items[AutoTranslateSection] = LanguageSettings.Current.Main.VideoControls.AutoTranslate;
listBoxSection.Items[ToolbarSection] = language.Toolbar;
listBoxSection.Items[AppearanceSection] = language.Appearance;
listBoxSection.Items[NetworkSection] = language.Network;

View File

@ -35,11 +35,14 @@ namespace Nikse.SubtitleEdit.Forms.Translate
InitializeComponent();
UiUtil.FixFonts(this);
Text = LanguageSettings.Current.GoogleTranslate.Title;
Text = LanguageSettings.Current.Main.VideoControls.AutoTranslate;
buttonTranslate.Text = LanguageSettings.Current.GoogleTranslate.Translate;
labelPleaseWait.Text = LanguageSettings.Current.GoogleTranslate.PleaseWait;
buttonOK.Text = LanguageSettings.Current.General.Ok;
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
labelUrl.Text = LanguageSettings.Current.Main.Url;
nikseComboBoxUrl.Left = labelUrl.Right + 5;
subtitleListViewSource.InitializeLanguage(LanguageSettings.Current.General, Configuration.Settings);
subtitleListViewTarget.InitializeLanguage(LanguageSettings.Current.General, Configuration.Settings);
subtitleListViewSource.HideColumn(SubtitleListView.SubtitleColumn.CharactersPerSeconds);
@ -96,11 +99,18 @@ namespace Nikse.SubtitleEdit.Forms.Translate
{
_autoTranslatorEngines = new List<IAutoTranslator>
{
new GoogleTranslateV1(),
new NoLanguageLeftBehindServe(),
new NoLanguageLeftBehindApi(),
new LibreTranslate(),
};
if (!string.IsNullOrEmpty(Configuration.Settings.Tools.MicrosoftTranslatorApiKey) &&
!string.IsNullOrEmpty(Configuration.Settings.Tools.MicrosoftTranslatorTokenEndpoint))
{
_autoTranslatorEngines.Insert(1, new MicrosoftTranslator());
}
nikseComboBoxEngine.Items.Clear();
nikseComboBoxEngine.Items.AddRange(_autoTranslatorEngines.Select(p => p.Name).ToArray<object>());
@ -132,6 +142,20 @@ namespace Nikse.SubtitleEdit.Forms.Translate
linkLabelPoweredBy.Text = string.Format(LanguageSettings.Current.GoogleTranslate.PoweredByX, _autoTranslator.Name);
var engineType = _autoTranslator.GetType();
if (engineType == typeof(GoogleTranslateV1))
{
labelUrl.Visible = false;
nikseComboBoxUrl.Visible = false;
return;
}
if (engineType == typeof(MicrosoftTranslator))
{
labelUrl.Visible = false;
nikseComboBoxUrl.Visible = false;
return;
}
if (engineType == typeof(NoLanguageLeftBehindServe))
{
FillUrls(new List<string>

View File

@ -2638,7 +2638,6 @@ can edit in same subtitle file (collaboration)",
VideoPlayer = "Video player",
WaveformAndSpectrogram = "Waveform/spectrogram",
Tools = "Tools",
AutoTranslate = "Auto-translate",
WordLists = "Word lists",
SsaStyle = "ASS/SSA Style",
Network = "Network",

View File

@ -6127,9 +6127,6 @@ namespace Nikse.SubtitleEdit.Logic
case "Settings/Tools":
language.Settings.Tools = reader.Value;
break;
case "Settings/AutoTranslate":
language.Settings.AutoTranslate = reader.Value;
break;
case "Settings/WordLists":
language.Settings.WordLists = reader.Value;
break;

View File

@ -2450,7 +2450,6 @@
public string VideoPlayer { get; set; }
public string WaveformAndSpectrogram { get; set; }
public string Tools { get; set; }
public string AutoTranslate { get; set; }
public string WordLists { get; set; }
public string SsaStyle { get; set; }
public string Network { get; set; }