Improve "FixMissingSpaces" support for ko, zh, ja, th - thx Jamakmake :)

regarding dialogs
This commit is contained in:
Nikolaj Olsson 2020-04-09 22:38:06 +02:00
parent f78ee4cee2
commit 81abf9d2f3

View File

@ -1,5 +1,6 @@
using Nikse.SubtitleEdit.Core.Interfaces;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
@ -21,7 +22,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
string languageCode = callbacks.Language;
string fixAction = language.FixMissingSpace;
int missingSpaces = 0;
var dialogHelper = new DialogSplitMerge { DialogStyle = Configuration.Settings.General.DialogStyle };
var dialogHelper = new DialogSplitMerge { DialogStyle = Configuration.Settings.General.DialogStyle, AllowDialogWithNoSentenceEnding = IsLanguageWithoutPeriods(callbacks.Language) };
const string expectedChars = @"""”<.";
for (int i = 0; i < subtitle.Paragraphs.Count; i++)
{
@ -501,5 +502,9 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
return text.Substring(startIndex, endIndex - startIndex + 1);
}
private static bool IsLanguageWithoutPeriods(string language)
{
return new List<string> { "ko", "zh", "ja", "th" }.Contains(language);
}
}
}