The NokiaMaps API for JavaScript supports localization in the following languages:
| Locale ID | Description | Comment |
|---|---|---|
| en-GB | English as spoken in Great Britain | |
| en-US | English as spoken in the USA | default language |
| de-DE | German as spoken in Germany | |
| fr-FR | French as spoken in France | |
| es-ES | Spanish as spoken in Spain | |
| it-IT | Italian as spoken in Italy | |
| ru-RU | Russian as spoken in Russia | |
| zh-CN | Simplified Chinese |
Please note that the list of supported languages is under constant revision and Nokia reserves the right to alter the list without notice.
By default, the language of the maps displayed using this API is defined by the browser's language preferences. You can override this behavior to meet specific requirements by calling the method set() on the static class Settings before you initialize the map (otherwise the attempt to set the language has no effect). The first argument to set() is the name of the property you wish to change, in this case "defaultLanguage". The second argument is the value of the property. The following example sets the default language to German spoken in Germany by calling the method set() on the class Settings:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7;
IE=EmulateIE9" />
<script type="text/javascript"
src="http://api.maps.nokia.com/2.2.4/jsl.js"></script>
</head>
<body>
<div id="mapContainer" style="width:600px;
height:400px;"></div>
<script type="text/javascript">
nokia.Settings.set("defaultLanguage",
"de-DE");
var map = new nokia.maps.map.Display(
document.getElementById("mapContainer"),
{
components: [
new nokia.maps.map.component.ZoomBar(),
new nokia.maps.map.component.TypeSelector()],
zoomLevel: 2,
center: [40.83, 28.98]
});
</script>
</body>
</html>
Note that if you set the locale to an unsupported language, the API automatically attempts to use the closest supported alternative or the default language for the API ("en-US"). For example, if you set "language" to "fr-BE" (French as spoken in Belgium), the map text is automatically displayed in French as spoken in France ("fr-FR").