Skip to content

Commit

Permalink
Support RTL languages on map
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed May 12, 2024
1 parent b32a43a commit bac808e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@emotion/styled": "^11.11.5",
"@fontsource/roboto": "^5.0.12",
"@mapbox/mapbox-gl-draw": "^1.4.3",
"@mapbox/mapbox-gl-rtl-text": "^0.2.3",
"@maplibre/maplibre-gl-geocoder": "^1.5.0",
"@mui/icons-material": "^5.15.15",
"@mui/lab": "^5.0.0-alpha.170",
Expand Down
3 changes: 3 additions & 0 deletions src/map/core/MapView.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'maplibre-gl/dist/maplibre-gl.css';
import maplibregl from 'maplibre-gl';
import mapboxglRtlTextUrl from '@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.min.js?url'

Check warning on line 3 in src/map/core/MapView.jsx

View workflow job for this annotation

GitHub Actions / build

Unable to resolve path to module '@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.min.js?url'

Check failure on line 3 in src/map/core/MapView.jsx

View workflow job for this annotation

GitHub Actions / build

Unexpected use of file extension "js" for "@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.min.js?url"

Check failure on line 3 in src/map/core/MapView.jsx

View workflow job for this annotation

GitHub Actions / build

Missing semicolon
import React, {
useRef, useLayoutEffect, useEffect, useState,
} from 'react';
Expand All @@ -14,6 +15,8 @@ element.style.width = '100%';
element.style.height = '100%';
element.style.boxSizing = 'initial';

maplibregl.setRTLTextPlugin(mapboxglRtlTextUrl);

export const map = new maplibregl.Map({
container: element,
attributionControl: false,
Expand Down

0 comments on commit bac808e

Please sign in to comment.