Date iPhone was shown using the user's locale, but in a different language

Is there any solution for displaying a date to a user using his locale settings, but should the words be in another language?

I want to show the user who set ru_US the date in German (names of the months, for example, days of the week).

+5
source share
2 answers
Good question. Perhaps if you first create a NSDateFormatteruser locale (by default), set its style, and then save the current date format. After that, set the locale to the language you want to display, and reset the date format:
NSDateFormatter *df = [[[NSDateFormatter alloc] init] autorelease];
[df setDateStyle:NSDateFormatterFullStyle];
NSString *usersDateFormat = [df dateFormat];
[df setLocale:[[[NSLocale alloc] initWithLocaleIdentifier(@"de_DE")] autorelease]];
[df setDateFormat:usersDateFormat];
NSString *dateString = [df stringFromDate:[NSDate date]];
+5

All Articles