switch to English map labels?



  • Is it possible in js to change language of map labels (city names)to English?
    I found bool settings value 'englishLabels', but I don't know how to change it and reload the map.



  • I haven't also figured out how to change several settings.

    Something is possible to change with default settings panel:

    W.broadcast.emit("rqstOpen", "settings", true)

    But it is not possible to change all settings there. I had problem with changing "numDirection" (displaying directions in degrees instead of string)
    settingsChanged event will be fired, but can't see changes.



  • I've investigated a little more and found that W.settings.set("englishLabels", true)
    actually don't change settings value in API version.

    W.settings is using W.storage which in API version store nothing:

    W.define("storage", ["http", "rootScope"], function(a, b) {
    .............
    return {
    put: emptyFun,
    get: emptyFun,
    remove: emptyFun,
    getFile: c
    }
    })



  • I've found only this dirty solution:

    c = W.settings;
    h = W.maps;
    a = W.rootScope;
    if(h.labelsLayer)
    {
    h.removeLayer(h.labelsLayer);
    h.labelsLayer = L.tileLayer(a.tileServer + "v7/labels-7.1/labels" /+ (c.get("englishLabels") ? "" : "-loc")/ + (a.isRetina ? "-retina" : "") + "/{z}/{x}/{y}.jpg", {
    maxZoom: 11,
    updateWhenIdle: !0
    }).addTo(h);
    h.labelsLayer.getContainer().classList.add("labels-layer");
    }



  • correct code ( + (c.get("englishLabels") ? "" : "-loc") should be commented out)

    c = W.settings;
    h = W.maps;
    a = W.rootScope;
    if(h.labelsLayer)
    {
    h.removeLayer(h.labelsLayer);
    h.labelsLayer = L.tileLayer(a.tileServer + "v7/labels-7.1/labels" + (a.isRetina ? "-retina" : "") + "/{z}/{x}/{y}.jpg", {
    maxZoom: 11,
    updateWhenIdle: !0
    }).addTo(h);
    h.labelsLayer.getContainer().classList.add("labels-layer");
    }


Log in to reply
 

Windyty, S.E. - all rights reserved. Powered by excellent NodeBB
NodeBB & contributors, OSM & contributors, HERE maps

Looks like your connection to Windy Community was lost, please wait while we try to reconnect.