1.vc --> windows
通过函数
GetSystemDefaultLCID();
GetSystemDefaultLanguageID();
可以获取系统的default language信息。
From MSDN:
The GetSystemDefaultLCID function retrieves the system default locale identifier.
LCID GetSystemDefaultLCID(void);
This function has no parameters.
The return value is the system default locale identifier.
For more information about locale identifiers, see Locales.
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winnls.h; include Windows.h.
Library: Use Kernel32.lib.
////////////////////////////////////////////////////////////////////////////////////////
The GetSystemDefaultLangID function retrieves the language identifier of the system locale.
LANGID GetSystemDefaultLangID(void);
This function has no parameters.
The return value is the language identifier of the system locale.
For more information about language identifiers, see Language Identifiers and Locale Information.
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winnls.h; include Windows.h.
Library: Use Kernel32.lib.
///////////////////////////////////////////////////////////////////////////////////////////
The GetUserDefaultLCID function retrieves the user defaultlocale identifier.
LCID GetUserDefaultLCID(void);
This function has no parameters.
The return value is the user defaultlocale identifier.
On single-user systems, the return value is the same as that returned by GetSystemDefaultLCID.
For more information about locale identifiers, see Locales.
/////////////////////////////////////////////////////////////
The GetUserDefaultLangID function retrieves the language identifier of the current user locale.
LANGID GetUserDefaultLangID(void);
This function has no parameters.
The return value is the language identifier of the current user locale.
The return value is not necessarily the same as that returned by GetSystemDefaultLangID, even if the computer is a single-user system.
For more information about language identifiers, see Language Identifiers and Locale Information.
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winnls.h; include Windows.h.
Library: Use Kernel32.lib.
具体使用可以参考:
void GetSystemLanguage()
{
LCID lcid = GetSystemDefaultLCID();
// or GetSystemDefaultLanguageID();
// or GetUserDefaultLCID();
// or GetUserDefaultLanguageID();
if(lcid == 0x0409)
{
AfxMessageBox(L"English_US");
}
if(lcid == 0x0404)
{
AfxMessageBox("中国繁体");
}
if(lcid == 0x0804)
{
AfxMessageBox("中国简体");
}
}
GetUserDefaultLCID(); // 一般同GetSystemDefaultLCID
GetUserDefaultLanguageID(); // 可以与GetSystemDefaultLanguageID返回不同值
IOS
- (void)getCurrentLanguage
{
NSArray *languages = [NSLocale preferredLanguages];
NSString *currentLanguage = [languages objectAtIndex:0];
DLog( @"%@" , currentLanguage);
}
本地化处理参考:
http://www.himigame.com/iphone-cocos2d/608.html