Skip to content

Commit

Permalink
Map: Use localized names (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
amenk authored Oct 7, 2024
1 parent 023f9c5 commit d36528f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@mui/material-nextjs": "^5.16.6",
"@openstreetmap/id-tagging-schema": "^6.7.3",
"@sentry/nextjs": "^8",
"@teritorio/openmaptiles-gl-language": "^1.5.4",
"@xmldom/xmldom": "^0.8.10",
"accept-language-parser": "^1.5.0",
"autosuggest-highlight": "^3.3.4",
Expand Down
7 changes: 7 additions & 0 deletions src/components/Map/behaviour/useUpdateStyle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-param-reassign */
import type { GeoJSONSource, Map } from 'maplibre-gl';
import { OpenMapTilesLanguage } from '@teritorio/openmaptiles-gl-language';
import cloneDeep from 'lodash/cloneDeep';
import type { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
import { createMapEffectHook } from '../../helpers';
Expand All @@ -15,6 +16,7 @@ import {
} from '../styles/layers/climbingLayers';
import { EMPTY_GEOJSON_SOURCE, OSMAPP_SPRITE } from '../consts';
import { fetchCrags } from '../../../services/fetchCrags';
import { intl } from '../../../services/intl';
import { Layer } from '../../utils/MapStateContext';
import { setUpHover } from './featureHover';
import { layersWithOsmId } from '../helpers';
Expand Down Expand Up @@ -88,6 +90,11 @@ export const useUpdateStyle = createMapEffectHook(
addOverlaysToStyle(map, style, overlays);
map.setStyle(style, { diff: mapLoaded });

const languageControl = new OpenMapTilesLanguage({
defaultLanguage: intl.lang,
});
map.addControl(languageControl);

setUpHover(map, layersWithOsmId(style));
},
);
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,11 @@
"@swc/counter" "^0.1.3"
tslib "^2.4.0"

"@teritorio/openmaptiles-gl-language@^1.5.4":
version "1.5.4"
resolved "https://registry.yarnpkg.com/@teritorio/openmaptiles-gl-language/-/openmaptiles-gl-language-1.5.4.tgz#4959c78c0e7f9845746dbc414d431cd95655db2f"
integrity sha512-S4kXGBBSMzX4fDrmcUdPSLBNBaIUUPihuQWeaLmNXniJbNsHOppo1NtZXlivzvvl874KCmN7+UWr4q2W2l/JaA==

"@tootallnate/once@2":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf"
Expand Down

0 comments on commit d36528f

Please sign in to comment.