Skip to content

Add support for right-to-left scripts

Use the mapbox-gl-rtl-text plugin to support right-to-left languages such as Arabic and Hebrew.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Add support for right-to-left scripts</title>
    <meta property="og:description" content="Use the mapbox-gl-rtl-text plugin to support right-to-left languages such as Arabic and Hebrew." />
    <meta charset='utf-8'>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/trackasia-gl.css" />
    <script src="https://unpkg.com/[email protected]/dist/trackasia-gl.js"></script>
    <style>
        body { margin: 0; padding: 0; }
        html, body, #map { height: 100%; }
    </style>
</head>
<body>
    <div id="map"></div>

<script>
    trackasiagl.setRTLTextPlugin(
        'https://unpkg.com/@mapbox/[email protected]/dist/mapbox-gl-rtl-text.js',
        true // Lazy load the plugin
    );

    const map = new trackasiagl.Map({
        container: 'map',
        style: 'https://maps.track-asia.com/styles/v2/streets.json?key=public_key',
        center: [44.3763, 33.2788],
        zoom: 5
    });
</script>

</body>
</html>