mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Added new subtitle format + Basque translation (thx Xabier Aramendi)
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@424 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
d082d7454a
commit
b689e4a8ee
@ -44,7 +44,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void RichTextBoxAbout1LinkClicked(object sender, LinkClickedEventArgs e)
|
||||
{
|
||||
Process.Start(e.LinkText);
|
||||
try
|
||||
{
|
||||
Process.Start(e.LinkText);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Unable to start link: " + e.LinkText, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDonate_Click(object sender, EventArgs e)
|
||||
|
1
src/Forms/Main.Designer.cs
generated
1
src/Forms/Main.Designer.cs
generated
@ -691,6 +691,7 @@
|
||||
this.toolStripComboBoxFrameRate.FlatStyle = System.Windows.Forms.FlatStyle.Standard;
|
||||
this.toolStripComboBoxFrameRate.Name = "toolStripComboBoxFrameRate";
|
||||
this.toolStripComboBoxFrameRate.Size = new System.Drawing.Size(100, 40);
|
||||
this.toolStripComboBoxFrameRate.TextChanged += new System.EventHandler(this.toolStripComboBoxFrameRate_TextChanged);
|
||||
//
|
||||
// toolStripButtonGetFrameRate
|
||||
//
|
||||
|
@ -1803,6 +1803,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_oldSubtitleFormat = null;
|
||||
labelSingleLine.Text = string.Empty;
|
||||
RemoveAlternate(true);
|
||||
toolStripComboBoxFrameRate.Text = Configuration.Settings.General.DefaultFrameRate.ToString();
|
||||
|
||||
comboBoxEncoding.Items[0] = "ANSI - " + Encoding.Default.CodePage.ToString();
|
||||
if (Configuration.Settings.General.DefaultEncoding == "ANSI")
|
||||
@ -7963,7 +7964,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else
|
||||
SubtitleListview1.Focus();
|
||||
|
||||
if (Configuration.Settings.General.Undocked)
|
||||
if (Configuration.Settings.General.Undocked && Configuration.Settings.General.StartRememberPositionAndSize)
|
||||
{
|
||||
SetPositionFromXYString(Configuration.Settings.General.UndockedVideoPosition, "VideoPlayerUnDocked");
|
||||
SetPositionFromXYString(Configuration.Settings.General.UndockedWaveformPosition, "WaveFormUnDocked");
|
||||
@ -9953,5 +9954,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripComboBoxFrameRate_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = CurrentFrameRate;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -683,46 +683,46 @@
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAegBBAHoAQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABM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BAAOyAQAD1wEAA90BAAPjAQAD6gEAA/EBAAP4AQAB8AH7
|
||||
Af8BAAGkAqABAAOAAwAB/wIAAf8DAAL/AQAB/wMAAf8BAAH/AQAC/wIAA/8RABB1MAAQdTAAEHUkAAHs
|
||||
AfQEAAHsAfQEAAR1AewFdQHsBXUkAAHsAQ8B8gMAAewBDwHyAwAEdQHsAQ8EdQHsAQ8EdSQAAewBSQEP
|
||||
AfICAAHsAUkBDwHyAgAEdQHsAUkBDwN1AewBSQEPA3UgAAHsAREBQwEVARQBcgFJAQ8BBwHrARQBcgFJ
|
||||
AQ8B8gEAAewBEQFDARUBFAFyAUkBDwEHAesBFAFyAUkBDwJ1IAAB7QEIAXgEcgFJAQ8EcgFJAQ8B8gHt
|
||||
AQgBeARyAUkBDwRyAUkBDwF1IAABkgEIA5gCeAJyAW0BmAJ4AnIBbQGSAQgDmAJ4AnIBbQGYAngCcgFt
|
||||
IAABHAHCBAgCeAHsAZkCCAJ4AewB8wEcAcIECAJ4AewBmQIIAngB7AF1IAABmAEcAZIB7QHsAQgBmAHs
|
||||
AfAB7wHsAQgBmAHsAfMBAAGYARwBkgHtAewBCAGYAewB8AHvAewBCAGYAewCdSQAAe0BCAHsAfMCAAHt
|
||||
AQgB7AHzAgAEdQHtAQgB7AN1Ae0BCAHsA3UkAAGSAewB8wMAAZIB7AHzAwAEdQGSAewEdQGSAewEdSQA
|
||||
ARwB9AQAARwB9AQABHUBHAV1ARwFdTAAEHUwABB1IAABQgFNAT4HAAE+AwABKAMAAUADAAEQAwABAQEA
|
||||
AQEFAAGAFwAD/wEAAv8GAAL/BgAC/wYAAfMBzwYAAfEBxwYAAfABwwcAAQEfAAEBBgAB8AHDBgAB8QHH
|
||||
BgAB8wHPBgAC/wYAAv8GAAs=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
|
@ -213,6 +213,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public bool ShowWaveForm { get; set; }
|
||||
public bool ShowFrameRate { get; set; }
|
||||
public double DefaultFrameRate { get; set; }
|
||||
public double CurrentFrameRate { get; set; }
|
||||
public string DefaultEncoding { get; set; }
|
||||
public bool AutoGuessAnsiEncoding { get; set; }
|
||||
public string SubtitleFontName { get; set; }
|
||||
@ -271,6 +272,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
ShowWaveForm = false;
|
||||
ShowFrameRate = false;
|
||||
DefaultFrameRate = 23.976;
|
||||
CurrentFrameRate = DefaultFrameRate;
|
||||
SubtitleFontName = "Tahoma";
|
||||
if (Environment.OSVersion.Version.Major < 6) // 6 == Vista/Win2008Server/Win7
|
||||
SubtitleFontName = Utilities.WinXp2kUnicodeFontName;
|
||||
@ -611,7 +613,10 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
settings.General.ShowWaveForm = Convert.ToBoolean(subNode.InnerText);
|
||||
subNode = node.SelectSingleNode("DefaultFrameRate");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.General.DefaultFrameRate = Convert.ToDouble(subNode.InnerText);
|
||||
settings.General.CurrentFrameRate = Convert.ToDouble(subNode.InnerText);
|
||||
}
|
||||
subNode = node.SelectSingleNode("DefaultEncoding");
|
||||
if (subNode != null)
|
||||
settings.General.DefaultEncoding = subNode.InnerText;
|
||||
|
174
src/Logic/SubtitleFormats/Captionate.cs
Normal file
174
src/Logic/SubtitleFormats/Captionate.cs
Normal file
@ -0,0 +1,174 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
class Captionate : SubtitleFormat
|
||||
{
|
||||
public override string Extension
|
||||
{
|
||||
get { return ".xml"; }
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return "Xml"; }
|
||||
}
|
||||
|
||||
public override bool HasLineNumber
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsTimeBased
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool IsMine(List<string> lines, string fileName)
|
||||
{
|
||||
Subtitle subtitle = new Subtitle();
|
||||
this.LoadSubtitle(subtitle, lines, fileName);
|
||||
return subtitle.Paragraphs.Count > 0;
|
||||
}
|
||||
|
||||
public override string ToText(Subtitle subtitle, string title)
|
||||
{
|
||||
string xmlStructure = @"<captionate>
|
||||
<timeformat>hh:mm:ss:ff/30</timeformat>
|
||||
<namesareprefixed>namesareprefixed</namesareprefixed>
|
||||
<captioninfo>
|
||||
<trackinfo>
|
||||
<track>
|
||||
<displayname>Default</displayname>
|
||||
<type/>
|
||||
<languagecode/>
|
||||
<targetwpm>140</targetwpm>
|
||||
<stringdata/>
|
||||
</track>
|
||||
</trackinfo>
|
||||
<speakerinfo>
|
||||
</speakerinfo>
|
||||
</captioninfo>
|
||||
<captions></captions></captionate>";
|
||||
|
||||
XmlDocument xml = new XmlDocument();
|
||||
xml.LoadXml(xmlStructure);
|
||||
|
||||
Paragraph last = null;
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
if (last != null)
|
||||
{
|
||||
if (last.EndTime.TotalMilliseconds + 500 < p.StartTime.TotalMilliseconds)
|
||||
{
|
||||
Paragraph blank = new Paragraph();
|
||||
blank.StartTime.TotalMilliseconds = last.EndTime.TotalMilliseconds;
|
||||
AddParagraph(xml, blank);
|
||||
}
|
||||
}
|
||||
|
||||
AddParagraph(xml, p);
|
||||
last = p;
|
||||
}
|
||||
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter writer = new XmlTextWriter(ms, Encoding.UTF8);
|
||||
writer.Formatting = Formatting.Indented;
|
||||
xml.Save(writer);
|
||||
return Encoding.UTF8.GetString(ms.ToArray()).Trim();
|
||||
}
|
||||
|
||||
private void AddParagraph(XmlDocument xml, Paragraph p)
|
||||
{
|
||||
XmlNode paragraph = xml.CreateElement("caption");
|
||||
|
||||
XmlAttribute start = xml.CreateAttribute("time");
|
||||
start.InnerText = EncodeTime(p.StartTime);
|
||||
paragraph.Attributes.Append(start);
|
||||
|
||||
if (p.Text.Trim().Length > 0)
|
||||
{
|
||||
XmlNode tracks = xml.CreateElement("tracks");
|
||||
paragraph.AppendChild(tracks);
|
||||
|
||||
XmlNode track0 = xml.CreateElement("track0");
|
||||
track0.InnerText = Utilities.RemoveHtmlTags(p.Text);
|
||||
track0.InnerXml = track0.InnerText.Replace(Environment.NewLine, "<br />");
|
||||
tracks.AppendChild(track0);
|
||||
}
|
||||
xml.DocumentElement.SelectSingleNode("captions").AppendChild(paragraph);
|
||||
}
|
||||
|
||||
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
|
||||
{
|
||||
_errorCount = 0;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
lines.ForEach(line => sb.AppendLine(line));
|
||||
|
||||
string xmlString = sb.ToString();
|
||||
if (!xmlString.Contains("<captionate>") || !xmlString.Contains("</caption>"))
|
||||
return;
|
||||
|
||||
XmlDocument xml = new XmlDocument();
|
||||
try
|
||||
{
|
||||
xml.LoadXml(xmlString);
|
||||
}
|
||||
catch
|
||||
{
|
||||
_errorCount = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
Paragraph p = null;
|
||||
foreach (XmlNode node in xml.DocumentElement.SelectNodes("captions/caption"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (node.Attributes["time"] != null)
|
||||
{
|
||||
string start = node.Attributes["time"].InnerText;
|
||||
double startMilliseconds = DecodeTimeToMilliseconds(start);
|
||||
if (p != null)
|
||||
p.EndTime.TotalMilliseconds = startMilliseconds - 1;
|
||||
if (node.SelectSingleNode("tracks/track0") != null)
|
||||
{
|
||||
string text = node.SelectSingleNode("tracks/track0").InnerText;
|
||||
text = Utilities.RemoveHtmlTags(text);
|
||||
text = text.Replace("<br>", Environment.NewLine).Replace("<br />", Environment.NewLine).Replace("<BR>", Environment.NewLine);
|
||||
p = new Paragraph(text, startMilliseconds, startMilliseconds + 3000);
|
||||
if (text.Trim().Length > 0)
|
||||
subtitle.Paragraphs.Add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||
_errorCount++;
|
||||
}
|
||||
}
|
||||
subtitle.Renumber(1);
|
||||
}
|
||||
|
||||
private double DecodeTimeToMilliseconds(string time)
|
||||
{
|
||||
string[] parts = time.Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
TimeSpan ts = new TimeSpan(0, int.Parse(parts[0]), int.Parse(parts[1]), int.Parse(parts[2]), (int)(int.Parse(parts[3]) * 10.0));
|
||||
return ts.TotalMilliseconds;
|
||||
}
|
||||
|
||||
private string EncodeTime(TimeCode time)
|
||||
{
|
||||
return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, time.Milliseconds / 10.0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
private void WriteTime(FileStream fs, TimeCode timeCode)
|
||||
{
|
||||
double totalMilliseconds = timeCode.TotalMilliseconds + TimeSpan.FromHours(10).TotalMilliseconds; // +10 hours
|
||||
int frames = (int)Math.Round(totalMilliseconds / (1000.0 /Configuration.Settings.General.DefaultFrameRate));
|
||||
int frames = (int)Math.Round(totalMilliseconds / (1000.0 /Configuration.Settings.General.CurrentFrameRate));
|
||||
fs.WriteByte((byte)(frames / 256 / 256));
|
||||
fs.WriteByte((byte)(frames / 256));
|
||||
fs.WriteByte((byte)(frames % 256));
|
||||
@ -250,8 +250,8 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
Paragraph p = new Paragraph();
|
||||
p.Text = (line1 + Environment.NewLine + line2).Trim();
|
||||
p.StartTime.TotalMilliseconds = (double)((1000.0 / Configuration.Settings.General.DefaultFrameRate) * startFrame);
|
||||
p.EndTime.TotalMilliseconds = (double)((1000.0 / Configuration.Settings.General.DefaultFrameRate) * endFrame);
|
||||
p.StartTime.TotalMilliseconds = (double)((1000.0 / Configuration.Settings.General.CurrentFrameRate) * startFrame);
|
||||
p.EndTime.TotalMilliseconds = (double)((1000.0 / Configuration.Settings.General.CurrentFrameRate) * endFrame);
|
||||
|
||||
subtitle.Paragraphs.Add(p);
|
||||
i += TextLength * 2;
|
||||
|
@ -46,7 +46,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
public override string ToText(Subtitle subtitle, string title)
|
||||
{
|
||||
if (Configuration.Settings.General.DefaultFrameRate > 26)
|
||||
if (Configuration.Settings.General.CurrentFrameRate > 26)
|
||||
FrameRate = 30;
|
||||
else
|
||||
FrameRate = 25;
|
||||
@ -469,7 +469,7 @@ string xmlTrackStructure3b =
|
||||
else
|
||||
track.InnerXml = xmlTrackStructure3b;
|
||||
|
||||
double frameRate = Configuration.Settings.General.DefaultFrameRate;
|
||||
double frameRate = Configuration.Settings.General.CurrentFrameRate;
|
||||
XmlNode start = track.SelectSingleNode("generatoritem/start");
|
||||
start.InnerText = ((int)Math.Round(p.StartTime.TotalSeconds*frameRate)).ToString();
|
||||
|
||||
@ -499,7 +499,7 @@ string xmlTrackStructure3b =
|
||||
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
|
||||
{
|
||||
_errorCount = 0;
|
||||
FrameRate = Configuration.Settings.General.DefaultFrameRate;
|
||||
FrameRate = Configuration.Settings.General.CurrentFrameRate;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
lines.ForEach(line => sb.AppendLine(line));
|
||||
@ -516,7 +516,7 @@ string xmlTrackStructure3b =
|
||||
}
|
||||
catch
|
||||
{
|
||||
FrameRate = Configuration.Settings.General.DefaultFrameRate;
|
||||
FrameRate = Configuration.Settings.General.CurrentFrameRate;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
public override string ToText(Subtitle subtitle, string title)
|
||||
{
|
||||
if (Configuration.Settings.General.DefaultFrameRate > 26)
|
||||
if (Configuration.Settings.General.CurrentFrameRate > 26)
|
||||
FrameRate = 30;
|
||||
else
|
||||
FrameRate = 25;
|
||||
@ -466,7 +466,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
XmlNode track = xml.CreateElement("track");
|
||||
track.InnerXml = xmlTrackStructure2;
|
||||
|
||||
double frameRate = Configuration.Settings.General.DefaultFrameRate;
|
||||
double frameRate = Configuration.Settings.General.CurrentFrameRate;
|
||||
XmlNode start = track.SelectSingleNode("generatoritem/start");
|
||||
start.InnerText = ((int)Math.Round(p.StartTime.TotalSeconds*frameRate)).ToString();
|
||||
|
||||
@ -496,7 +496,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
|
||||
{
|
||||
_errorCount = 0;
|
||||
FrameRate = Configuration.Settings.General.DefaultFrameRate;
|
||||
FrameRate = Configuration.Settings.General.CurrentFrameRate;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
lines.ForEach(line => sb.AppendLine(line));
|
||||
@ -513,7 +513,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
catch
|
||||
{
|
||||
FrameRate = Configuration.Settings.General.DefaultFrameRate;
|
||||
FrameRate = Configuration.Settings.General.CurrentFrameRate;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
private string EncodeTimeCode(TimeCode time)
|
||||
{
|
||||
//00:03:15:22 (last is frame)
|
||||
int frames = time.Milliseconds / (1000 / 30);
|
||||
int frames = (int) (time.Milliseconds / (1000.0 / Configuration.Settings.General.CurrentFrameRate));
|
||||
return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, frames);
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
string seconds = parts[2];
|
||||
string frames = parts[3];
|
||||
|
||||
int milliseconds = (int)((1000 / 30.0) * int.Parse(frames));
|
||||
int milliseconds = (int)((1000.0 / Configuration.Settings.General.CurrentFrameRate) * int.Parse(frames));
|
||||
if (milliseconds > 999)
|
||||
milliseconds = 999;
|
||||
|
||||
|
@ -18,6 +18,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
new AdobeEncore(),
|
||||
new AdobeEncoreTab(),
|
||||
new AdobeEncoreWithLineNumbers(),
|
||||
new Captionate(),
|
||||
new DCSubtitle(),
|
||||
new DvdStudioPro(),
|
||||
new DvdSubtitle(),
|
||||
|
@ -433,6 +433,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
s = s.Replace("</B>", string.Empty);
|
||||
s = s.Replace("<U>", string.Empty);
|
||||
s = s.Replace("</U>", string.Empty);
|
||||
s = RemoveParagraphTag(s);
|
||||
return RemoveHtmlFontTag(s);
|
||||
}
|
||||
|
||||
@ -453,6 +454,21 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return s;
|
||||
}
|
||||
|
||||
internal static string RemoveParagraphTag(string s)
|
||||
{
|
||||
s = s.Replace("</p>", string.Empty);
|
||||
s = s.Replace("</P>", string.Empty);
|
||||
s = s.Replace("<P>", string.Empty);
|
||||
s = s.Replace("<P>", string.Empty);
|
||||
while (s.ToLower().Contains("<p "))
|
||||
{
|
||||
int startIndex = s.ToLower().IndexOf("<p ");
|
||||
int endIndex = Math.Max(s.IndexOf(">"), startIndex + 4);
|
||||
s = s.Remove(startIndex, (endIndex - startIndex) + 1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
public static Encoding GetEncodingFromFile(string fileName)
|
||||
{
|
||||
Encoding encoding = Encoding.Default;
|
||||
|
1195
src/Resources/eu-ES.xml
Normal file
1195
src/Resources/eu-ES.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
src/Resources/eu-ES.xml.zip
Normal file
BIN
src/Resources/eu-ES.xml.zip
Normal file
Binary file not shown.
@ -535,6 +535,7 @@
|
||||
<Compile Include="Logic\SubtitleFormats\AdobeEncoreTabs.cs" />
|
||||
<Compile Include="Logic\SubtitleFormats\AdobeEncoreWithLineNumbers.cs" />
|
||||
<Compile Include="Logic\SubtitleFormats\BdnXml.cs" />
|
||||
<Compile Include="Logic\SubtitleFormats\Captionate.cs" />
|
||||
<Compile Include="Logic\SubtitleFormats\Cavena890.cs" />
|
||||
<Compile Include="Logic\SubtitleFormats\DCSubtitle.cs" />
|
||||
<Compile Include="Logic\SubtitleFormats\FinalCutProTextXml.cs" />
|
||||
@ -846,6 +847,7 @@
|
||||
<EmbeddedResource Include="Resources\it-IT.xml.zip" />
|
||||
<EmbeddedResource Include="Resources\hu-HU.xml.zip" />
|
||||
<EmbeddedResource Include="Resources\ja-JP.xml.zip" />
|
||||
<EmbeddedResource Include="Resources\eu-ES.xml.zip" />
|
||||
<None Include="Resources\pl-PL.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
@ -898,6 +900,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\bg-BG.xml" />
|
||||
<Content Include="Resources\eu-ES.xml" />
|
||||
<Content Include="Resources\fa-IR.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
|
Loading…
Reference in New Issue
Block a user