Go to file
openharmony_ci 6cd4630f63
!749 代码优化
Merge pull request !749 from liule/1121
2024-11-21 07:37:29 +00:00
dfx/hisysevent_adapter 修改资源id解析流程 2024-11-09 10:51:14 +08:00
frameworks/resmgr 代码优化 2024-11-21 11:26:44 +08:00
interfaces 更改ffi桥阶层代码资源id为uint32_t类型 2024-11-21 10:08:39 +08:00
test other_icons下图标支持缓存 2024-08-22 15:51:31 +08:00
.gitattributes update OpenHarmony 2.0 Canary 2021-06-02 02:18:47 +08:00
bundle.json broker整改 2024-08-08 11:35:07 +08:00
hisysevent.yaml hisysevent参数描述修改 2022-12-26 10:37:03 +08:00
LICENSE Optimize code 2022-03-12 16:06:24 +08:00
OAT.xml Optimize code 2022-03-12 16:06:24 +08:00
README_zh.md 将innerkits修改为inner_api 2022-05-07 11:50:26 +08:00
README.md 将innerkits修改为inner_api 2022-05-07 11:50:26 +08:00
resmgr.gni broker整改 2024-08-08 11:35:07 +08:00

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