1 Star 0 Fork 5.3K

OpenHarmony-build / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
js-apis-basic-features-configuration.md 4.25 KB
一键复制 编辑 原始数据 按行查看 历史
zengyawen 提交于 2021-11-10 20:02 . add arkui

应用配置

导入模块

import configuration from '@system.configuration';

权限列表

configuration.getLocale

getLocale(): <LocaleResponse>

获取应用当前的语言和地区。默认与系统的语言和地区同步。

  • 返回值

    表 1 LocaleResponse

    参数名

    类型

    说明

    language

    string

    语言。例如:zh。

    countryOrRegion

    string

    国家或地区。例如:CN。

    dir

    string

    文字布局方向。取值范围:

    • ltr:从左到右;
    • rtl:从右到左。

    unicodeSetting5+

    string

    语言环境定义的Unicode语言环境键集,如果此语言环境没有特定键集,则返回空集。

    例如:{"nu":"arab"},表示当前环境下的数字采用阿拉伯语的数字。

  • 示例

    
    const localeInfo = configuration.getLocale();
    console.info(localeInfo.language);
1
https://gitee.com/openharmony-build/docs.git
git@gitee.com:openharmony-build/docs.git
openharmony-build
docs
docs
master

搜索帮助