views:

195

answers:

2

Hi y'all!

I have an app that deals with currency, but obviously I'd like it to be multilingual. Where do I go about finding the value of what the user's default currency is? I presume it's as easy as a line or two of code, but I may be wrong...

Jack

+4  A: 

Have you looked at NSLocale#objectForKey: ?

St3fan
+1 I'd never heard about `NSLocale` until I read your answer. This is a much better solution than my suggestion!
Dave DeLong
Specifically, he'll want the objects returned for the NSLocaleCurrencySymbol and NSLocaleCurrencyCode keys.
Brad Larson
+1  A: 

[NSUserDefaults standardUserDefaults] probably has some useful information. Try dumping that entire thing and see if you can find what you're looking for.

NSArray * domains = [[NSUserDefaults standardUserDefaults] persistentDomainNames];
for (NSString * domain in domains) {
    NSDictionary * dict = [[NSUserDefaults standardUserDefaults] persistentDomainForName:domain];
    NSLog(@"%@ => %@", domain, dict);
}
Dave DeLong