我使用ILGeoNames
作为地理编码服务来搜索国家/地区,但似乎它不支持多种语言,我需要的是根据所选择的本地化搜索结果语言,即阿拉伯语,法语,土耳其语......是否有ILGeoNames
的方法可以做到这一点?如果没有,那还有另一个客观的地理编码服务吗?
提前谢谢。
答案 0 :(得分:0)
在ILGeoNamesLookup.m中你有这个功能
- (void)search:(NSString*)query maxRows:(NSInteger)maxRows startRow:(NSUInteger)startRow language:(NSString*)langCode {
NSString *urlString;
// Sanitize parameters
if(!langCode) {
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSArray *localizations = [bundle preferredLocalizations];
if([localizations count])
langCode = [localizations objectAtIndex:0];
else
langCode = @"en";
}
if(maxRows > 1000)
maxRows = 1000;
// Request formatted according to http://www.geonames.org/export/geonames-search.html
NSString *escQuery = [query stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
urlString = [NSString stringWithFormat:kILGeoNamesSearchURL, escQuery, maxRows, startRow, langCode, userID];
[self sendRequestWithURLString:urlString];
}
如果您输入参数langCode,搜索将以您选择的语言返回。我试过" es"它正在运作。
干杯