mirror of
https://gitee.com/openharmony/global_resource_management
synced 2024-10-06 21:43:49 +00:00
|
||
---|---|---|
dfx/hisysevent_adapter | ||
frameworks/resmgr | ||
interfaces | ||
test | ||
.gitattributes | ||
bundle.json | ||
hisysevent.yaml | ||
LICENSE | ||
OAT.xml | ||
README_zh.md | ||
README.md | ||
resmgr.gni |
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