The resource management module provides APIs to obtain information about the current device configuration (including the language, region, screen direction, and MCC/MNC) and device capability (including the device type and resolution).
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
...
@@ -12,9 +13,9 @@ The resource management module provides APIs to obtain information about the cur
import resourceManager from '@ohos.resourceManager';
```
## Usage
## How to Use
Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its APIs without first importing the required bundle. This method, however, is not applicable to the FA model.
Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This method, however, is not applicable to the FA model.
Obtains the **ResourceManager** object of an application based on the specified bundle name. This API uses an asynchronous callback to return the result.
| bundleName | string | Bundle name of the application.|
| moduleName | string | Module name of the application. |
| id | number | Resource ID. |
## ResourceManager
Defines the capability of accessing application resources.
> **NOTE**<br>
> **NOTE**
>
> - The methods involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm.
>
> - Resource files are defined in the **resources** directory of the project. You can obtain the resource ID using **$r(resource address).id**, for example, **$r('app.string.test').id**.
...
...
@@ -261,7 +275,7 @@ Obtains the string corresponding to the specified resource ID. This API uses an
Obtains the specified number of singular-plural strings corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses an asynchronous callback to return the result.
Obtains the specified number of singular-plural strings corresponding to the specified resource ID. This API uses a promise to return the result.
Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses a promise to return the result.
Obtains the singular-plural string corresponding to the specified resource object based on the specified number. This API uses an asynchronous callback to return the result.
Obtains the singular-plural string corresponding to the specified resource object based on the specified number. This API uses a promise to return the result.
Obtains the plural string corresponding to the specified resource name. This API uses an asynchronous callback to return the result.
Obtains the plural string corresponding to the specified resource name based on the specified number. This API uses an asynchronous callback to return the result.