Namespace: Lang

Lang

国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。

Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js"></script>
<script>
  const result = mapboxgl.supermap.Lang.getCode();

  // 弃用的写法
  const result = SuperMap.Lang.getCode();

</script>

// ES6 Import
import { Lang } from '@supermapgis/iclient-mapboxgl';

const result = Lang.getCode();

Members

codestring

当前所使用的语言类型。

defaultCodestring

默认使用的语言类型。

Default Value:
'en-US'

Methods

getCode(){string}

common/lang/Lang.js, line 45

获取当前的语言代码。

Returns:
Type Description
string 当前的语言代码。

getLanguageFromCookie()

common/lang/Lang.js, line 81

从 cookie 中获取语言类型。

i18n(key){string}

common/lang/Lang.js, line 100

从当前语言字符串的字典查找 key。

Name Type Description
key string

字典中 i18n 字符串值的关键字。

Returns:
Type Description
string 国际化的字符串。

setCode(code)

common/lang/Lang.js, line 57

设置语言代码。

Name Type Description
code string

此参数遵循IETF规范。