mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Make copy-paste-translate support files too - thx
cyzs233 :)
This commit is contained in:
parent
f0ae471a79
commit
eb614151fc
@ -6,6 +6,7 @@
|
||||
* More options for "Modify selection"
|
||||
* CLI change output-file-name - thx BenJamesAndo
|
||||
* Add Polish speech recognition vosk/kaldi model
|
||||
* Add Netflix Chinese profile - thx Kester
|
||||
* IMPROVED:
|
||||
* Update Polish translation - thx admas
|
||||
* Update Bulgarian translation - thx Калин
|
||||
@ -20,6 +21,7 @@
|
||||
* Minor improvements for compare
|
||||
* Improve searching for start time in mkv - thx cyzs233/signedout
|
||||
* Improve top alignment capture for bdsup - thx tormento
|
||||
* Improve dcinema 2010 - thx stephw999
|
||||
* FIXED:
|
||||
* Fix crash in "Remove text for HI" - thx loicvan
|
||||
* Fix crash in "Fix music notation" - thx ReallyInventiveUserName
|
||||
|
@ -373,6 +373,7 @@ namespace Nikse.SubtitleEdit.Forms.ShotChanges
|
||||
//
|
||||
// videoPlayerContainer1
|
||||
//
|
||||
this.videoPlayerContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.videoPlayerContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
|
||||
this.videoPlayerContainer1.Chapters = ((System.Collections.Generic.List<Nikse.SubtitleEdit.Core.ContainerFormats.Matroska.MatroskaChapter>)(resources.GetObject("videoPlayerContainer1.Chapters")));
|
||||
this.videoPlayerContainer1.CurrentPosition = 0D;
|
||||
|
151
src/ui/Forms/ShotChanges/AdjustTimingViaShotChanges.resx
Normal file
151
src/ui/Forms/ShotChanges/AdjustTimingViaShotChanges.resx
Normal file
@ -0,0 +1,151 @@
|
||||
<?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>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="audioVisualizer.Chapters" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAIwBbGlic2UsIFZlcnNpb249My42LjYuNTYsIEN1bHR1cmU9bmV1
|
||||
dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0
|
||||
dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkMAwAAAD1saWJzZSwgVmVy
|
||||
c2lvbj0zLjYuNi41NiwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBQEAAABkU3lz
|
||||
dGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tOaWtzZS5TdWJ0aXRsZUVkaXQuQ29yZS5Db250
|
||||
YWluZXJGb3JtYXRzLk1hdHJvc2thLk1hdHJvc2thQ2hhcHRlcgMAAAAGX2l0ZW1zBV9zaXplCF92ZXJz
|
||||
aW9uBAAAQ05pa3NlLlN1YnRpdGxlRWRpdC5Db3JlLkNvbnRhaW5lckZvcm1hdHMuTWF0cm9za2EuTWF0
|
||||
cm9za2FDaGFwdGVyW10DAAAACAgCAAAACQQAAAAAAAAAAAAAAAcEAAAAAAEAAAAAAAAABEFOaWtzZS5T
|
||||
dWJ0aXRsZUVkaXQuQ29yZS5Db250YWluZXJGb3JtYXRzLk1hdHJvc2thLk1hdHJvc2thQ2hhcHRlcgMA
|
||||
AAAL
|
||||
</value>
|
||||
</data>
|
||||
<data name="videoPlayerContainer1.Chapters" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAIwBbGlic2UsIFZlcnNpb249My42LjYuNTYsIEN1bHR1cmU9bmV1
|
||||
dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0
|
||||
dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkMAwAAAD1saWJzZSwgVmVy
|
||||
c2lvbj0zLjYuNi41NiwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBQEAAABkU3lz
|
||||
dGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tOaWtzZS5TdWJ0aXRsZUVkaXQuQ29yZS5Db250
|
||||
YWluZXJGb3JtYXRzLk1hdHJvc2thLk1hdHJvc2thQ2hhcHRlcgMAAAAGX2l0ZW1zBV9zaXplCF92ZXJz
|
||||
aW9uBAAAQ05pa3NlLlN1YnRpdGxlRWRpdC5Db3JlLkNvbnRhaW5lckZvcm1hdHMuTWF0cm9za2EuTWF0
|
||||
cm9za2FDaGFwdGVyW10DAAAACAgCAAAACQQAAAAAAAAAAAAAAAcEAAAAAAEAAAAAAAAABEFOaWtzZS5T
|
||||
dWJ0aXRsZUVkaXQuQ29yZS5Db250YWluZXJGb3JtYXRzLk1hdHJvc2thLk1hdHJvc2thQ2hhcHRlcgMA
|
||||
AAAL
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
34
src/ui/Forms/Translate/TranslateBlock.Designer.cs
generated
34
src/ui/Forms/Translate/TranslateBlock.Designer.cs
generated
@ -1,7 +1,7 @@
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
{
|
||||
partial class TranslateBlock
|
||||
sealed partial class TranslateBlock
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -33,6 +33,8 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonGetTargetGet = new System.Windows.Forms.Button();
|
||||
this.buttonCopySourceTextToClipboard = new System.Windows.Forms.Button();
|
||||
this.buttonExport = new System.Windows.Forms.Button();
|
||||
this.buttonImport = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelInfo
|
||||
@ -51,7 +53,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
this.buttonCancel.Location = new System.Drawing.Point(452, 165);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 2;
|
||||
this.buttonCancel.TabIndex = 4;
|
||||
this.buttonCancel.Text = "Cancel";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||
@ -73,16 +75,40 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
this.buttonCopySourceTextToClipboard.Location = new System.Drawing.Point(211, 165);
|
||||
this.buttonCopySourceTextToClipboard.Name = "buttonCopySourceTextToClipboard";
|
||||
this.buttonCopySourceTextToClipboard.Size = new System.Drawing.Size(235, 23);
|
||||
this.buttonCopySourceTextToClipboard.TabIndex = 1;
|
||||
this.buttonCopySourceTextToClipboard.TabIndex = 3;
|
||||
this.buttonCopySourceTextToClipboard.Text = "Copy source text clipboard again";
|
||||
this.buttonCopySourceTextToClipboard.UseVisualStyleBackColor = true;
|
||||
this.buttonCopySourceTextToClipboard.Click += new System.EventHandler(this.buttonCopySourceTextToClipboard_Click);
|
||||
//
|
||||
// buttonExport
|
||||
//
|
||||
this.buttonExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonExport.Location = new System.Drawing.Point(12, 165);
|
||||
this.buttonExport.Name = "buttonExport";
|
||||
this.buttonExport.Size = new System.Drawing.Size(193, 23);
|
||||
this.buttonExport.TabIndex = 2;
|
||||
this.buttonExport.Text = "Save to file...";
|
||||
this.buttonExport.UseVisualStyleBackColor = true;
|
||||
this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click);
|
||||
//
|
||||
// buttonImport
|
||||
//
|
||||
this.buttonImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonImport.Location = new System.Drawing.Point(418, 99);
|
||||
this.buttonImport.Name = "buttonImport";
|
||||
this.buttonImport.Size = new System.Drawing.Size(28, 23);
|
||||
this.buttonImport.TabIndex = 1;
|
||||
this.buttonImport.Text = "...";
|
||||
this.buttonImport.UseVisualStyleBackColor = true;
|
||||
this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click);
|
||||
//
|
||||
// TranslateBlock
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(539, 200);
|
||||
this.Controls.Add(this.buttonImport);
|
||||
this.Controls.Add(this.buttonExport);
|
||||
this.Controls.Add(this.labelInfo);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonGetTargetGet);
|
||||
@ -107,5 +133,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
private System.Windows.Forms.Button buttonCancel;
|
||||
private System.Windows.Forms.Button buttonGetTargetGet;
|
||||
private System.Windows.Forms.Button buttonCopySourceTextToClipboard;
|
||||
private System.Windows.Forms.Button buttonExport;
|
||||
private System.Windows.Forms.Button buttonImport;
|
||||
}
|
||||
}
|
@ -2,13 +2,15 @@
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
{
|
||||
public partial class TranslateBlock : Form
|
||||
public sealed partial class TranslateBlock : Form
|
||||
{
|
||||
private CopyPasteBlock _sourceBlock;
|
||||
private readonly CopyPasteBlock _sourceBlock;
|
||||
public string TargetText { get; set; }
|
||||
|
||||
public TranslateBlock(CopyPasteBlock source, string title, bool autoCopy)
|
||||
@ -20,6 +22,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
labelInfo.Text = LanguageSettings.Current.GoogleTranslate.TranslateBlockInfo;
|
||||
buttonGetTargetGet.Text = LanguageSettings.Current.GoogleTranslate.TranslateBlockGetFromClipboard;
|
||||
buttonCopySourceTextToClipboard.Text = LanguageSettings.Current.GoogleTranslate.TranslateBlockCopySourceText;
|
||||
buttonExport.Text = LanguageSettings.Current.Main.Menu.File.SaveAs;
|
||||
|
||||
_sourceBlock = source;
|
||||
Text = title;
|
||||
@ -74,5 +77,51 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
buttonGetTargetGet_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonExport_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var saveFileDialog = new SaveFileDialog
|
||||
{
|
||||
Title = LanguageSettings.Current.General.OpenSubtitle,
|
||||
FileName = "translate.txt",
|
||||
Filter = "Text|*.txt",
|
||||
})
|
||||
{
|
||||
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
File.WriteAllText(saveFileDialog.FileName, _sourceBlock.TargetText);
|
||||
UiUtil.OpenFolderFromFileName(saveFileDialog.FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var openFileDialog1 = new OpenFileDialog())
|
||||
{
|
||||
openFileDialog1.Title = LanguageSettings.Current.General.OpenSubtitle;
|
||||
openFileDialog1.FileName = string.Empty;
|
||||
openFileDialog1.Filter = "Text files|*.txt";
|
||||
openFileDialog1.FileName = string.Empty;
|
||||
var result = openFileDialog1.ShowDialog(this);
|
||||
if (result != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var encoding = LanguageAutoDetect.GetEncodingFromFile(openFileDialog1.FileName);
|
||||
var text = FileUtil.ReadAllTextShared(openFileDialog1.FileName, encoding).Trim();
|
||||
if (text == _sourceBlock.TargetText.Trim())
|
||||
{
|
||||
MessageBox.Show(LanguageSettings.Current.GoogleTranslate.TranslateBlockClipboardError1 + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
LanguageSettings.Current.GoogleTranslate.TranslateBlockClipboardError2);
|
||||
return;
|
||||
}
|
||||
TargetText = text;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1536,6 +1536,9 @@
|
||||
<EmbeddedResource Include="Forms\SeJobs\SeJobExport.resx">
|
||||
<DependentUpon>SeJobExport.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ShotChanges\AdjustTimingViaShotChanges.resx">
|
||||
<DependentUpon>AdjustTimingViaShotChanges.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\TimedTextPropertiesItunes.resx">
|
||||
<DependentUpon>TimedTextPropertiesItunes.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
Loading…
Reference in New Issue
Block a user