国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
Example
var zh = KQCommon.Lang["zh-CN"];
var en = KQCommon.Lang["en-US"];
zh['test_message'] = '测试消息!';
en['test_message'] = 'Test Message!';
KQCommon.Lang.setCode('zh');
alert('消息:' + KQCommon.Lang.i18n('test_message'));
KQCommon.Lang.setCode('en');
alert('msg:' + KQCommon.Lang.i18n('test_message'));
Members
-
KQCommon.Lang.codestring
-
当前所使用的语言类型。
-
KQCommon.Lang.defaultCodestring
-
默认使用的语言类型。
- Default Value: 'zh-CN'
Methods
-
KQCommon.Lang.getCode(){string}
common/lang/Lang.js, line 36 -
获取当前的语言代码。
Returns:
Type Description string 当前的语言代码。 -
KQCommon.Lang.getLanguageFromCookie()
common/lang/Lang.js, line 73 -
从 cookie 中获取语言类型。
-
KQCommon.Lang.i18n(key){string}
common/lang/Lang.js, line 92 -
从当前语言字符串的字典查找 key。
Name Type Description key
string 字典中 i18n 字符串值的关键字。
Returns:
Type Description string 国际化的字符串。 -
KQCommon.Lang.setCode(lang)
common/lang/Lang.js, line 48 -
设置语言代码。
Name Type Description lang
string 此参数遵循IETF规范。