1# Globalization Subsystem Changelog
2
3
4## cl.resourceManager.1 Change in the Meaning of the Return Value for the API Used to Obtain the rawfile Descriptor
5
6Changed the meaning of the return value for the API used to obtain the rawfile descriptor after the non-decompression feature is added in this version. The change in the meaning of the return value, namely, **descriptor: RawFileDescriptor {fd, offset, length}**, is described as follows:
7
8**Before change:**
9
10**fd**: file descriptor for accessing the rawfile.
11
12**offset**: offset for accessing the rawfile. In this case, the value is **0**.
13
14**length**: size of the rawfile to access.
15
16**After change:**
17
18**fd**: file descriptor for accessing the HAP where the rawfile is located.
19
20**offset**: offset of the accessed rawfile relative to the HAP.
21
22**length**: size of the rawfile to access.
23
24**Change Impact**
25
26In versions earlier than 4.0.2.2, the rawfile can be accessed only through **fd**. In version 4.0.2.2 or later, the rawfile can be accessed only through **{fd, offset, and length}**.
27
28**Key API/Component Changes**
29
30| **Original API**                           |
31| ----------------                         |
32| getRawFd(path: string, callback: AsyncCallback\<RawFileDescriptor>): void   |
33| getRawFd(path: string): Promise\<RawFileDescriptor>  |
34| getRawFileDescriptor(path: string, callback: AsyncCallback\<RawFileDescriptor>): void|
35| getRawFileDescriptor(path: string): Promise\<RawFileDescriptor>|
36||
37
38**Sample Code**
39
40The following is an example of calling the **getRawFd** API:
41```
42try {
43    this.context.resourceManager.getRawFd("test.ogg", (error, value) => {
44        if (error != null) {
45            console.log(`callback getRawFd failed error code: ${error.code}, message: ${error.message}.`);
46        } else {
47            let fileDescriptor = {
48                fd = value.fd,
49                offset = value.offset,
50                length = value.length
51            }
52            this.avPlayer.fdSrc(fileDescriptor); // Take the audio player as an example. When calling fdSrc, pass fileDescriptor in addition to fd.
53        }
54    });
55  } catch (error) {
56      console.error(`callback getRawFd failed, error code: ${error.code}, message: ${error.message}.`)
57  };
58```
59
60
61## cl.resourceManager.2 Addition of getStringSync and getStringByNameSync APIs
62
63Added the **getStringSync** and **getStringByNameSync** APIs and error codes to obtain and format strings.
64
65| Bundle Name | API |
66| --------------- | ---------------------------------------------------- |
67| ohos.resourceManager.d.ts | getStringSync(resId: number, ...args: Array<string \| number>): string; |
68| ohos.resourceManager.d.ts | getStringSync(resource: Resource, ...args: Array<string \| number>): string; |
69| ohos.resourceManager.d.ts | getStringByNameSync(resName: string, ...args: Array<string \| number>): string; |
70
71**Change Impact**
72
73In versions earlier than 4.0.6.2, only the values of string resources can be directly obtained. In 4.0.6.2 or later, the values of string resources can be formatted based on the input arguments for enhanced query.
74
75The following error codes are added:
76
779001007 If the resource obtained by resId formatting error.
78
799001008 If the resource obtained by resName formatting error.
80
81**Sample Code**
82
83The following uses **getStringSync** as an example. Before the change, only example 1 is supported. After the change, both example 1 and example 2 are supported.
84```
85Example 1:
86try {
87  this.context.resourceManager.getStringSync($r('app.string.test').id);
88} catch (error) {
89  console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`)
90}
91Example 2:
92try {
93  this.context.resourceManager.getStringSync($r('app.string.test').id, "format string", 787, 98.78);
94} catch (error) {
95  console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`)
96}
97```
98
99**Adaptation Guide**
100
101For details, see the API reference.
102
103[API Reference](../../../application-dev/reference/apis/js-apis-resource-manager.md)
104
105[Error Codes](../../../application-dev/reference/errorcodes/errorcode-resource-manager.md)
106