How to retrieve currencies list and associated information ?
29/04/06 21:33
Is it possible and how, to to retrieve the currencies list available in the International Preference pane ?
int main() {
NSLocale *locale;
[NSAutoreleasePool new];
locale = [NSLocale currentLocale];
NSLog(@"%@: '%@', '%@'", [locale localeIdentifier], [locale displayNameForKey:NSLocaleCurrencyCode value:@"USD"], [locale displayNameForKey: NSLocaleCurrencySymbol value:@"USD"]);
locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"de"] autorelease];
NSLog(@"%@: '%@', '%@'", [locale localeIdentifier], [locale displayNameForKey:NSLocaleCurrencyCode value:@"USD"], [locale displayNameForKey: NSLocaleCurrencySymbol value:@"USD"]);
locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"fr"] autorelease];
NSLog(@"%@: '%@', '%@'", [locale localeIdentifier], [locale displayNameForKey:NSLocaleCurrencyCode value:@"USD"], [locale displayNameForKey: NSLocaleCurrencySymbol value:@"USD"]);
return 0;
}
2006-04-29 09:28:00.664 locale[732] fr_BE: 'dollar des États-Unis', '$'
2006-04-29 09:28:00.679 locale[732] de: 'US Dollar', '$'
2006-04-29 09:28:00.679 locale[732] fr: 'dollar des États-Unis', '$'
2006-04-29 09:30:11.993 locale[749] Currency codes list (
ADD,
ADP,
AED,
AFA,
AFN,
AIF,
…
ZAL,
ZAP,
ZAR,
ZMK,
ZMP,
ZRN,
ZRZ,
ZWD
)
NSLocale *locale;
[NSAutoreleasePool new];
locale = [NSLocale currentLocale];
NSLog(@"%@: '%@', '%@'", [locale localeIdentifier], [locale displayNameForKey:NSLocaleCurrencyCode value:@"USD"], [locale displayNameForKey: NSLocaleCurrencySymbol value:@"USD"]);
locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"de"] autorelease];
NSLog(@"%@: '%@', '%@'", [locale localeIdentifier], [locale displayNameForKey:NSLocaleCurrencyCode value:@"USD"], [locale displayNameForKey: NSLocaleCurrencySymbol value:@"USD"]);
locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"fr"] autorelease];
NSLog(@"%@: '%@', '%@'", [locale localeIdentifier], [locale displayNameForKey:NSLocaleCurrencyCode value:@"USD"], [locale displayNameForKey: NSLocaleCurrencySymbol value:@"USD"]);
return 0;
}
2006-04-29 09:28:00.664 locale[732] fr_BE: 'dollar des États-Unis', '$'
2006-04-29 09:28:00.679 locale[732] de: 'US Dollar', '$'
2006-04-29 09:28:00.679 locale[732] fr: 'dollar des États-Unis', '$'
2006-04-29 09:30:11.993 locale[749] Currency codes list (
ADD,
ADP,
AED,
AFA,
AFN,
AIF,
…
ZAL,
ZAP,
ZAR,
ZMK,
ZMP,
ZRN,
ZRZ,
ZWD
)