Cocoa - Localized string from NSDate, NSCalendarDate...
Posted
by
SirRatty
on Stack Overflow
See other posts from Stack Overflow
or by SirRatty
Published on 2009-06-18T07:01:56Z
Indexed on
2011/01/09
23:53 UTC
Read the original article
Hit count: 229
I'm using NSDate to get a string such as "18 Jun 09", with code:
NSDate *theDate = [NSDate date];
NSString *dateString = [theDate descriptionWithCalendarFormat:@"%d %b %y"
timeZone:nil
locale: nil];
This works, but only results in an English output. I need the output to be localized in the user's default language.
Does Cocoa (Mac OS X 10.4, 10.5 in this case) provide a facility for this localization or do I have to manually localize for each case of day and & month names my self?
(I have provided a locale, but although that does provide a locale-specific ordering of the date, it does not appear to do any localization of day-month names.)
© Stack Overflow or respective owner