PKHeX/PKHeX.Core/Editing/LocalizeUtil.cs
Kurt fa36b70b29 Split Analysis into two separate classes
Will rename in next commit
2020-11-27 12:00:49 -08:00

31 lines
1.1 KiB
C#

using System.Threading.Tasks;
namespace PKHeX.Core
{
public static class LocalizeUtil
{
/// <summary>
/// Initializes PKHeX's runtime strings to the specified language.
/// </summary>
/// <param name="lang">2-char language ID</param>
/// <param name="sav">Save data (optional)</param>
/// <param name="hax">Permit illegal things (items, only)</param>
public static void InitializeStrings(string lang, SaveFile? sav = null, bool hax = false)
{
var str = GameInfo.Strings = GameInfo.GetStrings(lang);
if (sav != null)
GameInfo.FilteredSources = new FilteredGameDataSource(sav, GameInfo.Sources, hax);
// Update Legality Analysis strings
LegalityAnalyzers.ChangeLocalizationStrings(str.movelist, str.specieslist);
// Update Legality Strings
Task.Run(() =>
{
RibbonStrings.ResetDictionary(str.ribbons);
Util.SetLocalization(typeof(LegalityCheckStrings), lang);
Util.SetLocalization(typeof(MessageStrings), lang);
});
}
}
}