Showing posts with label systemLocale example. Show all posts
Showing posts with label systemLocale example. Show all posts

Saturday, May 11, 2013

NSLocale systemLocale example ios


systemLocale

Returns the “root”, canonical locale, that contains fixed “backstop” settings that provide values for otherwise undefined keys.
+ (id)systemLocale
Return Value of [NSLocale systemLocale]
The “root”, canonical locale, that contains fixed “backstop” settings that provide values for otherwise undefined keys.
Example of [NSLocale systemLocale]
NSLocale *locale;
locale = [NSLocale systemLocale];

NSString * localLanguage = [locale objectForKey:NSLocaleIdentifier];
NSLog (@"Language : %@", localLanguage); 

NSLog(@"System locale Identifier %@",[locale localeIdentifier]);
Example of [NSLocale systemLocale]
-(id)initEvent:(NSString*)eventStr details:(NSString*)detailsStr{
     this.eventString = [[NSMutableString alloc] initWithString:eventStr];
     this.detailsString = [[NSString alloc] initWithString:detailsStr];
     this.date =[[NSMutableString alloc] init];
     NSDate* currentDate = [NSDate date];    
     NSString *dateDescStr = [currentDate descriptionWithLocale:[NSLocale systemLocale]];
      [date appendString:dateDescStr];  
     [eventString release];
     [detailsString release];
     [date release];

    return [super init];
}