2020-01-26 00:27:16 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
|
|
public static class LocalizeUtil
|
2020-01-26 00:27:16 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
/// <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)
|
2020-01-26 00:27:16 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
var str = GameInfo.Strings = GameInfo.GetStrings(lang);
|
|
|
|
|
if (sav != null)
|
|
|
|
|
GameInfo.FilteredSources = new FilteredGameDataSource(sav, GameInfo.Sources, hax);
|
2020-01-26 00:27:16 +00:00
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
// Update Legality Analysis strings
|
|
|
|
|
ParseSettings.ChangeLocalizationStrings(str.movelist, str.specieslist);
|
2020-01-26 00:27:16 +00:00
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
// Update Legality Strings
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
RibbonStrings.ResetDictionary(str.ribbons);
|
|
|
|
|
LocalizationUtil.SetLocalization(typeof(LegalityCheckStrings), lang);
|
|
|
|
|
LocalizationUtil.SetLocalization(typeof(MessageStrings), lang);
|
|
|
|
|
});
|
2020-01-26 00:27:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|