• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @system.configuration (Application Configuration)
2
3> **NOTE**<br>
4> - 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.
5>
6>
7> - 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.
8
9
10## Modules to Import
11
12
13```
14import configuration from '@system.configuration';
15```
16
17
18## configuration.getLocale
19
20static getLocale(): LocaleResponse
21
22Obtains the current locale of the application, which is the same as the system locale.
23
24**System capability**: SystemCapability.ArkUI.ArkUI.Lite
25
26**Return value**
27| Type           | Description           |
28| -------------- | ------------- |
29| LocaleResponse | Current locale information.|
30
31**Example**
32  ```
33  export default {
34    getLocale() {
35      const localeInfo = configuration.getLocale();
36      console.info(localeInfo.language);
37    }
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