From ab9ca4220a3f1dc3f3e0b1d374299971fad018d4 Mon Sep 17 00:00:00 2001 From: Konstantinos Thermos Date: Thu, 6 Aug 2026 17:14:02 +0300 Subject: [PATCH] fix(atlas): translate unvisited country names via the locale resolver (#1798) --- client/src/pages/atlas/useAtlas.test.tsx | 22 ++++++++++++++++++++++ client/src/pages/atlas/useAtlas.ts | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/client/src/pages/atlas/useAtlas.test.tsx b/client/src/pages/atlas/useAtlas.test.tsx index 61bcb01d1..8fb0f016c 100644 --- a/client/src/pages/atlas/useAtlas.test.tsx +++ b/client/src/pages/atlas/useAtlas.test.tsx @@ -590,6 +590,28 @@ describe('useAtlas', () => { expect(atlas.confirmAction).toEqual({ type: 'choose', code: 'DE', name: 'Germany' }); }); + it('FE-HOOK-ATLAS-025b: an unvisited country is named by the locale resolver, not the English GeoJSON name (#1789)', async () => { + // GeoJSON only carries English names; marking an unvisited country must still use the + // account-language name, exactly as visited countries do. + await mountAtlas({ + geo: { + type: 'FeatureCollection', + features: [ + feature({ ISO_A2: 'FR', ADM0_A3: 'FRA', ISO_A3: 'FRA', NAME: 'France', ADMIN: 'France' }), + feature({ ISO_A2: 'DE', ADM0_A3: 'DEU', ISO_A3: 'DEU', NAME: 'GERMANY_EN_ONLY', ADMIN: 'GERMANY_EN_ONLY' }), + ], + }, + }); + await waitFor(() => expect(lf.geoJson.length).toBeGreaterThan(0)); + + const countryLayer = lf.geoJson[0] as MockGeoJson; + const de = countryLayer.entries.find((e) => (e.feature.properties as Record).ISO_A2 === 'DE'); + + act(() => de!.layer.handlers.click({})); + expect(atlas.confirmAction).toEqual({ type: 'choose', code: 'DE', name: atlas.resolveName('DE') }); + expect(atlas.confirmAction?.name).not.toBe('GERMANY_EN_ONLY'); + }); + it('FE-HOOK-ATLAS-026: plugin tint layers are drawn in their own pane and redrawn on theme change', async () => { await mountAtlas({ geo: geoCountries, diff --git a/client/src/pages/atlas/useAtlas.ts b/client/src/pages/atlas/useAtlas.ts index 47b3a5c5a..3ee6fd583 100644 --- a/client/src/pages/atlas/useAtlas.ts +++ b/client/src/pages/atlas/useAtlas.ts @@ -417,7 +417,7 @@ export function useAtlas() { const countryCode = a3ToA2Entry ? a3ToA2Entry[0] : (isoA2 && isoA2 !== '-99' ? isoA2 : null) if (countryCode && countryCode !== '-99') { country_layer_by_a2_ref.current[countryCode] = layer - const name = feature.properties?.NAME || feature.properties?.ADMIN || resolveName(countryCode) + const name = resolveName(countryCode) || feature.properties?.NAME || feature.properties?.ADMIN || countryCode layer.bindTooltip(`
${name}
`, { sticky: true, className: 'atlas-tooltip', direction: 'top', offset: [0, -10], opacity: 1 })