• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 资源管理组件<a name="ZH-CN_TOPIC_0000001162518223"></a>
2
3-   [简介](#section11660541593)
4-   [目录](#section1464106163817)
5-   [约束](#section1718733212019)
6-   [说明](#section894511013511)
7-   [相关仓](#section15583142420413)
8
9## 简介<a name="section11660541593"></a>
10
11**资源管理组件**为应用提供加载多语言界面资源的能力,如不同语言下提供不同的应用名称或图标等。
12
13## 目录<a name="section1464106163817"></a>
14
15资源管理组件源代码目录结构如下所示:
16
17```
18/base/global/
19├── resource_management     # 资源管理代码仓
20│   ├── frameworks          # 资源管理核心代码
21│   │   ├── resmgr          # 资源解析核心代码
22│   │   │   ├── include     # 资源管理头文件
23│   │   │   ├── src         # 资源管理实现代码
24│   │   │   └── test        # 资源管理测试代码
25│   ├── interfaces          # 资源管理接口
26│   │   ├── inner_api       # 资源管理对子系统间接口
27│   │   └── js              # 资源管理JavaScript接口
28```
29
30## 约束<a name="section1718733212019"></a>
31
32**语言限制**:JavaScript语言
33
34## 说明<a name="section894511013511"></a>
35
36调用  **getString **接口获取应用的资源信息 。
37
38```
39import resmgr from '@ohos.resmgr'
40.....
41    resmgr.getResourceManager((error,mgr) => {
42        // callback
43        mgr.getString(0x1000000, (error, value) => {
44            if (error != null) {
45                console.log(error);
46            } else {
47                console.log(value);
48            }
49        });
50
51        // promise
52        mgr.getString(0x1000000).then(value => {
53            console.log(value);
54        }).catch(error => {
55            console.log("getstring promise " + error);
56        });
57    });
58```
59
60## 相关仓<a name="section15583142420413"></a>
61
62全球化子系统
63
64global\_i18n\_standard
65
66**global\_resmgr\_standard**
67
68