Fix non-English set imports of remapped forms

No need to do the English-specific remapping if the language isn't English
Closes #4613
This commit is contained in:
Kurt 2025-10-29 01:47:43 -05:00
parent 98255526d6
commit 5bdfd4597c
2 changed files with 6 additions and 3 deletions

View File

@ -78,6 +78,8 @@ public static string GetStringFromForm(byte form, GameStrings strings, ushort sp
var result = form >= forms.Length ? string.Empty : forms[form];
// Showdown uses a non-standard representation for some forms, and uses interstitial dashes instead of spaces.
if (strings.Language != LanguageID.English)
return result;
return GetShowdownFormName(species, result);
}
@ -316,7 +318,7 @@ public static string GetShowdownText(PKM pk, in BattleTemplateExportSettings set
{
if (pk.Species == 0)
return string.Empty;
var set = new ShowdownSet(pk);
var set = new ShowdownSet(pk, settings.Localization);
set.InterpretAsPreview(pk);
return set.GetText(settings);
}
@ -371,7 +373,7 @@ public static IEnumerable<ShowdownSet> GetShowdownSets(IEnumerable<PKM> data)
/// <returns>Multi-line string</returns>
public static string GetLocalizedPreviewText(PKM pk, in BattleTemplateExportSettings settings)
{
var set = new ShowdownSet(pk);
var set = new ShowdownSet(pk, settings.Localization);
set.InterpretAsPreview(pk);
return set.GetText(settings);
}

View File

@ -82,7 +82,8 @@ private void LoadLines(IEnumerable<string> lines, BattleTemplateLocalization loc
private void SanitizeResult(BattleTemplateLocalization localization)
{
ReviseContextIfPastGenForm(localization.Strings);
FormName = ShowdownParsing.GetFormNameFromShowdownFormName(Species, FormName, Ability);
if (localization.Strings.Language == LanguageID.English)
FormName = ShowdownParsing.GetFormNameFromShowdownFormName(Species, FormName, Ability);
Form = ShowdownParsing.GetFormFromString(FormName, localization.Strings, Species, Context);
// Handle edge case with fixed-gender forms.