mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Detect and uncheck inserts in quotes for Arabic
This commit is contained in:
parent
5853c3bf17
commit
7d10b03450
@ -846,14 +846,14 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static bool IsFullLineTag(string input, int position)
|
||||
{
|
||||
input = ExtractParagraphOnly(input);
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
input = ExtractParagraphOnly(input);
|
||||
|
||||
var lineStartIndex = (position > 0 && position < input.Length) ? input.LastIndexOf("\n", position, StringComparison.Ordinal) : 0;
|
||||
if (lineStartIndex == -1)
|
||||
{
|
||||
@ -906,14 +906,14 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static bool IsFullLineQuote(string originalInput, int position, char quoteStart, char quoteEnd)
|
||||
{
|
||||
string input = ExtractParagraphOnly(originalInput);
|
||||
|
||||
// Return if empty string
|
||||
if (string.IsNullOrEmpty(originalInput))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string input = ExtractParagraphOnly(originalInput);
|
||||
|
||||
// Shift index if needed after deleting { } tags
|
||||
position -= Math.Max(0, originalInput.IndexOf(input, StringComparison.Ordinal));
|
||||
|
||||
@ -1195,6 +1195,22 @@ namespace Nikse.SubtitleEdit.Core
|
||||
return input.Replace(",", "،").Replace("?", "؟");
|
||||
}
|
||||
|
||||
public static bool IsArabicInsert(string originalInput, string sanitizedInput)
|
||||
{
|
||||
string input = ExtractParagraphOnly(originalInput);
|
||||
input = Regex.Replace(input, "<.*?>", string.Empty);
|
||||
|
||||
if (input.Length > 0)
|
||||
{
|
||||
if (Quotes.Contains(input[0]) && Quotes.Contains(input[input.Length - 1]) && !sanitizedInput.EndsWith(",") && !IsEndOfSentence(sanitizedInput))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int GetMinimumGapMs()
|
||||
{
|
||||
return Math.Max(Configuration.Settings.General.MinimumMillisecondsBetweenLines + 5, 300);
|
||||
|
@ -81,6 +81,15 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
isChecked = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ...and Arabic inserts
|
||||
if (callbacks.Language == "ar")
|
||||
{
|
||||
if (ContinuationUtilities.IsArabicInsert(oldText, text) || ContinuationUtilities.IsArabicInsert(oldTextNext, textNext))
|
||||
{
|
||||
isChecked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user