1e41f4b71Sopenharmony_ci# Globalization Subsystem ChangeLog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## cl.global.1 Support of Error Codes for the Internalization Module 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciAPIs provided by the internationalization component of the globalization subsystem are changed to support error codes in the following scenarios. The following changes are made in API version 9 and later: 6e41f4b71Sopenharmony_ci - Obtaining the local expression of a country or language 7e41f4b71Sopenharmony_ci - Obtaining the list of languages supported by the system and the list of areas supported by a language 8e41f4b71Sopenharmony_ci - Checking whether a language matches an area 9e41f4b71Sopenharmony_ci - Obtaining and setting the system language, country or region, and area 10e41f4b71Sopenharmony_ci - Obtaining and setting the 24-hour format of the system 11e41f4b71Sopenharmony_ci - Obtaining, adding, and removing the preferred language 12e41f4b71Sopenharmony_ci - Obtaining and setting localized numbers 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ciYou need to adapt your applications based on the following information: 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci**Change Impacts** 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ciThe preceding APIs are changed to the static methods of the **System** class. When such an API is called, add the class name to the end of the module name. 19e41f4b71Sopenharmony_ciThe return value data type of the setting APIs (for example, **setSystemLanguage**) is changed from boolean to void. 20e41f4b71Sopenharmony_ciWhen a call to an API fails, an error code is returned according to the failure cause. For example, when permissions are not correctly configured for an application, **201** is returned. 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci**Key API/Component Changes** 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ciInvolved APIs: 25e41f4b71Sopenharmony_ci- getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; 26e41f4b71Sopenharmony_ci- getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; 27e41f4b71Sopenharmony_ci- getSystemLanguages(): Array<string>; 28e41f4b71Sopenharmony_ci- getSystemCountries(language: string): Array<string>; 29e41f4b71Sopenharmony_ci- isSuggested(language: string, region?: string): boolean; 30e41f4b71Sopenharmony_ci- getSystemLanguage(): string; 31e41f4b71Sopenharmony_ci- setSystemLanguage(language: string): void; 32e41f4b71Sopenharmony_ci- getSystemRegion(): string; 33e41f4b71Sopenharmony_ci- setSystemRegion(region: string): void; 34e41f4b71Sopenharmony_ci- getSystemLocale(): string; 35e41f4b71Sopenharmony_ci- setSystemLocale(locale: string): void; 36e41f4b71Sopenharmony_ci- is24HourClock(): boolean; 37e41f4b71Sopenharmony_ci- set24HourClock(option: boolean): void; 38e41f4b71Sopenharmony_ci- addPreferredLanguage(language: string, index?: number): void; 39e41f4b71Sopenharmony_ci- removePreferredLanguage(index: number): void; 40e41f4b71Sopenharmony_ci- getPreferredLanguageList(): Array<string>; 41e41f4b71Sopenharmony_ci- getFirstPreferredLanguage(): string; 42e41f4b71Sopenharmony_ci- getAppPreferredLanguage(): string; 43e41f4b71Sopenharmony_ci- setUsingLocalDigit(flag: boolean): void; 44e41f4b71Sopenharmony_ci- getUsingLocalDigit(): boolean; 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci**Adaptation Guide** 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ciUse the **try-catch** block to capture errors returned by an API. 49e41f4b71Sopenharmony_ci``` 50e41f4b71Sopenharmony_ciimport I18n from '@ohos.i18n' 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_citry { 53e41f4b71Sopenharmony_ci I18n.System.setSystemLanguage('zh'); 54e41f4b71Sopenharmony_ci} catch(error) { 55e41f4b71Sopenharmony_ci console.error(`call System.setSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`) 56e41f4b71Sopenharmony_ci} 57e41f4b71Sopenharmony_ci``` 58