diff --git a/src/Languages/da-DK.xml b/src/Languages/da-DK.xml index 006ab1b7a..5c94156d1 100644 --- a/src/Languages/da-DK.xml +++ b/src/Languages/da-DK.xml @@ -5,7 +5,8 @@ 3.3.14 Oversat til dansk af Nikse (mailto:nikse.dk@gmail.com) da-DK - + + &OK &Fortryd Anvend @@ -1309,6 +1310,7 @@ Fortsæt? Nyere version af Subtitle Edit kræves! [Ny version findes!] Opdater alle + {0} plugin(s) opdateret Fjern tekst for hørehæmmede @@ -1401,8 +1403,7 @@ Fortsæt? Auto-ombryd tekst mens du skriver Min. varighed, millisekunder Max. varighed, millisekunder - - + Min. mellemrum mellem undertekster i ms undertekst skrifttype undertekst skriftstørrelse Fed @@ -1444,8 +1445,7 @@ Fortsæt? MPlayer2/Mplayer VLC Media Player libvlc.dll fra VLC Media Player 1.1.0 eller nyere - - + VLC sti (kun nødvendig, hvis du bruger den portable version af VLC) Vis stop-knap Vis mute-knap Vis fuldskærm knap @@ -1475,8 +1475,7 @@ Fortsæt? Benyt FFMPEG til at udtrække lydfiler Sti til FFMPEG Vælg sti stil FFMPEG - - + Gå til VLC portable Sub Station Alpha Style Vælg skrifttype Vælg farve @@ -1515,8 +1514,7 @@ Fortsæt? Musik symbol Musik symboler der skal erstattes (adskilt af mellemrum) Ret normale OCR fejl - Inkluder hardcodede regler - - + Fix kort visningstid - tillad flytning af starttidspunkt Genveje Genvej Control @@ -1599,6 +1597,8 @@ Fortsæt? Flyt første ord fra næste linje op Auto-ombryd tekst Fjern linjeskift + Diverse + Benyt skift-ikke-efter-liste (for auto-ombrydning) Vis valgte linjer tidligere/senere diff --git a/src/Logic/NoBreakAfterItem.cs b/src/Logic/NoBreakAfterItem.cs new file mode 100644 index 000000000..05eb8d809 --- /dev/null +++ b/src/Logic/NoBreakAfterItem.cs @@ -0,0 +1,33 @@ +using System.Text.RegularExpressions; + +namespace Nikse.SubtitleEdit.Logic +{ + public class NoBreakAfterItem + { + public Regex _regex; + public string _text; + private string p1; + + public NoBreakAfterItem(Regex regex) + { + _regex = regex; + } + + public NoBreakAfterItem(string text) + { + _text = text; + } + + public bool IsMatch(string line) + { + if (_regex != null) + return _regex.IsMatch(line); + + if (!string.IsNullOrEmpty(_text) && line.EndsWith(_text)) + return true; + + return false; + } + + } +} diff --git a/src/Logic/Utilities.cs b/src/Logic/Utilities.cs index 68895a360..8035bbdd4 100644 --- a/src/Logic/Utilities.cs +++ b/src/Logic/Utilities.cs @@ -356,12 +356,14 @@ namespace Nikse.SubtitleEdit.Logic // Some words we don't like breaking after string s2 = s.Substring(0, index); - if (Configuration.Settings.Tools.UseNoLineBreakAfter && language == "en") + if (Configuration.Settings.Tools.UseNoLineBreakAfter) { - foreach (string ending in Configuration.Settings.Tools.NoLineBreakAfterEnglish.Split(';')) + + foreach (NoBreakAfterItem ending in NoBreakAfterList(language)) { - if (ending.Length > 0 && s2.EndsWith(ending)) + if (ending.IsMatch(s2)) return false; + } } @@ -371,6 +373,46 @@ namespace Nikse.SubtitleEdit.Logic return true; } + private static string _lastNoBreakAfterListLanguage = null; + private static List _lastNoBreakAfterList = new List(); + private static IEnumerable NoBreakAfterList(string languageName) + { + if (string.IsNullOrEmpty(languageName)) + return new List(); + + if (languageName == _lastNoBreakAfterListLanguage) + return _lastNoBreakAfterList; + + _lastNoBreakAfterList = new List(); + + //load words via xml + string noBreakAfterFileName = DictionaryFolder + languageName + "_NoBreakAfterList.xml"; + var doc = new XmlDocument(); + if (File.Exists(noBreakAfterFileName)) + { + doc.Load(noBreakAfterFileName); + foreach (XmlNode node in doc.DocumentElement) + { + if (!string.IsNullOrEmpty(node.InnerText)) + { + if (node.Attributes["RegEx"] != null && node.Attributes["RegEx"].InnerText.ToLower() == "true") + { + Regex r = new Regex(node.InnerText, RegexOptions.Compiled); + _lastNoBreakAfterList.Add(new NoBreakAfterItem(r)); + } + else + { + _lastNoBreakAfterList.Add(new NoBreakAfterItem(node.InnerText)); + } + } + } + } + _lastNoBreakAfterListLanguage = languageName; + + return _lastNoBreakAfterList; + + } + public static string AutoBreakLineMoreThanTwoLines(string text, int maximumLineLength, string language) { if (text == null || text.Length < 3) diff --git a/src/SubtitleEdit.csproj b/src/SubtitleEdit.csproj index 02d1fa887..dc2e6d343 100644 --- a/src/SubtitleEdit.csproj +++ b/src/SubtitleEdit.csproj @@ -833,6 +833,7 @@ Code + diff --git a/src/SubtitleEdit.sln b/src/SubtitleEdit.sln index 8ae69e729..96741634b 100644 --- a/src/SubtitleEdit.sln +++ b/src/SubtitleEdit.sln @@ -1,5 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubtitleEdit", "SubtitleEdit.csproj", "{511A5B59-1C35-4719-8536-23B19AF9B21A}" ProjectSection(ProjectDependencies) = postProject {DBD4656C-5F40-4067-A70B-C4460DE20F77} = {DBD4656C-5F40-4067-A70B-C4460DE20F77} @@ -17,9 +19,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateAssemblyInfo", "UpdateAssemblyInfo\UpdateAssemblyInfo.csproj", "{DBD4656C-5F40-4067-A70B-C4460DE20F77}" EndProject Global - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = SubtitleEdit.vsmdi - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -41,4 +40,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = SubtitleEdit.vsmdi + EndGlobalSection EndGlobal