0
我使用ILGeoNames
作为搜索国家的地理编码服务,但它似乎不支持多种语言,我需要的是根据所选语言本地化搜索结果,例如阿拉伯语,法语,火鸡等......有没有办法做到这一点ILGeoNames
?如果没有,是否有另一个客观的c地理编码服务来做到这一点? 在此先感谢。ILGeoNames语言支持
我使用ILGeoNames
作为搜索国家的地理编码服务,但它似乎不支持多种语言,我需要的是根据所选语言本地化搜索结果,例如阿拉伯语,法语,火鸡等......有没有办法做到这一点ILGeoNames
?如果没有,是否有另一个客观的c地理编码服务来做到这一点? 在此先感谢。ILGeoNames语言支持
在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”,它正在正常工作。
干杯