From 533c870ca5a2e148eb63051b7e2d525921a585e4 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 18 May 2025 18:13:51 -0500 Subject: [PATCH] Revise stat abbreviations Closes #4495 fix german's order (speed last) --- PKHeX.Core/Resources/config/battle_de.json | 4 +-- PKHeX.Core/Resources/config/battle_es.json | 2 +- PKHeX.Core/Resources/config/battle_fr.json | 2 +- PKHeX.Core/Resources/config/battle_it.json | 4 +-- .../Simulator/ShowdownSetTests.cs | 31 +++++++++++++++++++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/PKHeX.Core/Resources/config/battle_de.json b/PKHeX.Core/Resources/config/battle_de.json index c4b0ed792..b66c71838 100644 --- a/PKHeX.Core/Resources/config/battle_de.json +++ b/PKHeX.Core/Resources/config/battle_de.json @@ -1,11 +1,11 @@ { "StatNames": { - "Names": ["KP", "Ang", "Vert", "Init", "SpA", "SpV"], + "Names": ["KP", "Ang", "Vert", "SpA", "SpV", "Init"], "ValueGap": " ", "Separator": " / " }, "StatNamesFull": { - "Names": ["KP", "Angriff", "Verteidigung", "Initiative", "Sp. Angriff", "Sp. Verteidigung"], + "Names": ["KP", "Angriff", "Verteidigung", "Spez. Ang.", "Spez. Vert.", "Initiative"], "ValueGap": " ", "Separator": " / " }, diff --git a/PKHeX.Core/Resources/config/battle_es.json b/PKHeX.Core/Resources/config/battle_es.json index 8103efe71..131f3eebc 100644 --- a/PKHeX.Core/Resources/config/battle_es.json +++ b/PKHeX.Core/Resources/config/battle_es.json @@ -1,6 +1,6 @@ { "StatNames": { - "Names": ["PS", "Atq", "Def", "AtS", "DeS", "Vel"], + "Names": ["PS", "Atq", "Def", "Asp", "Dsp", "Vel"], "ValueGap": " ", "Separator": " / " }, diff --git a/PKHeX.Core/Resources/config/battle_fr.json b/PKHeX.Core/Resources/config/battle_fr.json index 51f0eb0d6..fd883a50b 100644 --- a/PKHeX.Core/Resources/config/battle_fr.json +++ b/PKHeX.Core/Resources/config/battle_fr.json @@ -1,6 +1,6 @@ { "StatNames": { - "Names": ["PV", "Atq", "Déf", "AttS", "DéfS", "Vit"], + "Names": ["PV", "Atq", "Dfs", "Asp", "Dsp", "Vit"], "ValueGap": " ", "Separator": " / " }, diff --git a/PKHeX.Core/Resources/config/battle_it.json b/PKHeX.Core/Resources/config/battle_it.json index ae10c3df5..c4d4abe4d 100644 --- a/PKHeX.Core/Resources/config/battle_it.json +++ b/PKHeX.Core/Resources/config/battle_it.json @@ -1,11 +1,11 @@ { "StatNames": { - "Names": ["PS", "Att", "Dif", "AtS", "DiS", "Vel"], + "Names": ["PS", "Att", "Dif", "Asp", "Dsp", "Vel"], "ValueGap": " ", "Separator": " / " }, "StatNamesFull": { - "Names": ["PS", "Attacco", "Difesa", "Attacco Sp.", "Difesa Sp.", "Velocità"], + "Names": ["PS", "Attacco", "Difesa", "Att. Spec.", "Dif. Spec.", "Velocità"], "ValueGap": " ", "Separator": " / " }, diff --git a/Tests/PKHeX.Core.Tests/Simulator/ShowdownSetTests.cs b/Tests/PKHeX.Core.Tests/Simulator/ShowdownSetTests.cs index 961bae785..fbbd591be 100644 --- a/Tests/PKHeX.Core.Tests/Simulator/ShowdownSetTests.cs +++ b/Tests/PKHeX.Core.Tests/Simulator/ShowdownSetTests.cs @@ -197,6 +197,37 @@ public void SimulatorTranslate(string message, string languageOriginal = "en") } } + [Fact] + public void StatNamesNoSubstring() + { + var all = BattleTemplateLocalization.GetAll(); + foreach (var l in all) + { + var languageTarget = l.Key; + var x = l.Value.Config; + + CheckSubstring(x.StatNames.Names, languageTarget); + CheckSubstring(x.StatNamesFull.Names, languageTarget); + } + + void CheckSubstring(string[] statNames, string languageTarget) + { + // ensure no stat name is a substring of another + for (int i = 0; i < statNames.Length; i++) + { + var name = statNames[i]; + for (int j = 0; j < statNames.Length; j++) + { + if (i == j) + continue; + var other = statNames[j]; + if (other.Contains(name) || name.Contains(other)) + throw new Exception($"Stat name {name} is a substring of {other} in {languageTarget}"); + } + } + } + } + [Theory] [InlineData(SetAllTokenExample)] public void SimulatorTranslateHABCDS(string message, string languageOriginal = "en")