Ios7 获取iOS中月份的本地化名称

Ios7 获取iOS中月份的本地化名称,ios7,localization,internationalization,nsdateformatter,Ios7,Localization,Internationalization,Nsdateformatter,我的iOS应用程序支持6种语言。现在我想显示本地化的月份名称 e.g. January in French will show "Janvier" 为此,在将日期从UTC转换为本地时区时,我有以下代码 -(NSString *)getLocalDateFromUTCFormattedDate:(NSString*)utcDate { NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSTi

我的iOS应用程序支持6种语言。现在我想显示本地化的月份名称

e.g. January in French will show "Janvier"
为此,在将日期从UTC转换为本地时区时,我有以下代码

    -(NSString *)getLocalDateFromUTCFormattedDate:(NSString*)utcDate
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSTimeZone *sourceTimeZone = [NSTimeZone timeZoneWithName:@"UTC"];
    [dateFormatter setTimeZone:sourceTimeZone];
    [dateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH:mm:ss'Z'"];
    NSDate *dateFromServer = [dateFormatter dateFromString:utcDate];

    // Now convert to local date
    dateFormatter.locale = [NSLocale systemLocale];
    [dateFormatter setDateFormat:@"dd MMMM yyyy"];
    NSTimeZone* localTimeZone = [NSTimeZone systemTimeZone];
    [dateFormatter setTimeZone:localTimeZone];
    NSString *localDate = [dateFormatter stringFromDate:dateFromServer];
    return localDate;
}
但即使我将语言改为法语/日语,月份名称仍然是英语。 我知道了,但我不想硬编码区域设置。所以我用了

dateFormatter.locale = [NSLocale systemLocale];
但是没有运气。有谁能告诉我这有什么问题吗?

也许这对你有帮助


我的应用程序支持的每种语言都有.strings文件。所以你的意思是我需要翻译每种语言的月份名称,对吗?iOS是否不会将月份名称更改为从iOS设置中选择的语言?