Hi all,
I love this Localization in the JavaScript API, with the API automatically using the locale of the browser. So, in my case everything is showing in Dutch. Cool.
Now I have a little issue: I like my widgets to be collapsed, so I have put my Search widget within an Expand widget - see screen captures and code below.
The question is about localization when using the Expand widget: the expandTooltip defaults to "Expand" for English locale, whereas I want it to read "Search" or "Find address or place". I can modify the expandTooltip, but then I will loose the advantages of localization.
So, is there a way to replace the hard coded "Find address or place" with a string that will be localized?
expandTooltip: "Find address or place", // loss of localization :-(
Thanks in advance for your help,
Egge-Jan
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Map of the Netherlands</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.11/"></script>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map", "esri/views/MapView", "esri/geometry/Point", "esri/widgets/Home", "esri/widgets/Search", "esri/widgets/Expand"
], function(Map, MapView, Point, Home, Search, Expand) {
var map = new Map({basemap: {portalItem: {id: "7aea6fa913a94176a1074edb40690318"}}});
var rdOrigin = new Point({x: 155000, y: 463000, spatialReference: 28992});
var view = new MapView({spatialReference: 28992, map: map, container: "viewDiv", center: rdOrigin, zoom: 3});
var homeBtn = new Home({view: view});
view.ui.add(homeBtn, "top-left");
var searchWidget = new Search({container: document.createElement("div"), view: view});
searchWidgetExpand = new Expand({
expandIconClass: "esri-icon-search", // see https://developers.arcgis.com/javascript/latest/guide/esri-icon-font/
expandTooltip: "Find address or place", // optional, defaults to "Expand" for English locale
view: view,
content: searchWidget.domNode,
group: "top-right"
});
view.ui.add([searchWidgetExpand], "top-right");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>