目录

Resource

This module provides resource-related information, including the application bundle name, application module name, and resource ID.

The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.

Import a module.

import { resourceManager } from '@kit.LocalizationKit'

Resource

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Global.ResourceManager

Name Type Read-Only Optional Description
bundleName string No No Bundle name of the application.
moduleName string No No Application module name.
id number No No

Resource ID. The value ranges are as follows:

- Application resource range: [0x01000000, 0x06FFFFFF] and [0x08000000, 0xFFFFFFFF], indicating the resource ID of the application itself.

- System resource range: [0x07000000, 0x07FFFFFF], indicating the resource ID preset by the system.

params any[] No Yes Resource parameters, including the resource name (string type), the replacement values of the formatting API (string or number provided in the order of placeholders), and the quantifier of the plural API (number type, indicating the quantity). The replacement values of the formatting API are used for parameter substitution during string formatting, and the quantifier of the plural API is used to select the plural form in a multilingual environment.
type number No Yes

Resource type. The values are as follows:

- 10001: color

- 10002: float

- 10003: string

- 10004: plural

- 10005: boolean

- 10006: intarray

- 10007: integer

- 10008: pattern

- 10009: strarray

- 20000: media

- 30000: rawfile

- 40000: symbol