feat(web): translate error messages surfaced from API error codes to English

Translates the five client-side error-message maps (world, hunting, combat,
inventory, local-location stores) that re-translate already-English API
error codes back to display text, per design doc §4. Also fixes four
component specs that hard-coded the same German strings when asserting
rendered error text (combat-page, hunt-page, location-interaction-panel,
location-page).
This commit is contained in:
Bastian Wagner
2026-08-21 21:29:10 +02:00
parent 5222bfb2ab
commit 5586e6c672
14 changed files with 53 additions and 53 deletions

View File

@@ -228,7 +228,7 @@ describe('HuntPageComponent', () => {
const fixture = await setup(burnedRoad, threeEncounterHunt);
combatStore.startCombat.mockImplementation(async () => {
combatStore.errorCode.set('COMBAT_ALREADY_ACTIVE');
combatStore.error.set('Du befindest dich bereits in einem Kampf.');
combatStore.error.set("You're already in a combat.");
});
combatStore.loadActiveCombat.mockResolvedValue({ ...startedCombat, id: 'combat-running' });
const element = fixture.nativeElement as HTMLElement;
@@ -249,7 +249,7 @@ describe('HuntPageComponent', () => {
const fixture = await setup(burnedRoad, threeEncounterHunt);
combatStore.startCombat.mockImplementation(async () => {
combatStore.errorCode.set('HUNT_ENCOUNTER_ALREADY_CONSUMED');
combatStore.error.set('Diese Begegnung wurde bereits genutzt.');
combatStore.error.set('This encounter has already been used.');
});
const element = fixture.nativeElement as HTMLElement;
@@ -267,12 +267,12 @@ describe('HuntPageComponent', () => {
it('shows a combat-start error and dismisses it', async () => {
const fixture = await setup(burnedRoad, threeEncounterHunt);
combatStore.error.set('Du befindest dich bereits in einem Kampf.');
combatStore.error.set("You're already in a combat.");
fixture.detectChanges();
const element = fixture.nativeElement as HTMLElement;
const alerts = Array.from(element.querySelectorAll('[role="alert"]'));
expect(alerts.some((alert) => alert.textContent?.includes('Du befindest dich bereits in einem Kampf.'))).toBe(
expect(alerts.some((alert) => alert.textContent?.includes("You're already in a combat."))).toBe(
true,
);
@@ -380,12 +380,12 @@ describe('HuntPageComponent', () => {
it('displays a hunting error and retries via startHunt when there is no current hunt', async () => {
const fixture = await setup(burnedRoad);
huntingStore.error.set('An diesem Ort gibt es keine Jagdgebiete.');
huntingStore.error.set("There's no hunting ground at this location.");
fixture.detectChanges();
const element = fixture.nativeElement as HTMLElement;
expect(element.querySelector('[role="alert"]')?.textContent).toContain(
'An diesem Ort gibt es keine Jagdgebiete.',
"There's no hunting ground at this location.",
);
element.querySelector<HTMLButtonElement>('[data-hunt-retry]')?.click();