iphone默认地图应用程序用不同的语言打开 [英] iphone default map app open with different language
问题描述
我已经成功打开了具有当前用户位置的Iphone默认应用程序,但是如果用户选择了不同的语言(例如,对于荷兰当前位置= Aktueller Ort),则当前位置和路由是完全错误的。
NSString * mystr = [[NSString alloc] initWithFormat:@http://maps.google.com/maps?saddr=Current+Location&daddr=Destination ]。
NSURL * myurl = [[NSURL alloc] initWithString:mystr];
[[UIApplication sharedApplication] openURL:myurl];
尽管我们可以检测当前的语言并使用switch case进行匹配,但是我们需要将当前位置翻译成所有支持的语言由iphone地图应用程序。
我尝试了 wiki链接参数,并发现 hl 参数,但不适用于我我认为我的应用参数的方法是错误或某事。 p>
那么即使用户选择了不同的语言,我如何打开地图应用程序与特定的修复语言呢?
thanx for任何帮助!
您可以通过核心位置框架获取当前用户位置,并将纬度和经度传递到Google地图网址。或者您可以检查当前的语言并翻译当前位置,并将其传递给url。
NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0];
I successfully open Iphone default app with current user location but if user has selected a different language (e.g.. for Dutch Current Location = Aktueller Ort) then current location and route is totally wrong.
NSString *mystr=[[NSString alloc] initWithFormat:@"http://maps.google.com/maps?saddr=Current+Location&daddr=Destination"];
NSURL *myurl=[[NSURL alloc] initWithString:mystr];
[[UIApplication sharedApplication] openURL:myurl];
Although we can detect current language and match using switch case but we need to translate "Current Location" to all supported languages by iphone map app.
I tried wiki link for parameters and found hl parameter but not worked for me I think method for apply parameter by me is wrong or something.
So how can I open map app with particular fix language like english even when user selected different language?
thanx for any help!
You can get the current user location by the Core Location Framework and pass latitude and longitude to the google maps url. Or you can check the current language and translate "Current Location" in a lot of lang and pass it to the url.
NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
这篇关于iphone默认地图应用程序用不同的语言打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!