Providing resource loading| parsing| and reading capabilities | 提供资源加载、解析、读取的能力
| Files | Last commit | Last update |
|---|---|---|
| 1 year ago | ||
| 11 months ago | ||
| 10 months ago | ||
| 11 months ago | ||
| 5 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 1 year ago | ||
| 3 years ago | ||
| 1 year ago |
Resmgr
Introduction
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
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
Development language: JavaScript
Usage
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
Globalization subsystem
global_i18n_standard
global_resmgr_standard
Introduction
Providing resource loading| parsing| and reading capabilities | 提供资源加载、解析、读取的能力
Customize your domain