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