• 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: Human readable locale names.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Human readable locale names.


  • Subject: Re: Human readable locale names.
  • From: Óscar Morales Vivó <email@hidden>
  • Date: Thu, 18 Aug 2005 17:44:28 -0400

Thanks a lot, that's just what I needed!

On Aug 18, 2005, at 17:25 , mmalcolm crawford wrote:


On 18 août 05, at 04:31, mmalcolm crawford wrote:


On 18 Aug 2005, at 04:01, mmalcolm crawford wrote:

The following works, although I'm not sure if it's the best way

Hmm, this may be better since it displays the result in the user's chosen language...


Thank you to Chris P. for pointing out there is a much easier way. Documentation enhancement request filed... <sigh>


NSLocale * locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_GB"];
NSString * displayNameString = [locale displayNameForKey:NSLocaleIdentifier value:@"en_GB"];
NSLog(@"displayNameString (en_GB) en_GB: %@", displayNameString);
displayNameString = [locale displayNameForKey:NSLocaleIdentifier value:@"es_ES"];
NSLog(@"displayNameString (en_GB) es_ES: %@", displayNameString);
[locale release];


locale = [[NSLocale alloc] initWithLocaleIdentifier:@"es_ES"];
displayNameString = [locale displayNameForKey:NSLocaleIdentifier value:@"en_GB"];
NSLog(@"displayNameString (es_ES) en_GB: %@", displayNameString);
displayNameString = [locale displayNameForKey:NSLocaleIdentifier value:@"es_ES"];
NSLog(@"displayNameString (es_ES) es_ES: %@", displayNameString);



displayNameString (en_GB) en_GB: English (United Kingdom) displayNameString (en_GB) es_ES: Spanish (Spain) displayNameString (es_ES) en_GB: inglés (Reino Unido) displayNameString (es_ES) es_ES: español (España)


mmalc

_______________________________________________
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


_______________________________________________ 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
References: 
 >Human readable locale names. (From: Óscar Morales Vivó <email@hidden>)
 >Re: Human readable locale names. (From: mmalcolm crawford <email@hidden>)
 >Re: Human readable locale names. (From: mmalcolm crawford <email@hidden>)
 >Re: Human readable locale names. (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Human readable locale names.
  • Next by Date: Re: [Cocoadev] Problem becoming a good citizen and backwards compatible [solved]
  • Previous by thread: Re: Human readable locale names.
  • Next by thread: Document-WindowController release misorder
  • Index(es):
    • Date
    • Thread