• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Application Configuration
2
3> **NOTE**
4> - 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.
5>
6> - 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.
7
8
9## Modules to Import
10
11
12```
13import configuration from '@system.configuration';
14```
15
16
17## configuration.getLocale
18
19static getLocale(): LocaleResponse
20
21Obtains the current locale of the application, which is the same as the system locale.
22
23**System capability**: SystemCapability.ArkUI.ArkUI.Lite
24
25**Return values**
26
27| Type | Description |
28| -------- | -------- |
29| LocaleResponse | Information about the current locale. |
30
31**Example**
32
33  ```
34  export default {
35    getLocale() {
36      const localeInfo = configuration.getLocale();
37      console.info(localeInfo.language);
38    }
39  }
40```
41
42## LocaleResponse
43
44Defines attributes of the current locale.
45
46**System capability**: SystemCapability.ArkUI.ArkUI.Lite
47
48| Name  | Type  | Readable  | Writable  | Description                                      |
49| ---- | ------ | ---- | ---- | ---------------------------------------- |
50| language | string | Yes   | No   | Language, for example, **zh**.|
51| countryOrRegion | string | Yes   | No   | Country or region, for example, **CN** or **US**.|
52| dir | string | Yes   | No   | Text layout direction. The value can be:<br>- **ltr**: from left to right<br>- **rtl**: from right to left|
53| 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.|
54