【问题标题】:Change language or content of Mapbox cooperative Gestures overlay更改 Mapbox 协作手势覆盖的语言或内容
【发布时间】:2022-07-01 19:34:46
【问题描述】:

我正在使用 mapbox 中的“滚动时禁用缩放”选项和合作手势 parameter,效果很好。

由于我正在处理多语言页面,因此我正在尝试更改滚动窗口时显示的覆盖文本。

是否有自动翻译的方式,还是可以手动翻译?

【问题讨论】:

    标签: mapbox


    【解决方案1】:

    使用 locale 属性:

    const map = new mapboxgl.Map({
      container: "map",
      style: "mapbox://styles/mapbox/streets-v11",
      center: [-74.5, 40],
      zoom: 9,
      locale: {
        "ScrollZoomBlocker.CtrlMessage": "Use ctrl + scroll to zoom the map",
        "ScrollZoomBlocker.CmdMessage": "Use ⌘ + scroll to zoom the map"
      },
    });
    

    可翻译参数的完整列表:

    
    const map = new mapboxgl.Map({
      container: "map",
      style: "mapbox://styles/mapbox/streets-v11",
      center: [-74.5, 40],
      zoom: 9,
      locale: {
        "AttributionControl.ToggleAttribution": "Toggle attribution",
        "AttributionControl.MapFeedback": "Map feedback",
        "FullscreenControl.Enter": "Enter fullscreen",
        "FullscreenControl.Exit": "Exit fullscreen",
        "GeolocateControl.FindMyLocation": "Find my location",
        "GeolocateControl.LocationNotAvailable": "Location not available",
        "LogoControl.Title": "Mapbox logo",
        "Map.Title": "Map",
        "NavigationControl.ResetBearing": "Reset bearing to north",
        "NavigationControl.ZoomIn": "Zoom in",
        "NavigationControl.ZoomOut": "Zoom out",
        "ScrollZoomBlocker.CtrlMessage": "Use ctrl + scroll to zoom the map",
        "ScrollZoomBlocker.CmdMessage": "Use ⌘ + scroll to zoom the map",
        "TouchPanBlocker.Message": "Use two fingers to move the map",
      },
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多