Skip to content

feat:add map language control#385

Open
rohhann12 wants to merge 1 commit intovalhalla:masterfrom
rohhann12:feat-language-support-maps-clean
Open

feat:add map language control#385
rohhann12 wants to merge 1 commit intovalhalla:masterfrom
rohhann12:feat-language-support-maps-clean

Conversation

@rohhann12
Copy link

Starting Step to close #384

🛠️ Fixes Issue

The issue was the map would show the names of the countries in the format of their own local language (eg- middle eastern countries name would be shown in arabic).

👨‍💻 Changes proposed

-src/components/map/index.tsx
-src/components/map/map-language-control.tsx

📄 Note to reviewers

Approach:
The Shortbread OSM vector tiles use text-field: "{name}" on all symbol layers for label rendering. The tiles also provide name_en and name_de as alternative name properties.
I added a MapLanguageControl component that:

  1. Iterates over all symbol layers in the current map style
  2. Swaps the text-field layout property between {name}, {name_en}, or {name_de} based on user selection
  3. Persists the choice in localStorage so it survives page reloads and style switches (restored via onLoad and onStyleData events)
    Currently limited to 3 languages since that's all Shortbread tiles support. This can be extended once we move to Maptiler tiles which offer broader language coverage.

📷 Screenshots

Screen.Recording.2026-03-18.at.6.55.27.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

i18n: Show English names for country labels on the map

1 participant