From 2acef4eaf7869a1d004686a4c981d72ee20e7923 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 6 Apr 2018 22:51:10 -0700 Subject: [PATCH] Add messagestring dumper untested, will monkey with later --- PKHeX.WinForms/MainWindow/Main.cs | 1 + PKHeX.WinForms/Util/DevUtil.cs | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 8bd68dd53..0f67dceca 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -930,6 +930,7 @@ namespace PKHeX.WinForms Task.Run(() => { var lang = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Substring(0, 2); Util.SetLocalization(typeof(LegalityCheckStrings), lang); + Util.SetLocalization(typeof(MessageStrings), lang); RibbonStrings.ResetDictionary(GameInfo.Strings.ribbons); }); diff --git a/PKHeX.WinForms/Util/DevUtil.cs b/PKHeX.WinForms/Util/DevUtil.cs index 3e3136a2b..86d6ad26e 100644 --- a/PKHeX.WinForms/Util/DevUtil.cs +++ b/PKHeX.WinForms/Util/DevUtil.cs @@ -48,22 +48,28 @@ namespace PKHeX.WinForms nameof(SettingsEditor), }; - public static void DumpLegalityStrings() + + public static void DumpStringsMessage() => DumpStrings(typeof(MessageStrings)); + public static void DumpStringsLegality() => DumpStrings(typeof(LegalityCheckStrings)); + private static void DumpStrings(Type t, bool sort = false) { var langs = new[] {DefaultLanguage}.Concat(Languages); foreach (var lang in langs) { - Util.SetLocalization(typeof(LegalityCheckStrings), lang); - var entries = Util.GetLocalization(typeof(LegalityCheckStrings)); + Util.SetLocalization(t, lang); + var entries = Util.GetLocalization(t); var export = entries.Select(z => new {Variable = z.Split('=')[0], Line = z}) .GroupBy(z => z.Variable.Length) // fancy sort! .OrderBy(z => z.Key) // sort by length (V1 = 2, V100 = 4) .SelectMany(z => z.OrderBy(n => n.Variable)) // select sets from ordered Names .Select(z => z.Line); // sorted lines - var fn = $"{nameof(LegalityCheckStrings)}_{lang}.txt"; + if (!sort) // discard linq + export = entries; + + var fn = $"{t.Name}_{lang}.txt"; File.WriteAllLines(fn, export); - Util.SetLocalization(typeof(LegalityCheckStrings), DefaultLanguage); + Util.SetLocalization(t, DefaultLanguage); } } }