mirror of
https://gitee.com/openharmony/global_resource_management
synced 2024-10-07 14:03:30 +00:00
3ed921c45a
Signed-off-by: huangjie <huangjie125@huawei.com>
68 lines
2.0 KiB
Markdown
68 lines
2.0 KiB
Markdown
# Resmgr<a name="EN-US_TOPIC_0000001162518223"></a>
|
|
|
|
- [Introduction](#section11660541593)
|
|
- [Directory Structure](#section1464106163817)
|
|
- [Constraints](#section1718733212019)
|
|
- [Usage](#section894511013511)
|
|
- [Repositories Involved](#section15583142420413)
|
|
|
|
## Introduction<a name="section11660541593"></a>
|
|
|
|
The resource management module, namely, Resmgr, provides the function of loading multi-language GUI resources for applications, for example, displaying the application names or icons specific to a certain language.
|
|
|
|
## Directory Structure<a name="section1464106163817"></a>
|
|
|
|
The directory structure of the Resmgr module is as follows:
|
|
|
|
```
|
|
/base/global/
|
|
├── resource_management # Code repository for the Resmgr module
|
|
│ ├── frameworks # Core code
|
|
│ │ ├── resmgr # Resource parsing code
|
|
│ │ │ ├── include # Header files
|
|
│ │ │ ├── src # Implementation code
|
|
│ │ │ └── test # Test code
|
|
│ ├── interfaces # APIs
|
|
│ │ ├── inner_api # APIs for internal subsystems
|
|
│ │ └── js # JavaScript APIs
|
|
```
|
|
|
|
## Constraints<a name="section1718733212019"></a>
|
|
|
|
**Development language**: JavaScript
|
|
|
|
## Usage<a name="section894511013511"></a>
|
|
|
|
Call the **getString** API to obtain the resource information of the application.
|
|
|
|
```
|
|
import resmgr from '@ohos.resmgr'
|
|
.....
|
|
resmgr.getResourceManager((error,mgr) => {
|
|
// callback
|
|
mgr.getString(0x1000000, (error, value) => {
|
|
if (error != null) {
|
|
console.log(error);
|
|
} else {
|
|
console.log(value);
|
|
}
|
|
});
|
|
|
|
// promise
|
|
mgr.getString(0x1000000).then(value => {
|
|
console.log(value);
|
|
}).catch(error => {
|
|
console.log("getstring promise " + error);
|
|
});
|
|
});
|
|
```
|
|
|
|
## Repositories Involved<a name="section15583142420413"></a>
|
|
|
|
Globalization subsystem
|
|
|
|
global\_i18n\_standard
|
|
|
|
**global\_resmgr\_standard**
|
|
|