From 267e61b9a5f8c2ba4d1744f443bfcb463d4144a4 Mon Sep 17 00:00:00 2001 From: niksedk Date: Thu, 22 Aug 2019 12:59:58 +0200 Subject: [PATCH] Rafact (minor) + typo --- libse/Translate/Formatting.cs | 2 +- libse/Translate/GoogleTranslator1.cs | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/libse/Translate/Formatting.cs b/libse/Translate/Formatting.cs index a4eb2f8b7..3070d47e7 100644 --- a/libse/Translate/Formatting.cs +++ b/libse/Translate/Formatting.cs @@ -19,7 +19,7 @@ namespace Nikse.SubtitleEdit.Core.Translate var text = input.Trim(); // SSA/ASS tags - if (text.StartsWith("{\\")) + if (text.StartsWith("{\\", StringComparison.Ordinal)) { var endIndex = text.IndexOf('}'); if (endIndex > 0) diff --git a/libse/Translate/GoogleTranslator1.cs b/libse/Translate/GoogleTranslator1.cs index 231e63992..1d0c1e624 100644 --- a/libse/Translate/GoogleTranslator1.cs +++ b/libse/Translate/GoogleTranslator1.cs @@ -125,10 +125,10 @@ namespace Nikse.SubtitleEdit.Core.Translate if (resultList.Count > paragraphs.Count) { - var timmedList = resultList.Where(p => !string.IsNullOrEmpty(p)).ToList(); - if (timmedList.Count == paragraphs.Count) + var trimmedList = resultList.Where(p => !string.IsNullOrEmpty(p)).ToList(); + if (trimmedList.Count == paragraphs.Count) { - return timmedList; + return trimmedList; } } @@ -153,12 +153,12 @@ namespace Nikse.SubtitleEdit.Core.Translate var line = input[index]; var text = paragraphs[index].Text; var badPoints = 0; - if (text.StartsWith("[") && !line.StartsWith("[")) + if (text.StartsWith('[') && !line.StartsWith('[')) { badPoints++; } - if (text.StartsWith("-") && !line.StartsWith("-")) + if (text.StartsWith('-') && !line.StartsWith('-')) { badPoints++; } @@ -168,27 +168,27 @@ namespace Nikse.SubtitleEdit.Core.Translate badPoints++; } - if (text.EndsWith(".") && !line.EndsWith(".")) + if (text.EndsWith('.') && !line.EndsWith('.')) { badPoints++; } - if (text.EndsWith("!") && !line.EndsWith("!")) + if (text.EndsWith('!') && !line.EndsWith('!')) { badPoints++; } - if (text.EndsWith("?") && !line.EndsWith("?")) + if (text.EndsWith('?') && !line.EndsWith('?')) { badPoints++; } - if (text.EndsWith(",") && !line.EndsWith(",")) + if (text.EndsWith(',') && !line.EndsWith(',')) { badPoints++; } - if (text.EndsWith(":") && !line.EndsWith(":")) + if (text.EndsWith(':') && !line.EndsWith(':')) { badPoints++; } @@ -222,6 +222,5 @@ namespace Nikse.SubtitleEdit.Core.Translate return input; } - } }