mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 04:33:04 +01:00
More language filter
This commit is contained in:
parent
8854486351
commit
d7358b5910
@ -186,7 +186,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
|
||||
private void Init()
|
||||
{
|
||||
InitializeLanguageNames();
|
||||
InitializeLanguageNames(comboBoxLanguages);
|
||||
|
||||
FillModels(comboBoxModels, string.Empty);
|
||||
|
||||
@ -1930,16 +1930,16 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
}
|
||||
}
|
||||
|
||||
InitializeLanguageNames();
|
||||
InitializeLanguageNames(comboBoxLanguages);
|
||||
return;
|
||||
}
|
||||
|
||||
checkBoxTranslateToEnglish.Enabled = comboBoxLanguages.Text.ToLowerInvariant() != "english";
|
||||
}
|
||||
|
||||
private void InitializeLanguageNames()
|
||||
internal static void InitializeLanguageNames(NikseComboBox comboBox)
|
||||
{
|
||||
comboBoxLanguages.Items.Clear();
|
||||
comboBox.Items.Clear();
|
||||
|
||||
var languagesFilled = false;
|
||||
|
||||
@ -1960,24 +1960,24 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
}
|
||||
}
|
||||
|
||||
comboBoxLanguages.Items.AddRange(languagesToAdd.OrderBy(p => p.Name).ToArray<object>());
|
||||
comboBox.Items.AddRange(languagesToAdd.OrderBy(p => p.Name).ToArray<object>());
|
||||
|
||||
var lang = languages.FirstOrDefault(p => p.Code == Configuration.Settings.Tools.WhisperLanguageCode);
|
||||
comboBoxLanguages.Text = lang != null ? lang.ToString() : "English";
|
||||
comboBox.Text = lang != null ? lang.ToString() : "English";
|
||||
}
|
||||
|
||||
if (!languagesFilled)
|
||||
{
|
||||
comboBoxLanguages.Items.AddRange(WhisperLanguage.Languages.OrderBy(p => p.Name).ToArray<object>());
|
||||
comboBox.Items.AddRange(WhisperLanguage.Languages.OrderBy(p => p.Name).ToArray<object>());
|
||||
var lang = WhisperLanguage.Languages.FirstOrDefault(p => p.Code == Configuration.Settings.Tools.WhisperLanguageCode);
|
||||
comboBoxLanguages.Text = lang != null ? lang.ToString() : "English";
|
||||
comboBox.Text = lang != null ? lang.ToString() : "English";
|
||||
}
|
||||
|
||||
comboBoxLanguages.Items.Add(LanguageSettings.Current.General.ChangeLanguageFilter);
|
||||
comboBox.Items.Add(LanguageSettings.Current.General.ChangeLanguageFilter);
|
||||
|
||||
if (string.IsNullOrEmpty(comboBoxLanguages.Text) && comboBoxLanguages.Items.Count > 0)
|
||||
if (string.IsNullOrEmpty(comboBox.Text) && comboBox.Items.Count > 0)
|
||||
{
|
||||
comboBoxLanguages.SelectedIndex = 0;
|
||||
comboBox.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Nikse.SubtitleEdit.Core.AudioToText;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Forms.Options;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
@ -82,10 +83,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
|
||||
private void Init()
|
||||
{
|
||||
comboBoxLanguages.Items.Clear();
|
||||
comboBoxLanguages.Items.AddRange(WhisperLanguage.Languages.OrderBy(p => p.Name).ToArray<object>());
|
||||
var lang = WhisperLanguage.Languages.FirstOrDefault(p => p.Code == Configuration.Settings.Tools.WhisperLanguageCode);
|
||||
comboBoxLanguages.Text = lang != null ? lang.ToString() : "English";
|
||||
WhisperAudioToText.InitializeLanguageNames(comboBoxLanguages);
|
||||
|
||||
WhisperAudioToText.FillModels(comboBoxModels, string.Empty);
|
||||
|
||||
removeTemporaryFilesToolStripMenuItem.Checked = Configuration.Settings.Tools.WhisperDeleteTempFiles;
|
||||
@ -467,6 +466,20 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
|
||||
private void comboBoxLanguages_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxLanguages.SelectedIndex > 0 && comboBoxLanguages.Text == LanguageSettings.Current.General.ChangeLanguageFilter)
|
||||
{
|
||||
using (var form = new DefaultLanguagesChooser(Configuration.Settings.General.DefaultLanguages))
|
||||
{
|
||||
if (form.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
Configuration.Settings.General.DefaultLanguages = form.DefaultLanguages;
|
||||
}
|
||||
}
|
||||
|
||||
WhisperAudioToText.InitializeLanguageNames(comboBoxLanguages);
|
||||
return;
|
||||
}
|
||||
|
||||
checkBoxTranslateToEnglish.Enabled = comboBoxLanguages.Text.ToLowerInvariant() != "english";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user