Translations: Tests: Added SpellCheck Common excludes

This commit is contained in:
Alexey Safronov 2023-04-14 13:29:31 +04:00
parent 8e0d66d063
commit acbbc78533
2 changed files with 40 additions and 1 deletions

View File

@ -69,6 +69,7 @@ public class LocalesTest
//public List<JsonEncodingError> WrongEncodingJsonErrors { get; set; }
private static readonly string _md5ExcludesPath = Path.GetFullPath(Utils.ConvertPathToOS("../../../md5-excludes.json"));
private static readonly string _spellCheckCommonExcludesPath = Path.GetFullPath(Utils.ConvertPathToOS("../../../spellcheck-excludes-common.json"));
//private static string _encodingExcludesPath = "../../../encoding-excludes.json";
@ -76,6 +77,10 @@ public class LocalesTest
? JsonConvert.DeserializeObject<List<string>>(File.ReadAllText(_md5ExcludesPath))
: new List<string>();
private static readonly List<string> _spellCheckCommonExcludes = File.Exists(_spellCheckCommonExcludesPath)
? JsonConvert.DeserializeObject<List<string>>(File.ReadAllText(_spellCheckCommonExcludesPath))
: new List<string>();
//private static List<string> encodingExcludes = File.Exists(_encodingExcludesPath)
// ? JsonConvert.DeserializeObject<List<string>>(File.ReadAllText(_encodingExcludesPath))
// : new List<string>();
@ -336,6 +341,8 @@ public class LocalesTest
TestContext.Progress.WriteLine($"Found _md5Excludes = {_md5Excludes.Count()} Path to file '{_md5ExcludesPath}'");
TestContext.Progress.WriteLine($"Found _spellCheckCommonExcludes = {_spellCheckCommonExcludes.Count()} Path to file '{_spellCheckCommonExcludesPath}'");
}
[Test]
@ -407,7 +414,19 @@ public class LocalesTest
if (result.HasProblems)
{
message += $"{++i}. lng='{group.Language}' file='{g.FilePath}'\r\nkey='{item.Key}' value='{item.Value}'\r\nIncorrect words:\r\n{string.Join("\r\n", result.SpellIssues.Select(issue => $"'{issue.Word}' Suggestion: '{issue.Suggestions.FirstOrDefault()}'"))}\r\n\r\n";
var incorrectWords = result.SpellIssues
.Where(t => !_spellCheckCommonExcludes
.Exists(e => e.Equals(t.Word, StringComparison.InvariantCultureIgnoreCase)))
.Select(issue => $"'{issue.Word}' " +
$"Suggestion: '{issue.Suggestions.FirstOrDefault()}'")
.ToList();
if (!incorrectWords.Any())
continue;
message += $"{++i}. lng='{group.Language}' file='{g.FilePath}'\r\nkey='{item.Key}' " +
$"value='{item.Value}'\r\nIncorrect words:\r\n" +
$"{string.Join("\r\n", incorrectWords)}\r\n\r\n";
errorsCount++;

View File

@ -0,0 +1,20 @@
[
"Amazon",
"AWS",
"DocSpace",
"ONLYOFFICE",
"ID",
"IP",
"IPv4",
"IPv",
"DNS",
"SVG",
"PNG",
"NameId",
"IdP",
"Sp",
"macOS",
"SAML",
"Stripe",
"SDK"
]