mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-24 04:02:36 +01:00
Remember iTunes TTML language code (or auto-detect) - thx Andreas :)
This commit is contained in:
parent
c46f838723
commit
034e9bfb6f
@ -77,6 +77,7 @@ namespace Nikse.SubtitleEdit.Core.Settings
|
|||||||
public string TimedTextItunesBottomExtent { get; set; }
|
public string TimedTextItunesBottomExtent { get; set; }
|
||||||
public string TimedTextItunesTimeCodeFormat { get; set; }
|
public string TimedTextItunesTimeCodeFormat { get; set; }
|
||||||
public string TimedTextItunesStyleAttribute { get; set; }
|
public string TimedTextItunesStyleAttribute { get; set; }
|
||||||
|
public string TimedTextItunesLanguage { get; set; }
|
||||||
public string TimedTextImsc11TimeCodeFormat { get; set; }
|
public string TimedTextImsc11TimeCodeFormat { get; set; }
|
||||||
public string TimedTextImsc11FileExtension { get; set; }
|
public string TimedTextImsc11FileExtension { get; set; }
|
||||||
|
|
||||||
|
@ -108,7 +108,12 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
|||||||
dropMode = "dropNTSC";
|
dropMode = "dropNTSC";
|
||||||
}
|
}
|
||||||
|
|
||||||
const string language = "en-US";
|
var language = LanguageAutoDetect.AutoDetectGoogleLanguage(subtitle);
|
||||||
|
if (!string.IsNullOrEmpty(Configuration.Settings.SubtitleSettings.TimedTextItunesLanguage))
|
||||||
|
{
|
||||||
|
language = Configuration.Settings.SubtitleSettings.TimedTextItunesLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
var xmlStructure = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + Environment.NewLine +
|
var xmlStructure = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + Environment.NewLine +
|
||||||
"<tt xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.w3.org/ns/ttml\" xmlns:tt=\"http://www.w3.org/ns/ttml\" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\" xmlns:ttp=\"http://www.w3.org/ns/ttml#parameter\" xml:lang=\"" + language + "\" ttp:timeBase=\"smpte\" ttp:frameRate=\"" + frameRate + "\" ttp:frameRateMultiplier=\"" + frameRateMultiplier + "\" ttp:dropMode=\"" + dropMode + "\">" + Environment.NewLine +
|
"<tt xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.w3.org/ns/ttml\" xmlns:tt=\"http://www.w3.org/ns/ttml\" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\" xmlns:ttp=\"http://www.w3.org/ns/ttml#parameter\" xml:lang=\"" + language + "\" ttp:timeBase=\"smpte\" ttp:frameRate=\"" + frameRate + "\" ttp:frameRateMultiplier=\"" + frameRateMultiplier + "\" ttp:dropMode=\"" + dropMode + "\">" + Environment.NewLine +
|
||||||
" <head>" + Environment.NewLine +
|
" <head>" + Environment.NewLine +
|
||||||
|
@ -66,6 +66,11 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
comboBoxLanguage.Text = attr.InnerText;
|
comboBoxLanguage.Text = attr.InnerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(Configuration.Settings.SubtitleSettings.TimedTextItunesLanguage))
|
||||||
|
{
|
||||||
|
comboBoxLanguage.Text = Configuration.Settings.SubtitleSettings.TimedTextItunesLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
attr = _xml.DocumentElement.Attributes["ttp:timeBase"];
|
attr = _xml.DocumentElement.Attributes["ttp:timeBase"];
|
||||||
if (attr != null)
|
if (attr != null)
|
||||||
{
|
{
|
||||||
@ -322,6 +327,8 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
_subtitle.Header = _xml.OuterXml;
|
_subtitle.Header = _xml.OuterXml;
|
||||||
|
|
||||||
|
Configuration.Settings.SubtitleSettings.TimedTextItunesLanguage = comboBoxLanguage.Text;
|
||||||
|
|
||||||
Configuration.Settings.SubtitleSettings.TimedTextItunesTimeCodeFormat = comboBoxTimeCodeFormat.SelectedItem.ToString();
|
Configuration.Settings.SubtitleSettings.TimedTextItunesTimeCodeFormat = comboBoxTimeCodeFormat.SelectedItem.ToString();
|
||||||
Configuration.Settings.SubtitleSettings.TimedText10FileExtension = comboBoxFileExtensions.SelectedItem.ToString();
|
Configuration.Settings.SubtitleSettings.TimedText10FileExtension = comboBoxFileExtensions.SelectedItem.ToString();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user