如何更改传单路由机的语言

问题描述 投票:0回答:1

我有本地的传单路由机(未从url加载),但是语言未正确加载。我必须包含文件吗?

包括我拥有的:

  • localization.js
  • leaflet-routing-machine.css
  • leaflet-routing-machine.min.js
  • leaflet.js
  • leaflet.css
  • Control.Geocoder.js

我的代码:

L.Routing.control({

  router: L.Routing.mapbox('my key'),

  language: 'nl',

  formatter:  new L.Routing.Formatter({
    language: 'nl'
  }),

  waypoints:coordinates,
  routeWhileDragging: true,

  createMarker: function(i, wp, nWps) {

  return L.marker(wp.latLng, {icon: greenIcon });

}

}).addTo(map);

错误:ReferenceError:模块未定义localization.js:112:2

网站:https://kunstgroepkolonieplasmolen.wiwitest.nl/atelierroute/

javascript jquery routing leaflet
1个回答
0
投票

尝试将angularization.js添加到angular.json文件中的其他脚本中,如下所示:

"scripts": [
              "node_modules/leaflet-routing-machine/src/localization.js" 
            ]

然后,

L.Routing.control({
/....// <-- your others option
  language: 'nl', // <-- for langage use just this

// you don't need to add formatter
  formatter:  new L.Routing.Formatter({
    language: 'nl'
  }),

}).addTo(map);
© www.soinside.com 2019 - 2024. All rights reserved.