Question

In particular I'm interested in shortStandaloneWeekdaySymbols. I'm using this code:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSArray *shortWeekdaySymbols = [dateFormatter shortStandaloneWeekdaySymbols];

But if iPhone region format is set to US but language to French/German/any other, NSDateFormatter returns English strings (mon tue ...). But I want to respect the language settings and get weekday names in the current language (standard Clock app does this for example). Is this possible?

The only way I can think of to do this would be to get the current user language (how?) and set locale on the date formatter to this language's region.

Was it helpful?

Solution

OTHER TIPS

The only way you can think of, "get the current user language (how?) and set locale on the date formatter to this language's region" is correct. This is how.

[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale preferredLanguages] objectAtIndex:0]] autorelease]];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top