提交 6740239e 编写于 作者: S shawn_he

update docs

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 f403cb41
# Application Configuration # Application Configuration
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** > **NOTE**<br>
> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.i18n`](js-apis-i18n.md) and [`@ohos.intl`](js-apis-intl.md) instead. > - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.i18n`](js-apis-i18n.md) and [`@ohos.intl`](js-apis-intl.md) instead.
> >
> >
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -17,29 +17,37 @@ import configuration from '@system.configuration'; ...@@ -17,29 +17,37 @@ import configuration from '@system.configuration';
## configuration.getLocale ## configuration.getLocale
getLocale(): &lt;LocaleResponse&gt; static getLocale(): LocaleResponse
Obtains the current locale of the application, which is the same as the system locale. Obtains the current locale of the application, which is the same as the system locale.
**System capability**: SystemCapability.ArkUI.ArkUI.Lite **System capability**: SystemCapability.ArkUI.ArkUI.Lite
**Return values** **Return value**
**Table 1** LocaleResponse | Type | Description |
| -------------- | ------------- |
| Name | Type | Description | | LocaleResponse | Current locale information.|
| -------- | -------- | -------- |
| language | string | Current&nbsp;language&nbsp;of&nbsp;the&nbsp;application,&nbsp;for&nbsp;example,&nbsp;**zh**. |
| countryOrRegion | string | Country&nbsp;or&nbsp;region,&nbsp;for&nbsp;example,&nbsp;**CN**. |
| dir | string | Text&nbsp;layout&nbsp;direction.&nbsp;Available&nbsp;values&nbsp;are&nbsp;as&nbsp;follows:<br/>-&nbsp;**ltr**:&nbsp;The&nbsp;text&nbsp;direction&nbsp;is&nbsp;from&nbsp;left&nbsp;to&nbsp;right.<br/>-&nbsp;**rtl**:&nbsp;The&nbsp;text&nbsp;direction&nbsp;is&nbsp;from&nbsp;right&nbsp;to&nbsp;left. |
| unicodeSetting<sup>5+</sup> | string | Unicode&nbsp;key&nbsp;set&nbsp;determined&nbsp;by&nbsp;the&nbsp;locale.<br/>For&nbsp;example,&nbsp;**{"nu":"arab"}**&nbsp;indicates&nbsp;that&nbsp;the&nbsp;current&nbsp;locale&nbsp;uses&nbsp;Arabic&nbsp;numerals.<br/>If&nbsp;the&nbsp;current&nbsp;locale&nbsp;does&nbsp;not&nbsp;have&nbsp;a&nbsp;specific&nbsp;key&nbsp;set,&nbsp;an&nbsp;empty&nbsp;set&nbsp;is&nbsp;returned. |
**Example** **Example**
```
``` export default {
export default { getLocale() {
getLocale() { const localeInfo = configuration.getLocale();
const localeInfo = configuration.getLocale(); console.info(localeInfo.language);
console.info(localeInfo.language); }
} }
} ```
```
\ No newline at end of file
## LocaleResponse
Defines attributes of the current locale.
**System capability**: SystemCapability.ArkUI.ArkUI.Lite
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ---------------------------------------- |
| language | string | Yes | No | Language, for example, **zh**.|
| countryOrRegion | string | Yes | No | Country or region, for example, **CN** or **US**.|
| dir | string | Yes | No | Text layout direction. The value can be:<br>- **ltr**: from left to right<br>- **rtl**: from right to left|
| unicodeSetting<sup>5+</sup> | string | Yes | No | Unicode language key set determined by the locale. If current locale does not have a specific key set, an empty set is returned.<br>For example, **{"nu":"arab"}** indicates that current locale uses Arabic numerals.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册