Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4430b9c381
Fetching contributors…

Cannot retrieve contributors at this time

48 lines (40 sloc) 0.921 kb
//
// CountryDictionary.m
// AppSales
//
// Created by Ole Zorn on 25.07.11.
// Copyright 2011 omz:software. All rights reserved.
//
#import "CountryDictionary.h"
@implementation CountryDictionary
+ (id)sharedDictionary
{
static id sharedDictionary = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedDictionary = [[self alloc] init];
});
return sharedDictionary;
}
- (id)init
{
self = [super init];
if (self) {
countryNamesByISOCode = [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"country_names" ofType:@"plist"]];
}
return self;
}
- (NSString *)nameForCountryCode:(NSString *)countryCode
{
NSString *countryName = [countryNamesByISOCode objectForKey:[countryCode uppercaseString]];
if (countryName) {
return countryName;
}
return countryCode;
}
- (void)dealloc
{
[countryNamesByISOCode release];
[super dealloc];
}
@end
Jump to Line
Something went wrong with that request. Please try again.