commented out format checking, since noone except me would want to run it, i guess?

This commit is contained in:
Master Kwoth 2017-06-05 01:56:07 +02:00
parent cc212626f7
commit f92fd23cab

View File

@ -47,29 +47,30 @@ namespace NadekoBot.Services
string.Join(",", responseStrings.Keys), string.Join(",", responseStrings.Keys),
sw.Elapsed.TotalSeconds); sw.Elapsed.TotalSeconds);
var compareTo = responseStrings["en-us"] //improper string format checks
.Select(x => { //var compareTo = responseStrings["en-us"]
return (StringKey: x.Key,Placeholders: formatFinder.Matches(x.Value).Cast<Match>().Select(y => y.Value).ToArray()); // .Select(x => {
}) // return (StringKey: x.Key,Placeholders: formatFinder.Matches(x.Value).Cast<Match>().Select(y => y.Value).ToArray());
.ToDictionary(x => x.StringKey, x => x.Placeholders); // })
// .ToDictionary(x => x.StringKey, x => x.Placeholders);
var errors = responseStrings //var errors = responseStrings
.Select(a => (a.Key, a.Value.Select(x => // .Select(a => (a.Key, a.Value.Select(x =>
{ // {
if (!compareTo.ContainsKey(x.Key)) // if (!compareTo.ContainsKey(x.Key))
return (StringKey: x.Key, Placeholders: new HashSet<string>(), Missing: true); // return (StringKey: x.Key, Placeholders: new HashSet<string>(), Missing: true);
var hs = new HashSet<string>(compareTo[x.Key]); // var hs = new HashSet<string>(compareTo[x.Key]);
hs.SymmetricExceptWith(formatFinder.Matches(x.Value).Cast<Match>().Select(y => y.Value).ToArray()); // hs.SymmetricExceptWith(formatFinder.Matches(x.Value).Cast<Match>().Select(y => y.Value).ToArray());
return (StringKey: x.Key, Placeholders: hs, Missing: false); // return (StringKey: x.Key, Placeholders: hs, Missing: false);
}) // })
.Where(x => x.Placeholders.Any() || x.Missing))) // .Where(x => x.Placeholders.Any() || x.Missing)))
.Where(x => x.Item2.Any()); // .Where(x => x.Item2.Any());
var str = string.Join("\n", errors.Select(x => $"------{x.Item1}------\n" + //var str = string.Join("\n", errors.Select(x => $"------{x.Item1}------\n" +
string.Join("\n", x.Item2.Select(y => // string.Join("\n", x.Item2.Select(y =>
y.StringKey + ": " + (y.Missing ? "MISSING" : string.Join(", ", y.Placeholders)))))); // y.StringKey + ": " + (y.Missing ? "MISSING" : string.Join(", ", y.Placeholders))))));
if(!string.IsNullOrWhiteSpace(str)) //if(!string.IsNullOrWhiteSpace(str))
_log.Warn($"Improperly Formatted strings:\n{str}"); // _log.Warn($"Improperly Formatted strings:\n{str}");
} }
private string GetLocaleName(string fileName) private string GetLocaleName(string fileName)