NSDateFormatter stringFromDate does not match the language on user templates

What am I doing wrong?

I am trying to get an NSDateFormatter to translate custom date templates using the current locale.

Example:

    dateFormat = [[NSDateFormatter alloc] init];
    dateFormat.locale = [NSLocale currentLocale];
    [dateFormat setDateFormat:@"MMM"];
        output = [self.dateFormat stringFromDate:dateObject];

No matter what I change my current locale settings, I always see the abbreviations of the English month.

Thanks for any help you can provide.

+3
source share
1 answer

It seems like he worked all the time. I left my location in the United States and changed only the language. To make it work correctly, you must change the location as well as the language.

+6
source

Source: https://habr.com/ru/post/1774142/


All Articles