首页 > 解决方案 > angular 5-在google mpas api中定义语言

问题描述

我正在使用本教程将谷歌地图添加到我的 Angular 5 项目中: https ://blog.cloudboost.io/integrating-google-maps-in-angular-5-ca5f68009f29

而且我不会在地图上定义一种希伯来语。但我找不到在哪里设置它。

我尝试这样:

var mapProp = {
  center: new google.maps.LatLng(32.084573, 34.802909),
  zoom: 18,
  language: "he",
  mapTypeId: google.maps.MapTypeId.ROADMAP
};

但它不起作用。有人知道在哪里设置语言吗?

谢谢!

标签: angulargoogle-maps

解决方案


您可以通过指向 api 的链接传递语言:

例如希伯来语:

<script 
  src="http://maps.google.com/maps/api/js?language=he&dir='rtl'"      
  type="text/javascript"></script> 

正如@mxr7350 的评论中提到的,请参阅此链接以获取更多信息:https ://developers.google.com/maps/documentation/javascript/examples/map-language

对于希伯来语,您可能还需要通过&dir='rtl',因为文本从右到左而不是从左到右


推荐阅读