• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Country code or name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Country code or name


  • Subject: Re: Country code or name
  • From: Simon Stapleton <email@hidden>
  • Date: Sat, 13 Sep 2003 10:04:41 +0200

On Saturday, Sep 13, 2003, at 00:06 Europe/Paris, Tom Harrington wrote:

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.


Yeah, I figured that was what I was going to have to do. I just wondered if there was something somewhere that I'd missed.

Barring a policy of requiring users to have USB-attached GPS units,
Hah!

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.

Yep. Ask I will. It's already considered as a preference item for the app, All I really need to do is get the preference set up as part of initial app startup (hence the need for a 'reasonable guess' as to the country on startup

Thanks anyway.

And no, I don't use address book either, and I don't want to require my users to do so.

Simon

--
PGP Key Id : 0x50D0698D
--
If the answer isn't obvious, the question is a distraction. Go find an easier question.
_______________________________________________
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.
References: 
 >Re: Country code or name (From: Tom Harrington <email@hidden>)

  • Prev by Date: NSData to NSString following resourceDataDidBecomeAvailable:
  • Next by Date: EVERY SINGLE FREAKIN TIME!! (Was NSData to NSString following resourceDataDidBecomeAvailable:)
  • Previous by thread: Re: Country code or name
  • Next by thread: Re: Country code or name
  • Index(es):
    • Date
    • Thread