Add a language control
Add a language control to change the map's language.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.smartmaps.cloud/packages/smartmaps/smartmaps-gl/v2/umd/smartmaps-gl.min.js"></script>
<style>
html,
body {
height: 100vh;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
const map = new smartmapsgl.Map({
apiKey: "INSERT API-KEY",
container: "map",
center: { lat: 49.02164948779226, lng: 8.439330018049352 },
zoom: 3,
style: smartmapsgl.MapStyle.AUTO,
// boolean | LanguageControlOptions
languageControl: {
// Specifies the default language for the control interface (e.g., 'de' for German).
controlLanguage: "de",
// List of all supported languages that can be selected through a drop-down menu.
// The user can choose from these languages.
selectedLanguages: ['de', 'en', 'fr', 'ja', 'es']
}
});
</script>
</body>
</html>