//
// CCNSLocale.m
// CCFC
//
// Created by xichen on 11-12-27.
// Copyright 2011 ccteam. All rights reserved.
//
#import "CCNSLocale.h"
@implementation NSLocale(cc)
+ (NSString *)localeLanguageCode
{
NSLocale *currentLocale = [NSLocale currentLocale];
return [currentLocale objectForKey:NSLocaleLanguageCode];
}
+ (NSString *)localeCountryCode
{
NSLocale *currentLocale = [NSLocale currentLocale];
return [currentLocale objectForKey:NSLocaleCountryCode];
}
@end
可能有更新:
googlecode链接地址:http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCNSLocale.m
github地址:https://github.com/cxsjabc/iphone-common-codes-ccteam/tree/master/CCFC/files/CCNSLocale.m
本文介绍了一个Objective-C方法,用于从当前的NSLocale对象中获取语言和国家/地区的代码。这些方法通过调用NSLocale API并传入相应的键来实现。

被折叠的 条评论
为什么被折叠?



