Android纯数字多语言本地化,本地化处理 轻松支持多国语言

1.vc  --> windows

通过函数

GetSystemDefaultLCID();

GetSystemDefaultLanguageID();

可以获取系统的default language信息。

From MSDN:

The GetSystemDefaultLCID function retrieves the system default locale identifier.

LCID GetSystemDefaultLCID(void);

Parameters

This function has no parameters.

Return Values

The return value is the system default locale identifier.

Remarks

For more information about locale identifiers, see Locales.

Requirements

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.

GetSystemDefaultLangID

The GetSystemDefaultLangID function retrieves the language identifier of the system locale.

LANGID GetSystemDefaultLangID(void);

Parameters

This function has no parameters.

Return Values

The return value is the language identifier of the system locale.

Remarks

For more information about language identifiers, see Language Identifiers and Locale Information.

Requirements

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.

///

GetUserDefaultLCID

The GetUserDefaultLCID function retrieves the user defaultlocale identifier.

LCID GetUserDefaultLCID(void);

Parameters

This function has no parameters.

Return Values

The return value is the user defaultlocale identifier.

Remarks

On single-user systems, the return value is the same as that returned by GetSystemDefaultLCID.

For more information about locale identifiers, seeLocales.

/

GetUserDefaultLangID

The GetUserDefaultLangID function retrieves the language identifier of the current user locale.

LANGID GetUserDefaultLangID(void);

Parameters

This function has no parameters.

Return Values

The return value is the language identifier of the current user locale.

Remarks

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.

Requirements

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 http://blog.sina.com.cn/s/blog_65a8ab5d0101bi1l.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值