From 51af10a53e73d80ee19026692a50591d50941cf1 Mon Sep 17 00:00:00 2001 From: Waldi Ravens Date: Tue, 17 Feb 2015 13:31:40 +0100 Subject: [PATCH] Multi-language additions + minor refact (Forms/Main) --- LanguageMaster.xml | 11 ++++- src/Forms/Main.cs | 71 ++++++++++++++++--------------- src/Logic/Language.cs | 11 ++++- src/Logic/LanguageDeserializer.cs | 27 ++++++++++++ src/Logic/LanguageStructure.cs | 11 ++++- 5 files changed, 93 insertions(+), 38 deletions(-) diff --git a/LanguageMaster.xml b/LanguageMaster.xml index 5eb83db08..e42b68e97 100644 --- a/LanguageMaster.xml +++ b/LanguageMaster.xml @@ -65,6 +65,8 @@ Controls - {0} Advanced + Style / Language + Character Class General Line# @@ -884,6 +886,7 @@ Email: mailto:nikse.dk@gmail.com Timed Text styles... Timed Text - set language Sami - set class + Nuendo - set character Cut Copy Paste @@ -1168,7 +1171,7 @@ Continue? Before sort: {0} Sorted by: {0} Before auto balance selected lines - Number of lines auto balanced: {0} + Number of auto balanced lines: {0} Before remove line-breaks from selected lines Number of lines with removed line-break: {0} Before multiple replace @@ -1186,6 +1189,7 @@ Continue? Before merge short lines Before split long lines Number of lines merged: {0} + Before bridge small gaps Before set minimum display time between subtitles Number of lines with minimum display time between subtitles changed: {0} Before import plain text @@ -1247,6 +1251,11 @@ Continue? This file seems to be a compressed .zip file. Subtitle Edit cannot open compressed files. This file seems to be a PNG image file. Subtitle Edit cannot open PNG files. This file seems to be a ReScene .srr file - not a subtitle file. + Encrypted VobSub content is not supported. + Blu-ray sup files are not supported here. + DVD sup files are not supported here. + VobSub files are not supported here. + Divx files are not supported here. Choose subtitle from Matroska file diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 71f7a214a..8f9b3bb29 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -1303,28 +1303,29 @@ namespace Nikse.SubtitleEdit.Forms labelAdjustTip.Text = _language.VideoControls.CreateTip; //waveform - addParagraphHereToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.AddParagraphHere; - addParagraphAndPasteToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.AddParagraphHereAndPasteText; - deleteParagraphToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.DeleteParagraph; - toolStripMenuItemFocusTextbox.Text = Configuration.Settings.Language.Waveform.FocusTextBox; + var languageWaveform = Configuration.Settings.Language.Waveform; + addParagraphHereToolStripMenuItem.Text = languageWaveform.AddParagraphHere; + addParagraphAndPasteToolStripMenuItem.Text = languageWaveform.AddParagraphHereAndPasteText; + deleteParagraphToolStripMenuItem.Text = languageWaveform.DeleteParagraph; + toolStripMenuItemFocusTextbox.Text = languageWaveform.FocusTextBox; - splitToolStripMenuItem1.Text = Configuration.Settings.Language.Waveform.Split; - mergeWithPreviousToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.MergeWithPrevious; - mergeWithNextToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.MergeWithNext; - toolStripMenuItemWaveformPlaySelection.Text = Configuration.Settings.Language.Waveform.PlaySelection; - showWaveformAndSpectrogramToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.ShowWaveformAndSpectrogram; - showOnlyWaveformToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.ShowWaveformOnly; - showOnlySpectrogramToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.ShowSpectrogramOnly; - seekSilenceToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.SeekSilence; - guessTimeCodesToolStripMenuItem.Text = Configuration.Settings.Language.Waveform.GuessTimeCodes; + splitToolStripMenuItem1.Text = languageWaveform.Split; + mergeWithPreviousToolStripMenuItem.Text = languageWaveform.MergeWithPrevious; + mergeWithNextToolStripMenuItem.Text = languageWaveform.MergeWithNext; + toolStripMenuItemWaveformPlaySelection.Text = languageWaveform.PlaySelection; + showWaveformAndSpectrogramToolStripMenuItem.Text = languageWaveform.ShowWaveformAndSpectrogram; + showOnlyWaveformToolStripMenuItem.Text = languageWaveform.ShowWaveformOnly; + showOnlySpectrogramToolStripMenuItem.Text = languageWaveform.ShowSpectrogramOnly; + seekSilenceToolStripMenuItem.Text = languageWaveform.SeekSilence; + guessTimeCodesToolStripMenuItem.Text = languageWaveform.GuessTimeCodes; - toolStripButtonWaveformZoomOut.ToolTipText = Configuration.Settings.Language.Waveform.ZoomOut; - toolStripButtonWaveformZoomIn.ToolTipText = Configuration.Settings.Language.Waveform.ZoomIn; + toolStripButtonWaveformZoomOut.ToolTipText = languageWaveform.ZoomOut; + toolStripButtonWaveformZoomIn.ToolTipText = languageWaveform.ZoomIn; if (Configuration.Settings.VideoControls.GenerateSpectrogram) - audioVisualizer.WaveformNotLoadedText = Configuration.Settings.Language.Waveform.ClickToAddWaveformAndSpectrogram; + audioVisualizer.WaveformNotLoadedText = languageWaveform.ClickToAddWaveformAndSpectrogram; else - audioVisualizer.WaveformNotLoadedText = Configuration.Settings.Language.Waveform.ClickToAddWaveform; + audioVisualizer.WaveformNotLoadedText = languageWaveform.ClickToAddWaveform; } private void SetFormatToSubRip() @@ -3301,9 +3302,9 @@ namespace Nikse.SubtitleEdit.Forms if (format.GetType() == typeof(Sami) || format.GetType() == typeof(SamiModern)) SubtitleListview1.ShowExtraColumn(_languageGeneral.Class); else if (format.GetType() == typeof(TimedText10) || format.GetType() == typeof(ItunesTimedText)) - SubtitleListview1.ShowExtraColumn("Style / Language"); + SubtitleListview1.ShowExtraColumn(_languageGeneral.StyleLanguage); else if (format.Name == "Nuendo") - SubtitleListview1.ShowExtraColumn("Character"); //TODO: Put in language xml file + SubtitleListview1.ShowExtraColumn(_languageGeneral.Character); else SubtitleListview1.ShowExtraColumn(_languageGeneral.Style); @@ -5573,12 +5574,12 @@ namespace Nikse.SubtitleEdit.Forms toolStripMenuItemSetLanguage.DropDownItems.Add("-"); } - toolStripMenuItemSetLanguage.DropDownItems.Add("New"); + toolStripMenuItemSetLanguage.DropDownItems.Add(_language.New); var newItem = (ToolStripMenuItem)toolStripMenuItemSetLanguage.DropDownItems[toolStripMenuItemSetLanguage.DropDownItems.Count - 1]; var moreLanguages = new List(); foreach (CultureInfo x in CultureInfo.GetCultures(CultureTypes.NeutralCultures)) { - if (!languages.Contains(x.TwoLetterISOLanguageName.ToLower()) && !languages.Contains(x.TwoLetterISOLanguageName.ToLower())) + if (!languages.Contains(x.TwoLetterISOLanguageName.ToLower()) && !languages.Contains(x.ThreeLetterISOLanguageName.ToLower())) moreLanguages.Add(x.TwoLetterISOLanguageName.ToLower()); } moreLanguages.Sort(); @@ -5627,7 +5628,7 @@ namespace Nikse.SubtitleEdit.Forms } setStylesForSelectedLinesToolStripMenuItem.Visible = styles.Count > 1; toolStripMenuItemAssStyles.Visible = false; - setStylesForSelectedLinesToolStripMenuItem.Text = "Set character"; //TODO: Set language _language.Menu.ContextMenu.TimedTextStyles; + setStylesForSelectedLinesToolStripMenuItem.Text = _language.Menu.ContextMenu.NuendoSetStyle; } else { @@ -8805,7 +8806,7 @@ namespace Nikse.SubtitleEdit.Forms { if (matroskaSubtitleInfo.ContentEncodingType == 1) { - MessageBox.Show("Encrypted VobSub content not supported"); + MessageBox.Show(_language.NoSupportEncryptedVobSub); } ShowStatus(_language.ParsingMatroskaFile); @@ -8898,7 +8899,7 @@ namespace Nikse.SubtitleEdit.Forms { if (matroskaSubtitleInfo.ContentEncodingType == 1) { - MessageBox.Show("Encrypted vobsub content not supported"); + MessageBox.Show(_language.NoSupportEncryptedVobSub); } ShowStatus(_language.ParsingMatroskaFile); @@ -11065,7 +11066,7 @@ namespace Nikse.SubtitleEdit.Forms return new string(charArray); } - private static string ReverseParethesis(string s) + private static string ReverseParenthesis(string s) { const string k = "@__<<>___@"; @@ -11118,9 +11119,9 @@ namespace Nikse.SubtitleEdit.Forms } if (startsWithItalic) newLines.Append(""); - newLines.Append(ReverseParethesis(post.ToString())); + newLines.Append(ReverseParenthesis(post.ToString())); newLines.Append(s2.Substring(pre.Length, s2.Length - (pre.Length + post.Length))); - newLines.Append(ReverseParethesis(ReverseString(pre.ToString()))); + newLines.Append(ReverseParenthesis(ReverseString(pre.ToString()))); if (endsWithItalic) newLines.Append(""); newLines.AppendLine(); @@ -11601,10 +11602,10 @@ namespace Nikse.SubtitleEdit.Forms Environment.NewLine + exception.StackTrace, "Error loading language file"); Configuration.Settings.Language = new Language(); // default is en-US + Configuration.Settings.General.Language = null; _languageGeneral = Configuration.Settings.Language.General; _language = Configuration.Settings.Language.Main; InitializeLanguage(); - Configuration.Settings.General.Language = null; } } @@ -12068,7 +12069,7 @@ namespace Nikse.SubtitleEdit.Forms //TODO: Check for mkv etc if (Path.GetExtension(fileName).Equals(".sub", StringComparison.OrdinalIgnoreCase) && IsVobSubFile(fileName, false)) { - MessageBox.Show("VobSub files not supported here"); + MessageBox.Show(_language.NoSupportHereVobSub); return; } @@ -12076,12 +12077,12 @@ namespace Nikse.SubtitleEdit.Forms { if (FileUtil.IsBluRaySup(fileName)) { - MessageBox.Show("Blu-ray sup files not supported here"); + MessageBox.Show(_language.NoSupportHereBluRaySup); return; } else if (FileUtil.IsSpDvdSup(fileName)) { - MessageBox.Show("DVD sup files not supported here"); + MessageBox.Show(_language.NoSupportHereDvdSup); return; } } @@ -12126,7 +12127,7 @@ namespace Nikse.SubtitleEdit.Forms if (Path.GetExtension(fileName).Equals(".divx", StringComparison.OrdinalIgnoreCase) || Path.GetExtension(fileName).Equals(".avi", StringComparison.OrdinalIgnoreCase)) { - MessageBox.Show("Divx files not supported here"); + MessageBox.Show(_language.NoSupportHereDivx); return; } @@ -16899,7 +16900,7 @@ namespace Nikse.SubtitleEdit.Forms { toolStripMenuItemWebVttVoice.DropDownItems.Add(style, null, WebVTTSetVoiceTextBox); } - toolStripMenuItemWebVttVoice.DropDownItems.Add("Set new voice...", null, WebVTTSetNewVoiceTextBox); //TODO: Translate + toolStripMenuItemWebVttVoice.DropDownItems.Add(_language.Menu.ContextMenu.WebVTTSetNewVoice, null, WebVTTSetNewVoiceTextBox); } else { @@ -18865,7 +18866,7 @@ namespace Nikse.SubtitleEdit.Forms { if (!string.IsNullOrEmpty(form.OcrFileName)) { - MakeHistoryForUndo(_language.BeforeAutoBalanceSelectedLines); //TODO: Fix text + MakeHistoryForUndo(_language.BeforeAutoBalanceSelectedLines); OpenSubtitle(form.OcrFileName, null); } } @@ -18940,7 +18941,7 @@ namespace Nikse.SubtitleEdit.Forms int index = FirstSelectedIndex; if (index < 0) index = 0; - MakeHistoryForUndo("Before bridge small gaps"); //TODO: Fix text in SE 3.4 + MakeHistoryForUndo(_language.BeforeDurationsBridgeGap); _subtitle.Paragraphs.Clear(); foreach (Paragraph p in form.FixedSubtitle.Paragraphs) _subtitle.Paragraphs.Add(p); diff --git a/src/Logic/Language.cs b/src/Logic/Language.cs index 8780ab479..622eb8460 100644 --- a/src/Logic/Language.cs +++ b/src/Logic/Language.cs @@ -174,6 +174,8 @@ namespace Nikse.SubtitleEdit.Logic ControlsWindowTitle = "Controls - {0}", Advanced = "Advanced", Style = "Style", + StyleLanguage = "Style / Language", + Character = "Character", Class = "Class", GeneralText = "General", LineNumber = "Line#", @@ -1072,7 +1074,7 @@ namespace Nikse.SubtitleEdit.Logic BeforeSortX = "Before sort: {0}", SortedByX = "Sorted by: {0}", BeforeAutoBalanceSelectedLines = "Before auto balance selected lines", - NumberOfLinesAutoBalancedX = "Number of lines auto balanced: {0}", + NumberOfLinesAutoBalancedX = "Number of auto balanced lines: {0}", BeforeRemoveLineBreaksInSelectedLines = "Before remove line-breaks from selected lines", NumberOfWithRemovedLineBreakX = "Number of lines with removed line-break: {0}", BeforeMultipleReplace = "Before multiple replace", @@ -1090,6 +1092,7 @@ namespace Nikse.SubtitleEdit.Logic BeforeMergeShortLines = "Before merge short lines", BeforeSplitLongLines = "Before split long lines", MergedShortLinesX = "Number of lines merged: {0}", + BeforeDurationsBridgeGap = "Before bridge small gaps", BeforeSetMinimumDisplayTimeBetweenParagraphs = "Before set minimum display time between subtitles", XMinimumDisplayTimeBetweenParagraphsChanged = "Number of lines with minimum display time between subtitles changed: {0}", BeforeImportText = "Before import plain text", @@ -1151,6 +1154,11 @@ namespace Nikse.SubtitleEdit.Logic ErrorLoadZip = "This file seems to be a compressed .zip file. Subtitle Edit cannot open compressed files.", ErrorLoadPng = "This file seems to be a PNG image file. Subtitle Edit cannot open PNG files.", ErrorLoadSrr = "This file seems to be a ReScene .srr file - not a subtitle file.", + NoSupportEncryptedVobSub = "Encrypted VobSub content is not supported.", + NoSupportHereBluRaySup = "Blu-ray sup files are not supported here.", + NoSupportHereDvdSup = "DVD sup files are not supported here.", + NoSupportHereVobSub = "VobSub files are not supported here.", + NoSupportHereDivx = "Divx files are not supported here.", Menu = new LanguageStructure.Main.MainMenu { @@ -1368,6 +1376,7 @@ namespace Nikse.SubtitleEdit.Logic TimedTextSetStyle = "Timed Text - set style", TimedTextSetLanguage = "Timed Text - set language", SamiSetStyle = "Sami - set class", + NuendoSetStyle = "Nuendo - set character", Cut = "Cut", Copy = "Copy", Paste = "Paste", diff --git a/src/Logic/LanguageDeserializer.cs b/src/Logic/LanguageDeserializer.cs index 16079ccaa..4a4615cd8 100644 --- a/src/Logic/LanguageDeserializer.cs +++ b/src/Logic/LanguageDeserializer.cs @@ -243,6 +243,12 @@ namespace Nikse.SubtitleEdit.Logic case "General/Style": language.General.Style = reader.Value; break; + case "General/StyleLanguage": + language.General.StyleLanguage = reader.Value; + break; + case "General/Character": + language.General.Character = reader.Value; + break; case "General/Class": language.General.Class = reader.Value; break; @@ -2370,6 +2376,9 @@ namespace Nikse.SubtitleEdit.Logic case "Main/MergedShortLinesX": language.Main.MergedShortLinesX = reader.Value; break; + case "Main/BeforeDurationsBridgeGap": + language.Main.BeforeDurationsBridgeGap = reader.Value; + break; case "Main/BeforeSetMinimumDisplayTimeBetweenParagraphs": language.Main.BeforeSetMinimumDisplayTimeBetweenParagraphs = reader.Value; break; @@ -2553,6 +2562,21 @@ namespace Nikse.SubtitleEdit.Logic case "Main/ErrorLoadSrr": language.Main.ErrorLoadSrr = reader.Value; break; + case "Main/NoSupportEncryptedVobSub": + language.Main.NoSupportEncryptedVobSub = reader.Value; + break; + case "Main/NoSupportHereBluRaySup": + language.Main.NoSupportHereBluRaySup = reader.Value; + break; + case "Main/NoSupportHereDvdSup": + language.Main.NoSupportHereDvdSup = reader.Value; + break; + case "Main/NoSupportHereVobSub": + language.Main.NoSupportHereVobSub = reader.Value; + break; + case "Main/NoSupportHereDivx": + language.Main.NoSupportHereDivx = reader.Value; + break; case "Main/Menu/File/Title": language.Main.Menu.File.Title = reader.Value; break; @@ -3057,6 +3081,9 @@ namespace Nikse.SubtitleEdit.Logic case "Main/Menu/ContextMenu/SamiSetStyle": language.Main.Menu.ContextMenu.SamiSetStyle = reader.Value; break; + case "Main/Menu/ContextMenu/NuendoSetStyle": + language.Main.Menu.ContextMenu.NuendoSetStyle = reader.Value; + break; case "Main/Menu/ContextMenu/Cut": language.Main.Menu.ContextMenu.Cut = reader.Value; break; diff --git a/src/Logic/LanguageStructure.cs b/src/Logic/LanguageStructure.cs index ab19d8810..d4ca906c1 100644 --- a/src/Logic/LanguageStructure.cs +++ b/src/Logic/LanguageStructure.cs @@ -69,6 +69,8 @@ public string ControlsWindowTitle { get; set; } public string Advanced { get; set; } public string Style { get; set; } + public string StyleLanguage { get; set; } + public string Character { get; set; } public string Class { get; set; } public string GeneralText { get; set; } public string LineNumber { get; set; } @@ -477,7 +479,7 @@ public string Right { get; set; } public string Center { get; set; } public string BottomMargin { get; set; } - public string LeftRightMargin { get; set; } + public string LeftRightMargin { get; set; } public string SaveBluRraySupAs { get; set; } public string SaveVobSubAs { get; set; } public string SaveFabImageScriptAs { get; set; } @@ -973,6 +975,7 @@ public string BeforeMergeShortLines { get; set; } public string BeforeSplitLongLines { get; set; } public string MergedShortLinesX { get; set; } + public string BeforeDurationsBridgeGap { get; set; } public string BeforeSetMinimumDisplayTimeBetweenParagraphs { get; set; } public string XMinimumDisplayTimeBetweenParagraphsChanged { get; set; } public string BeforeImportText { get; set; } @@ -1034,6 +1037,11 @@ public string ErrorLoadZip { get; set; } public string ErrorLoadPng { get; set; } public string ErrorLoadSrr { get; set; } + public string NoSupportEncryptedVobSub { get; set; } + public string NoSupportHereBluRaySup { get; set; } + public string NoSupportHereDvdSup { get; set; } + public string NoSupportHereVobSub { get; set; } + public string NoSupportHereDivx { get; set; } public class MainMenu { @@ -1244,6 +1252,7 @@ public string TimedTextStyles { get; set; } public string TimedTextSetLanguage { get; set; } public string SamiSetStyle { get; set; } + public string NuendoSetStyle { get; set; } public string Cut { get; set; } public string Copy { get; set; } public string Paste { get; set; }