我正在尝试从 nsdate 对象获取本地化的工作日
+ (NSString *)localizedWeekdayForDate:(NSDate *)date
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSString *language = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0];
dateFormatter.dateFormat = [NSDateFormatter dateFormatFromTemplate:@"EEEE" options:0 locale:[NSLocale localeWithLocaleIdentifier:language]];
NSString *formattedDateString = [dateFormatter stringFromDate:date];
return formattedDateString;
}
语言字符串总是“en”......即使你的设备语言不是英语......我试过 [NSLocale currentLocale]; 以及preferedLanguages ...这也不起作用..
有什么建议么?