如何更改GoogleMap上的语言? [英] How to change the language on GoogleMap?

查看:917
本文介绍了如何更改GoogleMap上的语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用Google Maps iOS SDK中的 GMSMapView
我可以在设置页面中更改应用程序语言。
如何在运行时更改地图上的语言?

我可以使用此方法重新加载或重新创建地图

 (void)prepareMap 
{
[self.viewForMap removeAllSubviews];
GMSCameraPosition * camera = [GMSCameraPosition cameraWithLatitude:纬度经度:经度];
GMSMapView * mapView = [GMSMapView mapWithFrame:rect camera:camera];
[self.viewForMap addSubview:mapView];
}


解决方案

Google Maps API - 如何让Google Maps API以英文以外的语言显示?


默认情况下,API将尝试根据用户位置或浏览器设置加载最合适的语言。有些API允许您在发出请求时明确设置语言。


从那里,您可以添加语言参数在一些Google Maps API中的HTTPS请求中。但是,对于一些不允许的API,您必须首先使用核心位置框架,正如在这篇SO文章中所建议的那样 - iphone默认地图应用以不同语言打开


I use GMSMapView from Google Maps iOS SDK in my application. I can change app language in settings page. How to change language on map in runtime?

I can reload or recreate map on this method

(void)prepareMap
{
    [self.viewForMap removeAllSubviews];
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:latitude longitude:longtitude];
    GMSMapView *mapView = [GMSMapView mapWithFrame:rect camera:camera];
    [self.viewForMap addSubview:mapView];
}

解决方案

As answered in Using the Google Maps APIs - How can I get the Google Maps APIs to display in a language other than English?:

By default the API will attempt to load the most appropriate language based on the users location or browser settings. Some APIs allow you to explicitly set a language when you make a request.

From there, you may add language parameter in your HTTPS request in some Google Maps APIs. However, for some APIs that doesn't allow this, you have to first determine the current location with the use of Core Location Framework as suggested in this SO post - iphone default map app open with different language.

这篇关于如何更改GoogleMap上的语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆