The problem is that when I load Map with one language and want it to be changed to another language. I tried to achieve it this way:
- map.dispose()
- add
<script/>
with setLang and setMkt - create map again
but that way not works... it simply loads my local language.
Workable Decision:
let map = new Microsoft.Maps.Map(el, {credentials: key});
// remove map
map.dispose();
// create script and insert it
let script = document.createElement('script');
window.GetMap = function() {
delete window.GetMap;
// 1. remove script tag
// 2. Now we create map again when script was loaded
map = new Microsoft.Maps.Map(el, {credentials: key});
}
// NOTICE: we set language AND user location both
script.src = "https://www.bing.com/api/maps/mapcontrol?callback=GetMap&setLang=zh&UR=CN";
document.head.append(script);