Work on language filter

This commit is contained in:
niksedk 2023-09-22 12:18:29 +02:00
parent 3299f8c52d
commit 2de070dec5
17 changed files with 13096 additions and 12511 deletions

View File

@ -103,6 +103,7 @@
<Error>Error</Error>
<Warning>Warning</Warning>
<UseLargerFontForThisWindow>Use larger font for this window</UseLargerFontForThisWindow>
<ChangeLanguageFilter>Change language filter...</ChangeLanguageFilter>
</General>
<About>
<Title>About Subtitle Edit</Title>
@ -2317,6 +2318,7 @@ can edit in same subtitle file (collaboration)</Information>
<DefaultFrameRate>Default frame rate</DefaultFrameRate>
<DefaultFileEncoding>Default file encoding</DefaultFileEncoding>
<AutoDetectAnsiEncoding>Auto detect ANSI encoding</AutoDetectAnsiEncoding>
<LanguageFilter>Language filter</LanguageFilter>
<Profile>Profile</Profile>
<Profiles>Profiles</Profiles>
<ImportProfiles>Import profiles</ImportProfiles>

File diff suppressed because it is too large Load Diff

View File

@ -845,17 +845,23 @@ namespace Nikse.SubtitleEdit.Core.Common
return list;
}
public static IEnumerable<CultureInfo> GetSubtitleLanguageCultures()
public static IEnumerable<CultureInfo> GetSubtitleLanguageCultures(bool useFilter)
{
var prospects = new List<CultureInfo>();
var excludes = new HashSet<string>();
var languages = Configuration.Settings.General.DefaultLanguages ?? string.Empty;
var languageList = useFilter ? languages.Split(new []{ ';' }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty<string>();
foreach (var ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
{
if (ci.Name.Length < 4 && ci.Name == ci.IetfLanguageTag)
{
excludes.Add(ci.Parent.Name);
prospects.Add(ci);
if (languageList.Length == 0 || languageList.Contains(ci.TwoLetterISOLanguageName))
{
excludes.Add(ci.Parent.Name);
prospects.Add(ci);
}
}
}

View File

@ -208,6 +208,7 @@ namespace Nikse.SubtitleEdit.Forms
this.comboBoxLanguage.SelectedText = "";
this.comboBoxLanguage.Size = new System.Drawing.Size(196, 21);
this.comboBoxLanguage.TabIndex = 0;
this.comboBoxLanguage.UsePopupWindow = false;
this.comboBoxLanguage.SelectedIndexChanged += new System.EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
this.comboBoxLanguage.Enter += new System.EventHandler(this.comboBoxLanguage_Enter);
//
@ -772,20 +773,14 @@ namespace Nikse.SubtitleEdit.Forms
this.textBoxListViewText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxListViewText.BackColor = System.Drawing.SystemColors.WindowFrame;
this.textBoxListViewText.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.textBoxListViewText.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBoxListViewText.HideSelection = false;
this.textBoxListViewText.Location = new System.Drawing.Point(194, 12);
this.textBoxListViewText.MaxLength = 32767;
this.textBoxListViewText.Multiline = true;
this.textBoxListViewText.Name = "textBoxListViewText";
this.textBoxListViewText.Padding = new System.Windows.Forms.Padding(1);
this.textBoxListViewText.ScrollBars = ScrollBars.None;
this.textBoxListViewText.SelectedText = "";
this.textBoxListViewText.SelectionLength = 0;
this.textBoxListViewText.SelectionStart = 0;
this.textBoxListViewText.Size = new System.Drawing.Size(427, 64);
this.textBoxListViewText.TabIndex = 118;
this.textBoxListViewText.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBoxListViewText.UseSystemPasswordChar = false;
this.textBoxListViewText.TextChanged += new System.EventHandler(this.TextBoxListViewTextTextChanged);
this.textBoxListViewText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextKeyDown);
//
@ -804,6 +799,7 @@ namespace Nikse.SubtitleEdit.Forms
this.textBoxFixedIssues.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.textBoxFixedIssues.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.textBoxFixedIssues.Location = new System.Drawing.Point(3, 3);
this.textBoxFixedIssues.MaxLength = 65767;
this.textBoxFixedIssues.Multiline = true;
@ -836,8 +832,8 @@ namespace Nikse.SubtitleEdit.Forms
this.Controls.Add(this.buttonBack);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonNextFinish);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBoxStep1);
this.Controls.Add(this.groupBox2);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.KeyPreview = true;
this.MinimizeBox = false;

View File

@ -4,6 +4,7 @@ using Nikse.SubtitleEdit.Core.Enums;
using Nikse.SubtitleEdit.Core.Forms.FixCommonErrors;
using Nikse.SubtitleEdit.Core.Interfaces;
using Nikse.SubtitleEdit.Core.SubtitleFormats;
using Nikse.SubtitleEdit.Forms.Options;
using Nikse.SubtitleEdit.Logic;
using Nikse.SubtitleEdit.Logic.Ocr;
using Nikse.SubtitleEdit.Logic.SpellCheck;
@ -145,12 +146,20 @@ namespace Nikse.SubtitleEdit.Forms
{
comboBoxLanguage.Items.Add(firstItem);
}
foreach (var ci in Utilities.GetSubtitleLanguageCultures())
foreach (var ci in Utilities.GetSubtitleLanguageCultures(true))
{
comboBoxLanguage.Items.Add(new LanguageItem(ci, ci.EnglishName));
}
comboBoxLanguage.Sorted = true;
comboBoxLanguage.EndUpdate();
comboBoxLanguage.Sorted = false;
comboBoxLanguage.Items.Add(LanguageSettings.Current.General.ChangeLanguageFilter);
if (comboBoxLanguage.SelectedIndex < 0 && comboBoxLanguage.Items.Count > 0)
{
comboBoxLanguage.SelectedIndex = 0;
}
}
public void RunBatchSettings(Subtitle subtitle, SubtitleFormat format, TextEncoding encoding, string language)
@ -1841,6 +1850,20 @@ namespace Nikse.SubtitleEdit.Forms
private void comboBoxLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBoxLanguage.SelectedIndex > 0 && comboBoxLanguage.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;
}
}
InitializeLanguageNames();
return;
}
if (Subtitle != null)
{
if (comboBoxLanguage.SelectedItem is LanguageItem ci)

View File

@ -2,6 +2,7 @@
using Nikse.SubtitleEdit.Core.Enums;
using Nikse.SubtitleEdit.Core.NetflixQualityCheck;
using Nikse.SubtitleEdit.Core.SubtitleFormats;
using Nikse.SubtitleEdit.Forms.Options;
using Nikse.SubtitleEdit.Logic;
using System;
using System.Collections.Generic;
@ -23,6 +24,7 @@ namespace Nikse.SubtitleEdit.Forms
private readonly string _videoFileName;
private readonly double _frameRate;
private bool _loading;
private string _language;
private NetflixQualityController _netflixQualityController;
public NetflixFixErrors(Subtitle subtitle, SubtitleFormat subtitleFormat, string subtitleFileName, string videoFileName, double frameRate)
@ -51,9 +53,10 @@ namespace Nikse.SubtitleEdit.Forms
buttonFixesInverse.Text = LanguageSettings.Current.FixCommonErrors.InverseSelection;
buttonOK.Text = LanguageSettings.Current.General.Ok;
_loading = true;
var language = LanguageAutoDetect.AutoDetectGoogleLanguage(_subtitle);
InitializeLanguages(language);
RefreshCheckBoxes(language);
_language = LanguageAutoDetect.AutoDetectGoogleLanguage(_subtitle);
comboBoxLanguage.SelectedIndexChanged += RuleCheckedChanged;
InitializeLanguages(_language);
RefreshCheckBoxes(_language);
_loading = false;
RuleCheckedChanged(null, null);
UiUtil.FixLargeFonts(this, buttonOK);
@ -108,9 +111,11 @@ namespace Nikse.SubtitleEdit.Forms
private void InitializeLanguages(string language)
{
comboBoxLanguage.SelectedIndexChanged -= RuleCheckedChanged;
comboBoxLanguage.BeginUpdate();
comboBoxLanguage.Items.Clear();
foreach (var ci in Utilities.GetSubtitleLanguageCultures())
foreach (var ci in Utilities.GetSubtitleLanguageCultures(true))
{
comboBoxLanguage.Items.Add(new LanguageItem(ci, ci.EnglishName));
}
@ -131,8 +136,18 @@ namespace Nikse.SubtitleEdit.Forms
}
}
comboBoxLanguage.SelectedIndex = languageIndex;
comboBoxLanguage.SelectedIndexChanged += RuleCheckedChanged;
comboBoxLanguage.EndUpdate();
comboBoxLanguage.Sorted = false;
comboBoxLanguage.Items.Add(LanguageSettings.Current.General.ChangeLanguageFilter);
if (comboBoxLanguage.SelectedIndex < 0 && comboBoxLanguage.Items.Count > 0)
{
comboBoxLanguage.SelectedIndex = 0;
}
comboBoxLanguage.SelectedIndexChanged += RuleCheckedChanged;
}
private async void RuleCheckedChanged(object sender, EventArgs e)
@ -287,7 +302,20 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
_loading = true;
if (comboBoxLanguage.SelectedIndex > 0 && comboBoxLanguage.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;
}
}
InitializeLanguages(_language);
return;
}
var languageItem = (LanguageItem)comboBoxLanguage.Items[comboBoxLanguage.SelectedIndex];
RefreshCheckBoxes(languageItem.Code.TwoLetterISOLanguageName);
_loading = false;

View File

@ -0,0 +1,158 @@
namespace Nikse.SubtitleEdit.Forms.Options
{
sealed partial class DefaultLanguagesChooser
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonShortcutsClear = new System.Windows.Forms.Button();
this.labelShortcutsSearch = new System.Windows.Forms.Label();
this.labelDefaultLanguagesList = new System.Windows.Forms.Label();
this.textBoxShortcutSearch = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.SuspendLayout();
//
// listView1
//
this.listView1.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.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.listView1.FullRowSelect = true;
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(12, 52);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(398, 471);
this.listView1.TabIndex = 20;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView1_ItemChecked);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(335, 538);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 51;
this.buttonCancel.Text = "C&ancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(254, 538);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 50;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonShortcutsClear
//
this.buttonShortcutsClear.Enabled = false;
this.buttonShortcutsClear.Location = new System.Drawing.Point(215, 17);
this.buttonShortcutsClear.Name = "buttonShortcutsClear";
this.buttonShortcutsClear.Size = new System.Drawing.Size(111, 23);
this.buttonShortcutsClear.TabIndex = 10;
this.buttonShortcutsClear.Text = "Clear";
this.buttonShortcutsClear.UseVisualStyleBackColor = true;
this.buttonShortcutsClear.Click += new System.EventHandler(this.buttonShortcutsClear_Click);
//
// labelShortcutsSearch
//
this.labelShortcutsSearch.AutoSize = true;
this.labelShortcutsSearch.Location = new System.Drawing.Point(12, 21);
this.labelShortcutsSearch.Name = "labelShortcutsSearch";
this.labelShortcutsSearch.Size = new System.Drawing.Size(41, 13);
this.labelShortcutsSearch.TabIndex = 40;
this.labelShortcutsSearch.Text = "Search";
//
// labelDefaultLanguagesList
//
this.labelDefaultLanguagesList.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelDefaultLanguagesList.AutoSize = true;
this.labelDefaultLanguagesList.Location = new System.Drawing.Point(12, 538);
this.labelDefaultLanguagesList.Name = "labelDefaultLanguagesList";
this.labelDefaultLanguagesList.Size = new System.Drawing.Size(18, 13);
this.labelDefaultLanguagesList.TabIndex = 42;
this.labelDefaultLanguagesList.Text = "All";
//
// textBoxShortcutSearch
//
this.textBoxShortcutSearch.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.textBoxShortcutSearch.Location = new System.Drawing.Point(59, 17);
this.textBoxShortcutSearch.Name = "textBoxShortcutSearch";
this.textBoxShortcutSearch.Size = new System.Drawing.Size(149, 20);
this.textBoxShortcutSearch.TabIndex = 1;
this.textBoxShortcutSearch.TextChanged += new System.EventHandler(this.textBoxShortcutSearch_TextChanged);
//
// DefaultLanguagesChooser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(422, 573);
this.Controls.Add(this.labelDefaultLanguagesList);
this.Controls.Add(this.textBoxShortcutSearch);
this.Controls.Add(this.buttonShortcutsClear);
this.Controls.Add(this.labelShortcutsSearch);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.listView1);
this.KeyPreview = true;
this.MinimumSize = new System.Drawing.Size(438, 612);
this.Name = "DefaultLanguagesChooser";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "DefaultLanguagesChooser";
this.Shown += new System.EventHandler(this.DefaultLanguagesChooser_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DefaultLanguagesChooser_KeyDown);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.Button buttonShortcutsClear;
private System.Windows.Forms.Label labelShortcutsSearch;
private Controls.NikseTextBox textBoxShortcutSearch;
private System.Windows.Forms.Label labelDefaultLanguagesList;
}
}

View File

@ -0,0 +1,140 @@
using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Logic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Nikse.SubtitleEdit.Forms.Options
{
public sealed partial class DefaultLanguagesChooser : Form
{
public string DefaultLanguages { get; set; }
private readonly List<FormRemoveTextForHearImpaired.LanguageItem> _languageItems;
public DefaultLanguagesChooser(string defaultLanguages)
{
UiUtil.PreInitialize(this);
InitializeComponent();
UiUtil.FixFonts(this);
Text = LanguageSettings.Current.General.ChangeLanguageFilter.TrimEnd('.');
buttonOK.Text = LanguageSettings.Current.General.Ok;
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
DefaultLanguages = string.Empty;
listView1.CheckBoxes = true;
listView1.BeginUpdate();
listView1.Items.Clear();
var languages = defaultLanguages == null ? Array.Empty<string>() : defaultLanguages.Split(';');
_languageItems = new List<FormRemoveTextForHearImpaired.LanguageItem>();
foreach (var ci in Utilities.GetSubtitleLanguageCultures(false).OrderBy(p => p.EnglishName))
{
var x = new FormRemoveTextForHearImpaired.LanguageItem(ci, ci.EnglishName);
_languageItems.Add(x);
var listViewItem = new ListViewItem(x.ToString())
{
Tag = x,
Checked = languages.Contains(ci.TwoLetterISOLanguageName),
};
listView1.Items.Add(listViewItem);
}
listView1.HeaderStyle = ColumnHeaderStyle.None;
listView1.EndUpdate();
listView1.AutoSizeLastColumn();
InitLanguageList();
}
private void buttonOK_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
private void DefaultLanguagesChooser_Shown(object sender, EventArgs e)
{
BringToFront();
Activate();
}
private void buttonShortcutsClear_Click(object sender, EventArgs e)
{
textBoxShortcutSearch.Text = string.Empty;
}
private void textBoxShortcutSearch_TextChanged(object sender, EventArgs e)
{
buttonShortcutsClear.Enabled = textBoxShortcutSearch.Text.Length > 0;
listView1.BeginUpdate();
listView1.Items.Clear();
foreach (var x in _languageItems)
{
if (x.Name.Contains(textBoxShortcutSearch.Text) ||
x.Code.TwoLetterISOLanguageName == textBoxShortcutSearch.Text ||
x.Code.ThreeLetterISOLanguageName == textBoxShortcutSearch.Text)
{
var listViewItem = new ListViewItem(x.ToString())
{
Tag = x,
Checked = DefaultLanguages.Contains(x.Code.TwoLetterISOLanguageName),
};
listView1.Items.Add(listViewItem);
}
}
listView1.HeaderStyle = ColumnHeaderStyle.None;
listView1.EndUpdate();
}
private void listView1_ItemChecked(object sender, ItemCheckedEventArgs e)
{
if (e.Item.Checked)
{
if (e.Item.Tag is FormRemoveTextForHearImpaired.LanguageItem li)
{
DefaultLanguages = DefaultLanguages.TrimEnd(';') + ";" + li.Code.TwoLetterISOLanguageName;
}
}
else
{
if (e.Item.Tag is FormRemoveTextForHearImpaired.LanguageItem li)
{
DefaultLanguages = DefaultLanguages.Replace(";" + li.Code.TwoLetterISOLanguageName, string.Empty);
DefaultLanguages = DefaultLanguages.Replace(li.Code.TwoLetterISOLanguageName, string.Empty);
DefaultLanguages = DefaultLanguages.Replace(";;", ";").Trim(';');
}
}
InitLanguageList();
}
private void InitLanguageList()
{
if (string.IsNullOrEmpty(DefaultLanguages))
{
labelDefaultLanguagesList.Text = LanguageSettings.Current.General.All;
return;
}
var arr = DefaultLanguages.Split(';');
if (DefaultLanguages.Length > 30)
{
labelDefaultLanguagesList.Text = arr.Length.ToString();
return;
}
labelDefaultLanguagesList.Text = string.Join(", ", arr);
}
private void DefaultLanguagesChooser_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
DialogResult = DialogResult.Cancel;
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -34,6 +34,9 @@
this.listBoxSection = new Nikse.SubtitleEdit.Controls.NikseListBox();
this.panelGeneral = new System.Windows.Forms.Panel();
this.groupBoxMiscellaneous = new System.Windows.Forms.GroupBox();
this.labelDefaultLanguagesList = new System.Windows.Forms.Label();
this.buttonDefaultLanguages = new System.Windows.Forms.Button();
this.labelDefaultLanguages = new System.Windows.Forms.Label();
this.buttonTranslationAutoSuffix = new System.Windows.Forms.Button();
this.comboBoxTranslationAutoSuffix = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.labelTranslationAutoSuffix = new System.Windows.Forms.Label();
@ -584,6 +587,9 @@
this.groupBoxMiscellaneous.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.groupBoxMiscellaneous.Controls.Add(this.labelDefaultLanguagesList);
this.groupBoxMiscellaneous.Controls.Add(this.buttonDefaultLanguages);
this.groupBoxMiscellaneous.Controls.Add(this.labelDefaultLanguages);
this.groupBoxMiscellaneous.Controls.Add(this.buttonTranslationAutoSuffix);
this.groupBoxMiscellaneous.Controls.Add(this.comboBoxTranslationAutoSuffix);
this.groupBoxMiscellaneous.Controls.Add(this.labelTranslationAutoSuffix);
@ -628,6 +634,34 @@
this.groupBoxMiscellaneous.TabStop = false;
this.groupBoxMiscellaneous.Text = "Miscellaneous";
//
// labelDefaultLanguagesList
//
this.labelDefaultLanguagesList.AutoSize = true;
this.labelDefaultLanguagesList.Location = new System.Drawing.Point(241, 495);
this.labelDefaultLanguagesList.Name = "labelDefaultLanguagesList";
this.labelDefaultLanguagesList.Size = new System.Drawing.Size(38, 13);
this.labelDefaultLanguagesList.TabIndex = 67;
this.labelDefaultLanguagesList.Text = "da, en";
//
// buttonDefaultLanguages
//
this.buttonDefaultLanguages.Location = new System.Drawing.Point(205, 489);
this.buttonDefaultLanguages.Name = "buttonDefaultLanguages";
this.buttonDefaultLanguages.Size = new System.Drawing.Size(28, 23);
this.buttonDefaultLanguages.TabIndex = 66;
this.buttonDefaultLanguages.Text = "...";
this.buttonDefaultLanguages.UseVisualStyleBackColor = true;
this.buttonDefaultLanguages.Click += new System.EventHandler(this.buttonDefaultLanguages_Click);
//
// labelDefaultLanguages
//
this.labelDefaultLanguages.AutoSize = true;
this.labelDefaultLanguages.Location = new System.Drawing.Point(8, 491);
this.labelDefaultLanguages.Name = "labelDefaultLanguages";
this.labelDefaultLanguages.Size = new System.Drawing.Size(94, 13);
this.labelDefaultLanguages.TabIndex = 33;
this.labelDefaultLanguages.Text = "Default languages";
//
// buttonTranslationAutoSuffix
//
this.buttonTranslationAutoSuffix.Location = new System.Drawing.Point(670, 420);
@ -1732,7 +1766,7 @@
// labelDefaultFileEncoding
//
this.labelDefaultFileEncoding.AutoSize = true;
this.labelDefaultFileEncoding.Location = new System.Drawing.Point(8, 442);
this.labelDefaultFileEncoding.Location = new System.Drawing.Point(8, 441);
this.labelDefaultFileEncoding.Name = "labelDefaultFileEncoding";
this.labelDefaultFileEncoding.Size = new System.Drawing.Size(105, 13);
this.labelDefaultFileEncoding.TabIndex = 3;
@ -6565,11 +6599,11 @@
this.ClientSize = new System.Drawing.Size(1092, 574);
this.Controls.Add(this.labelUpdateFileTypeAssociationsStatus);
this.Controls.Add(this.panelGeneral);
this.Controls.Add(this.panelShortcuts);
this.Controls.Add(this.panelFont);
this.Controls.Add(this.panelSubtitleFormats);
this.Controls.Add(this.panelWaveform);
this.Controls.Add(this.panelShortcuts);
this.Controls.Add(this.panelVideoPlayer);
this.Controls.Add(this.panelFont);
this.Controls.Add(this.panelToolBar);
this.Controls.Add(this.panelTools);
this.Controls.Add(this.panelNetwork);
@ -7125,5 +7159,8 @@
private System.Windows.Forms.PictureBox pictureBoxPreview1;
private System.Windows.Forms.Label labelToolbarIconTheme;
private Nikse.SubtitleEdit.Controls.NikseComboBox comboBoxToolbarIconTheme;
private System.Windows.Forms.Button buttonDefaultLanguages;
private System.Windows.Forms.Label labelDefaultLanguages;
private System.Windows.Forms.Label labelDefaultLanguagesList;
}
}

View File

@ -43,6 +43,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
private List<PluginShortcut> _pluginShortcuts;
private readonly bool _loading;
private readonly BackgroundWorker _shortcutsBackgroundWorker;
private string _defaultLanguages;
private static IEnumerable<string> GetSubtitleFormats() => SubtitleFormat.AllSubtitleFormats.Where(format => !format.IsVobSubIndexFile).Select(format => format.FriendlyName);
@ -528,7 +529,6 @@ namespace Nikse.SubtitleEdit.Forms.Options
checkBoxTBToggleSourceView.Left = labelTBToggleSourceView.Left;
checkBoxTBToggleSourceView.TabIndex = tbTabIndex;
groupBoxMiscellaneous.Text = language.General;
groupBoxToolsMisc.Text = language.Miscellaneous;
groupBoxGeneralRules.Text = language.Rules;
@ -537,6 +537,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
labelDefaultFrameRate.Text = language.DefaultFrameRate;
labelDefaultFileEncoding.Text = language.DefaultFileEncoding;
labelAutoDetectAnsiEncoding.Text = language.AutoDetectAnsiEncoding;
labelDefaultLanguages.Text = language.LanguageFilter;
labelSubMaxLen.Text = language.SubtitleLineMaximumLength;
labelOptimalCharsPerSecond.Text = language.OptimalCharactersPerSecond;
labelMaxCharsPerSecond.Text = language.MaximumCharactersPerSecond;
@ -1275,6 +1276,9 @@ namespace Nikse.SubtitleEdit.Forms.Options
numericUpDownMpvShadowWidth.Left = numericUpDownMpvOutline.Right + 9;
labelMpvShadow.Left = numericUpDownMpvShadowWidth.Left;
_defaultLanguages = Configuration.Settings.General.DefaultLanguages ?? string.Empty;
InitLanguageList();
checkBoxDarkThemeEnabled_CheckedChanged(null, null);
ToolbarIconThemeInit();
@ -2310,6 +2314,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
gs.UseFFmpegForWaveExtraction = checkBoxUseFFmpeg.Checked;
gs.FFmpegUseCenterChannelOnly = checkBoxFfmpegUseCenterChannel.Checked;
gs.FFmpegLocation = textBoxFFmpegPath.Text;
gs.DefaultLanguages = _defaultLanguages;
gs.ToolbarIconTheme = comboBoxToolbarIconTheme.SelectedIndex > 0 ? comboBoxToolbarIconTheme.Text : "Auto";
@ -2922,17 +2927,6 @@ namespace Nikse.SubtitleEdit.Forms.Options
}
}
private void linkLabelOpenDictionaryFolder_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
string dictionaryFolder = Utilities.DictionaryFolder;
if (!Directory.Exists(dictionaryFolder))
{
Directory.CreateDirectory(dictionaryFolder);
}
UiUtil.OpenFolder(dictionaryFolder);
}
private void textBoxVlcPath_MouseLeave(object sender, EventArgs e)
{
try
@ -3872,5 +3866,35 @@ namespace Nikse.SubtitleEdit.Forms.Options
pictureBox.Image = new Bitmap(fullPath);
}
}
private void buttonDefaultLanguages_Click(object sender, EventArgs e)
{
using (var form = new DefaultLanguagesChooser(_defaultLanguages))
{
if (form.ShowDialog(this) == DialogResult.OK)
{
_defaultLanguages = form.DefaultLanguages;
InitLanguageList();
}
}
}
private void InitLanguageList()
{
if (string.IsNullOrEmpty(_defaultLanguages))
{
labelDefaultLanguagesList.Text = LanguageSettings.Current.General.All;
return;
}
var arr = _defaultLanguages.Split(';');
if (_defaultLanguages.Length > 25)
{
labelDefaultLanguagesList.Text = arr.Length.ToString();
return;
}
labelDefaultLanguagesList.Text = string.Join(", ", arr);
}
}
}

View File

@ -238,6 +238,7 @@
this.comboBoxLanguage.Size = new System.Drawing.Size(196, 21);
this.comboBoxLanguage.TabIndex = 16;
this.comboBoxLanguage.UsePopupWindow = false;
this.comboBoxLanguage.SelectedIndexChanged += new System.EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
//
// labelLanguage
//

View File

@ -1,5 +1,6 @@
using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Core.Forms;
using Nikse.SubtitleEdit.Forms.Options;
using Nikse.SubtitleEdit.Logic;
using System;
using System.Collections.Generic;
@ -30,7 +31,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
public Subtitle Subtitle;
public Subtitle Subtitle { get; set; }
public int TotalFixes { get; private set; }
private readonly LanguageStructure.RemoveTextFromHearImpaired _language;
private readonly RemoveTextForHI _removeTextForHiLib;
@ -115,7 +116,7 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxLanguage.BeginUpdate();
comboBoxLanguage.Items.Clear();
foreach (var ci in Utilities.GetSubtitleLanguageCultures())
foreach (var ci in Utilities.GetSubtitleLanguageCultures(true))
{
comboBoxLanguage.Items.Add(new LanguageItem(ci, ci.EnglishName));
if (ci.TwoLetterISOLanguageName == _interjectionsLanguage)
@ -125,8 +126,10 @@ namespace Nikse.SubtitleEdit.Forms
}
comboBoxLanguage.Sorted = true;
comboBoxLanguage.EndUpdate();
comboBoxLanguage.Sorted = false;
comboBoxLanguage.Items.Add(LanguageSettings.Current.General.ChangeLanguageFilter);
if (comboBoxLanguage.SelectedIndex < 0)
if (comboBoxLanguage.SelectedIndex < 0 && comboBoxLanguage.Items.Count > 0)
{
comboBoxLanguage.SelectedIndex = 0;
}
@ -485,5 +488,21 @@ namespace Nikse.SubtitleEdit.Forms
o.Text = text;
_edited.Add(p);
}
private void comboBoxLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBoxLanguage.SelectedIndex > 0 && comboBoxLanguage.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;
}
}
InitializeLanguageNames(Subtitle);
}
}
}
}

View File

@ -239,6 +239,7 @@ namespace Nikse.SubtitleEdit.Logic
Error = "Error",
Warning = "Warning",
UseLargerFontForThisWindow = "Use larger font for this window",
ChangeLanguageFilter = "Change language filter...",
};
About = new LanguageStructure.About
@ -2677,6 +2678,7 @@ can edit in same subtitle file (collaboration)",
DefaultFrameRate = "Default frame rate",
DefaultFileEncoding = "Default file encoding",
AutoDetectAnsiEncoding = "Auto detect ANSI encoding",
LanguageFilter ="Language filter",
Profile = "Profile",
Profiles = "Profiles",
ImportProfiles = "Import profiles",

View File

@ -364,6 +364,9 @@ namespace Nikse.SubtitleEdit.Logic
case "General/UseLargerFontForThisWindow":
language.General.UseLargerFontForThisWindow = reader.Value;
break;
case "General/ChangeLanguageFilter":
language.General.ChangeLanguageFilter = reader.Value;
break;
case "About/Title":
language.About.Title = reader.Value;
break;
@ -6238,6 +6241,9 @@ namespace Nikse.SubtitleEdit.Logic
case "Settings/AutoDetectAnsiEncoding":
language.Settings.AutoDetectAnsiEncoding = reader.Value;
break;
case "Settings/LanguageFilter":
language.Settings.LanguageFilter = reader.Value;
break;
case "Settings/Profile":
language.Settings.Profile = reader.Value;
break;

View File

@ -107,6 +107,7 @@
public string Error { get; set; }
public string Warning { get; set; }
public string UseLargerFontForThisWindow { get; set; }
public string ChangeLanguageFilter { get; set; }
}
public class About
@ -2487,6 +2488,7 @@
public string DefaultFrameRate { get; set; }
public string DefaultFileEncoding { get; set; }
public string AutoDetectAnsiEncoding { get; set; }
public string LanguageFilter { get; set; }
public string Profile { get; set; }
public string Profiles { get; set; }
public string ImportProfiles { get; set; }

View File

@ -423,6 +423,12 @@
<Compile Include="Forms\Options\ChooseIsoLanguage.Designer.cs">
<DependentUpon>ChooseIsoLanguage.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Options\DefaultLanguagesChooser.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Options\DefaultLanguagesChooser.Designer.cs">
<DependentUpon>DefaultLanguagesChooser.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Options\SettingsCustomContinuationStyle.cs">
<SubType>Form</SubType>
</Compile>
@ -1753,6 +1759,9 @@
<DependentUpon>ChooseIsoLanguage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Options\DefaultLanguagesChooser.resx">
<DependentUpon>DefaultLanguagesChooser.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Options\SettingsCustomContinuationStyle.resx">
<DependentUpon>SettingsCustomContinuationStyle.cs</DependentUpon>
</EmbeddedResource>