Internationalized Dates
Internationalized Dates
- Subject: Internationalized Dates
- From: Seth Willits <email@hidden>
- Date: Tue, 31 Oct 2006 19:55:00 -0800
Hi,
I'm trying to have a date drawn in a format to fit the width of a
column in a table view. Drawing and determining which to use is
obviously easy, the question is, where the heck do you get the
formats from?
This works wonderfully for us American folk:
@"%A, %B %e, %Y, %I:%S %p";
@"%B %e, %Y, %I:%S %p";
@"%b %e, %Y, %I:%S %p";
@"%m/%d/%y, %I:%S %p";
@"%m/%d/%y";
But it sucks for internationals, obviously.
This I thought might be a decent approach:
[standardUserDefaults objectForKey:NSTimeDateFormatString];
[standardUserDefaults objectForKey:NSDateFormatString];
[standardUserDefaults objectForKey:NSShortTimeDateFormatString]
[standardUserDefaults objectForKey:NSShortDateFormatString];
But it's not much better. Who needs the time zone for something they
modified (NSTimeDateFormatString)? And there's no intermediary
between NSDateFormatString and NSShortXXXFormatString (iow, with
abbreviated months or days of the week etc).
So I'd much prefer to use the literals, but how would I handle
internationalizing them? I would localize the constant, but there are
no other localizations at the moment. I suppose I could just check
the locale and switch between the literals and the format from user
defaults.
What do you guys do?
--
Seth Willits
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden