Localized country name from iso country code

  • Hi,

    is there an easy way to get a localized country name from an ISO
    country code (with or without NSLocale)?

    example (User uses German):
    "DE" --> "Deutschland"
    "FR" --> "Frankreich"

    example (User uses French):
    "DE" --> "Allemagne"
    "FR" --> "France"

    Roddi
  • On Nov 1, 2007, at 1:36 PM, Ruotger Skupin wrote:

    > Hi,
    >
    > is there an easy way to get a localized country name from an ISO
    > country code (with or without NSLocale)?
    >
    > example (User uses German):
    > "DE" --> "Deutschland"
    > "FR" --> "Frankreich"
    >
    > example (User uses French):
    > "DE" --> "Allemagne"
    > "FR" --> "France"

    Yes, there is.

    Look in /System/Library/PrivateFrameworks/IntlPreferences.framework/
    Resources

    In each .lproj language folder, you should find the
    LocalizedLanguage.strings file.

    The format may look strange but you can open the file as a NSDictionary.

    The /System/Library/PrivateFrameworks/IntlPreferences.framework/
    ResourcesLanguage.strings file could also be of some interest.
  • On Nov 1, 2007, at 5:59 AM, Stephane Sudre wrote:
    >> is there an easy way to get a localized country name from an ISO
    >> country code (with or without NSLocale)?
    > Yes, there is.
    > Look in /System/Library/PrivateFrameworks/IntlPreferences.framework/
    > Resources
    > In each .lproj language folder, you should find the
    > LocalizedLanguage.strings file.
    > The format may look strange but you can open the file as a
    > NSDictionary.
    > The /System/Library/PrivateFrameworks/IntlPreferences.framework/
    > ResourcesLanguage.strings file could also be of some interest.
    >
    Don't do this.
    Use NSLocale -- displayNameForKey:value:
    <http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes
    /NSLocale_Class/Reference/Reference.html#//apple_ref/occ/instm/NSLocale/dis
    playNameForKey:value:
    >

    myLocale = [NSLocale currentLocale];
    NSString *countryCode = @"GB";
    NSString *loalisedCountryName = [myLocale
    displayNameForKey:NSLocaleCountryCode value:countryCode];

    mmalc
  • On jeudi, novembre 1, 2007, at 06:41  PM, mmalc crawford wrote:

    >
    > On Nov 1, 2007, at 5:59 AM, Stephane Sudre wrote:
    >>> is there an easy way to get a localized country name from an ISO
    >>> country code (with or without NSLocale)?
    >> Yes, there is.
    >> Look in
    >> /System/Library/PrivateFrameworks/IntlPreferences.framework/Resources
    >> In each .lproj language folder, you should find the
    >> LocalizedLanguage.strings file.
    >> The format may look strange but you can open the file as a
    >> NSDictionary.
    >> The
    >> /System/Library/PrivateFrameworks/IntlPreferences.framework/
    >> ResourcesLanguage.strings file could also be of some interest.
    >>
    > Don't do this.
    > Use NSLocale -- displayNameForKey:value:
    > <http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
    > Classes/NSLocale_Class/Reference/Reference.html#//apple_ref/occ/instm/
    > NSLocale/displayNameForKey:value:>
    >
    > myLocale = [NSLocale currentLocale];
    > NSString *countryCode = @"GB";
    > NSString *loalisedCountryName = [myLocale
    > displayNameForKey:NSLocaleCountryCode value:countryCode];

    Well, if you're running on 10.4, sure. But if you're not?
  • On Nov 1, 2007, at 12:11 PM, St├ęphane Sudre wrote:

    > On jeudi, novembre 1, 2007, at 06:41  PM, mmalc crawford wrote:
    >>
    >> On Nov 1, 2007, at 5:59 AM, Stephane Sudre wrote:
    >>>> is there an easy way to get a localized country name from an ISO
    >>>> country code (with or without NSLocale)?
    >>>
    >> Don't do this.
    >> Use NSLocale -- displayNameForKey:value:
    >>
    > Well, if you're running on 10.4, sure. But if you're not?
    >
    Oh, I read "with or without NSLocale" as meaning "I don't mind if I
    use NSLocale or not"...

    Prior to 10.4, I think you can battle your way through Locale
    Utilities <http://developer.apple.com/documentation/Carbon/Reference/Locale_Utilities/
    index.html
    >.  It's not necessarily straightforward, though...

    mmalc
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today