1
2# Globalization Changelog
3
4## cl.global.1 Change in the Resource Matching Logic
5
6**Access Level**
7
8Public API
9
10**Reason for Change**
11
12The resources in the mcc directory cannot be obtained properly when the SIM card is inserted, affecting resource customization.
13
14**Change Impact**
15
16This change is a non-compatible change.
17
18Before change: Differentiated resources such as the mcc directory are configured for an application. However, when a SIM card is inserted, resources in the default language directory are displayed. When no SIM card is inserted, resources in the mcc directory are displayed.
19
20For example, **Wi-Fi** is displayed when a SIM card is inserted, and **WLAN** is displayed when no SIM card is inserted.
21
22After change: When a SIM card is inserted, resources in the mcc directory are displayed. If no SIM card is inserted, resources in the default language directory are displayed.
23
24For example, **WLAN** is displayed when a SIM card is inserted, and **Wi-Fi** is displayed when no SIM card is inserted.
25
26**Start API Level**
27
289
29
30**Change Since**
31
32OpenHarmony SDK 5.0.0.33
33
34**Key API/Component Changes**
35
36**SystemCapability.Global.ResourceManager** provides APIs for resource management.
37For details about the APIs, see [API Reference](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-localization-kit/js-apis-resource-manager.md).
38
39**Adaptation Guide**
40
41Before the change, if the string **WLAN** is configured in the default language directory and the string **Wi-Fi** is configured in the mcc directory, you need to configure the string **WLAN** in the mcc directory and the string **Wi-Fi** in the default language directory.
42
43## cl.LocalizationKit.2 Change in the raw_file Header File
44
45**Access Level**
46
47Public API
48
49**Reason for Change**
50
51The raw_file module references the string header file, which is a C++ standard library file. As a result, the raw_file module cannot be used in the C language environment.
52
53**Change Impact**
54
55This change is a non-compatible change.
56
57Before change:
58
59In the C++ environment, if you use the **raw_file.h** header file but do not reference the string header file, the compilation is successful when you call string library functions such as **std::string**.
60
61```cpp
62#include <rawfile/raw_file_manager.h>
63#include <rawfile/raw_file.h>
64
65static napi_value GetRawFileContent(napi_env env, napi_callback_info info) {
66    size_t argc = 2;
67    napi_value argv[2] = {NULL};
68    napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
69    napi_valuetype valueType;
70    napi_typeof(env, argv[0], &valueType);
71    NativeResourceManager *mNativeResMgr = OH_ResourceManager_InitNativeResourceManager(env, argv[0]);
72    size_t strSize;
73    char strBuf[256];
74    napi_get_value_string_utf8(env, argv[1], strBuf, sizeof(strBuf), &strSize);
75    std::string filename(strBuf, strSize);   // Compilation is successful.
76    RawFile *rawFile = OH_ResourceManager_OpenRawFile(mNativeResMgr, filename.c_str());
77}
78```
79
80After change:
81
82In the C++ environment, if you use the **raw_file.h** header file but do not reference the string header file, the compilation fails when you call string library functions such as **std::string**.
83
84```cpp
85#include <rawfile/raw_file_manager.h>
86#include <rawfile/raw_file.h>
87
88static napi_value GetRawFileContent(napi_env env, napi_callback_info info) {
89    size_t argc = 2;
90    napi_value argv[2] = {NULL};
91    napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
92    napi_valuetype valueType;
93    napi_typeof(env, argv[0], &valueType);
94    NativeResourceManager *mNativeResMgr = OH_ResourceManager_InitNativeResourceManager(env, argv[0]);
95    size_t strSize;
96    char strBuf[256];
97    napi_get_value_string_utf8(env, argv[1], strBuf, sizeof(strBuf), &strSize);
98    std::string filename(strBuf, strSize);   // Compilation fails.
99    RawFile *rawFile = OH_ResourceManager_OpenRawFile(mNativeResMgr, filename.c_str());
100}
101```
102
103**Start API Level**
104
105API 8
106
107**Change Since**
108
109OpenHarmony SDK 5.0.0.33
110
111**Key API/Component Changes**
112
113| Before Change                     | After Change                                                         |
114|----------------------------|--------------------------------------------------------------|
115| `#include <string>`| #include <stddef.h><br>#include <stdint.h><br>#include <stdbool.h> |
116
117**Adaptation Guide**
118
119In the C++ environment, if you use the **raw_file.h** header file but do not reference the string header file, you need to include the string header file so that the compilation is successful when you call string library functions such as **std::string**.
120
121```cpp
122#include <rawfile/raw_file_manager.h>
123#include <rawfile/raw_file.h>
124#include <string>           // Manually reference the string header file.
125
126static napi_value GetRawFileContent(napi_env env, napi_callback_info info) {
127    size_t argc = 2;
128    napi_value argv[2] = {NULL};
129    napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
130    napi_valuetype valueType;
131    napi_typeof(env, argv[0], &valueType);
132    NativeResourceManager *mNativeResMgr = OH_ResourceManager_InitNativeResourceManager(env, argv[0]);
133    size_t strSize;
134    char strBuf[256];
135    napi_get_value_string_utf8(env, argv[1], strBuf, sizeof(strBuf), &strSize);
136    std::string filename(strBuf, strSize);   // Compilation is successful.
137    RawFile *rawFile = OH_ResourceManager_OpenRawFile(mNativeResMgr, filename.c_str());
138}
139```
140
141## cl.global.3 raw_file API Deprecated
142
143**Access Level**
144
145Public API
146
147**Reason for Change**
148
149Reference parameters are used in **OH_ResourceManager_GetRawFileDescriptor** and **OH_ResourceManager_ReleaseRawFileDescriptor**, which affects normal use of the APIs in the C environment.
150
151**Change Impact**
152
153This change is a compatible change.
154
155After the change, you need to use the substitute APIs for **OH_ResourceManager_GetRawFileDescriptor** and **OH_ResourceManager_ReleaseRawFileDescriptor**.
156
157**Change Since**
158
159OpenHarmony SDK 5.0.0.33
160
161**Deprecated APIs/Components**
162
163| API                                                                                               | Description   | Substitute API                                                                                                   |
164|-----------------------------------------------------------------------------------------------------|---------|---------------------------------------------------------------------------------------------------------|
165| bool OH_ResourceManager_GetRawFileDescriptor(const RawFile \*rawFile, RawFileDescriptor &descriptor) | Obtains the rawfile file descriptor.| bool OH_ResourceManager_GetRawFileDescriptorData(const RawFile \*rawFile, RawFileDescriptor \*descriptor) |
166| bool OH_ResourceManager_ReleaseRawFileDescriptor(const RawFileDescriptor &descriptor)               | Releases the rawfile file descriptor.| bool OH_ResourceManager_ReleaseRawFileDescriptorData(const RawFileDescriptor \*descriptor)               |
167
168
169**Adaptation Guide**
170
171After the change, you need to call **OH_ResourceManager_GetRawFileDescriptorData** to obtain the rawfile descriptor to read the rawfile content, and call **OH_ResourceManager_ReleaseRawFileDescriptorData** to release the obtained rawfile descriptor.
172
173## cl.global.4 ohresmgr API Deprecated
174
175**Access Level**
176
177Public API
178
179**Reason for Change**
180
181Optional parameters are used in certain ohresmgr APIs, which affects normal use of these APIs in the C environment.
182
183**Change Impact**
184
185This change is a compatible change.
186
187The ohresmgr APIs that use optional parameters are deprecated and you are advised to use the substitute APIs.
188
189**Change Since**
190
191OpenHarmony SDK 5.0.0.33
192
193**Deprecated APIs/Components**
194
195| API                                                                                                                                                                                                                       | Description   | Substitute API                                                                                                                                                                                                                   |
196|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
197| ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64(const NativeResourceManager \*mgr, uint32_t resId,     char \*\*resultValue, uint64_t \*resultLen, uint32_t density = 0)                                            | Obtains the Base64 code of a media file based on the resource ID.| ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64Data(const NativeResourceManager \*mgr, uint32_t resId,     char \*\*resultValue, uint64_t \*resultLen, uint32_t density)                                        |
198| ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64ByName(const NativeResourceManager \*mgr,     const char \*resName, char \*\*resultValue, uint64_t \*resultLen, uint32_t density = 0)                                 | Obtains the Base64 code of a media file based on the resource name.| ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64DataByName(const NativeResourceManager \*mgr,     const char \*resName, char \*\*resultValue, uint64_t \*resultLen, uint32_t density)                             |
199| ResourceManager_ErrorCode OH_ResourceManager_GetMedia(const NativeResourceManager \*mgr, uint32_t resId,     uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density = 0)                                               | Obtains the content of a media file based on the resource ID.| ResourceManager_ErrorCode OH_ResourceManager_GetMediaData(const NativeResourceManager \*mgr, uint32_t resId,     uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density)                                           |
200| ResourceManager_ErrorCode OH_ResourceManager_GetMediaByName(const NativeResourceManager \*mgr, const char \*resName,     uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density = 0)                                    | Obtains the content of a media file based on the resource name.| ResourceManager_ErrorCode OH_ResourceManager_GetMediaDataByName(const NativeResourceManager \*mgr, const char \*resName,     uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density)                                |
201| ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptor(const NativeResourceManager \*mgr,     uint32_t resId, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density = 0, uint32_t type = 0)            | Obtains the file descriptor or an image based on the resource ID.| ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorData(const NativeResourceManager \*mgr,     uint32_t resId, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density, uint32_t type)            |
202| ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName(const NativeResourceManager \*mgr,     const char \*resName, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density = 0, uint32_t type = 0) | Obtains the file descriptor or an image based on the resource name.| ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorDataByName(const NativeResourceManager \*mgr,     const char \*resName, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density, uint32_t type) |
203| ResourceManager_ErrorCode OH_ResourceManager_GetLocales(const NativeResourceManager \*mgr, char \*\*\*resultValue,     uint32_t \*resultLen, bool includeSystem = false)                                                         | Obtains the current language and locale.| ResourceManager_ErrorCode OH_ResourceManager_GetLocalesData(const NativeResourceManager \*mgr, char \*\*\*resultValue,     uint32_t \*resultLen, bool includeSystem)                                                         |
204
205
206**Adaptation Guide**
207
208Substitute APIs that use optional parameters with new APIs.
209
210ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64Data(const NativeResourceManager \*mgr, uint32_t resId,
211    char \*\*resultValue, uint64_t \*resultLen, uint32_t density);
212
213ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64DataByName(const NativeResourceManager \*mgr,
214    const char \*resName, char \*\*resultValue, uint64_t \*resultLen, uint32_t density);
215
216ResourceManager_ErrorCode OH_ResourceManager_GetMediaData(const NativeResourceManager \*mgr, uint32_t resId,
217    uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density);
218
219ResourceManager_ErrorCode OH_ResourceManager_GetMediaDataByName(const NativeResourceManager \*mgr, const char \*resName,
220    uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density);
221
222ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorData(const NativeResourceManager \*mgr,
223    uint32_t resId, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density, uint32_t type);
224
225ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorDataByName(const NativeResourceManager \*mgr,
226    const char \*resName, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density, uint32_t type);
227
228ResourceManager_ErrorCode OH_ResourceManager_GetLocalesData(const NativeResourceManager \*mgr, char \*\*\*resultValue,
229    uint32_t \*resultLen, bool includeSystem);
230