Re: Country code or name
Re: Country code or name
- Subject: Re: Country code or name
- From: Tom Harrington <email@hidden>
- Date: Fri, 12 Sep 2003 16:06:09 -0600
On Friday, September 12, 2003, at 09:44 AM, Simon Stapleton wrote:
Well, I've been loking all over the place, but I can't seem to find
it. I need to be able to at least guess the current user's country
(not timezone, that's not specific enough, or language, that doesn't
work either). I'd like to avoid having to code this all up myself,
but can do if needs be.
The best I can do at the moment is to query NSTimeZone for the current
time zone setting and make a guess from there (as a part of initial
app setup, to provide a reasonable default) and then set a preference
in the app's domain. But it seems to me that there should be a better
way.
If the user has set the time zone using System Preferences, the
"closest city" should be a pretty good indicator. For example, if a
user clicks in western Europe, and then chooses Paris as the closest
city, the local time zone name is going to be "Europe/Paris", even
though other cities are actually in the same time zone (e.g. if they
chose Zurich, they'd be in the same time zone, but the zone name would
be "Europe/Zurich"). You'd have create some kind of lookup to turn
that into a country, but ultimately it's going to be more specific than
you suggest. Look in /usr/share/zoneinfo for defined zone names, or
just in System Preferences for what users get to choose from.
Barring a policy of requiring users to have USB-attached GPS units,
you're going to be relying on the user to specify the information
somewhere, directly or otherwise. Maybe it'd be best to just ask them.
--
Tom Harrington
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.