PKHeX/PKHeX.Core/Util/Localization/LocalizeUtil.cs
Kurt fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07:00

30 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
ParseSettings.ChangeLocalizationStrings(str.movelist, str.specieslist);
// Update Legality Strings
Task.Run(() =>
{
RibbonStrings.ResetDictionary(str.ribbons);
LocalizationUtil.SetLocalization(typeof(LegalityCheckStrings), lang);
LocalizationUtil.SetLocalization(typeof(MessageStrings), lang);
});
}
}