19596a2c1Sopenharmony_ci/* 29596a2c1Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 39596a2c1Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 49596a2c1Sopenharmony_ci * you may not use this file except in compliance with the License. 59596a2c1Sopenharmony_ci * You may obtain a copy of the License at 69596a2c1Sopenharmony_ci * 79596a2c1Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 89596a2c1Sopenharmony_ci * 99596a2c1Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 109596a2c1Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 119596a2c1Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 129596a2c1Sopenharmony_ci * See the License for the specific language governing permissions and 139596a2c1Sopenharmony_ci * limitations under the License. 149596a2c1Sopenharmony_ci */ 159596a2c1Sopenharmony_ci#ifndef OHOS_GLOBAL_I18N_SYSTEM_ADDON_H 169596a2c1Sopenharmony_ci#define OHOS_GLOBAL_I18N_SYSTEM_ADDON_H 179596a2c1Sopenharmony_ci 189596a2c1Sopenharmony_ci#include <memory> 199596a2c1Sopenharmony_ci#include "i18n_timezone.h" 209596a2c1Sopenharmony_ci#include "napi/native_api.h" 219596a2c1Sopenharmony_ci#include "napi/native_node_api.h" 229596a2c1Sopenharmony_ci 239596a2c1Sopenharmony_cinamespace OHOS { 249596a2c1Sopenharmony_cinamespace Global { 259596a2c1Sopenharmony_cinamespace I18n { 269596a2c1Sopenharmony_ciclass I18nSystemAddon { 279596a2c1Sopenharmony_cipublic: 289596a2c1Sopenharmony_ci I18nSystemAddon(); 299596a2c1Sopenharmony_ci ~I18nSystemAddon(); 309596a2c1Sopenharmony_ci static void Destructor(napi_env env, void *nativeObject, void *finalize_hint); 319596a2c1Sopenharmony_ci static napi_value InitI18nSystem(napi_env env, napi_value exports); 329596a2c1Sopenharmony_ci 339596a2c1Sopenharmony_ci static napi_value GetSystemLanguage(napi_env env, napi_callback_info info); 349596a2c1Sopenharmony_ci static napi_value GetSystemCountriesWithError(napi_env env, napi_callback_info info); 359596a2c1Sopenharmony_ci static napi_value GetSystemRegion(napi_env env, napi_callback_info info); 369596a2c1Sopenharmony_ci static napi_value GetSystemLocale(napi_env env, napi_callback_info info); 379596a2c1Sopenharmony_ci static napi_value GetPreferredLanguageList(napi_env env, napi_callback_info info); 389596a2c1Sopenharmony_ci static napi_value GetFirstPreferredLanguage(napi_env env, napi_callback_info info); 399596a2c1Sopenharmony_ci static napi_value Is24HourClock(napi_env env, napi_callback_info info); 409596a2c1Sopenharmony_ci static napi_value Set24HourClock(napi_env env, napi_callback_info info); 419596a2c1Sopenharmony_ci static napi_value AddPreferredLanguage(napi_env env, napi_callback_info info); 429596a2c1Sopenharmony_ci static napi_value RemovePreferredLanguage(napi_env env, napi_callback_info info); 439596a2c1Sopenharmony_ci static napi_value GetDisplayLanguage(napi_env env, napi_callback_info info); 449596a2c1Sopenharmony_ci static napi_value GetDisplayCountry(napi_env env, napi_callback_info info); 459596a2c1Sopenharmony_ci 469596a2c1Sopenharmony_ciprivate: 479596a2c1Sopenharmony_ci static napi_value GetSystemCountries(napi_env env, napi_callback_info info); 489596a2c1Sopenharmony_ci static napi_value IsSuggested(napi_env env, napi_callback_info info); 499596a2c1Sopenharmony_ci static napi_value SetSystemLanguage(napi_env env, napi_callback_info info); 509596a2c1Sopenharmony_ci static napi_value GetDisplayCountryWithError(napi_env env, napi_callback_info info); 519596a2c1Sopenharmony_ci static napi_value GetDisplayLanguageWithError(napi_env env, napi_callback_info info); 529596a2c1Sopenharmony_ci static napi_value GetSystemLanguages(napi_env env, napi_callback_info info); 539596a2c1Sopenharmony_ci static napi_value IsSuggestedWithError(napi_env env, napi_callback_info info); 549596a2c1Sopenharmony_ci static napi_value SetSystemLanguageWithError(napi_env env, napi_callback_info info); 559596a2c1Sopenharmony_ci static napi_value SetSystemRegion(napi_env env, napi_callback_info info); 569596a2c1Sopenharmony_ci static napi_value SetSystemRegionWithError(napi_env env, napi_callback_info info); 579596a2c1Sopenharmony_ci static napi_value SetSystemLocale(napi_env env, napi_callback_info info); 589596a2c1Sopenharmony_ci static napi_value SetSystemLocaleWithError(napi_env env, napi_callback_info info); 599596a2c1Sopenharmony_ci static napi_value Set24HourClockWithError(napi_env env, napi_callback_info info); 609596a2c1Sopenharmony_ci static napi_value AddPreferredLanguageWithError(napi_env env, napi_callback_info info); 619596a2c1Sopenharmony_ci static napi_value RemovePreferredLanguageWithError(napi_env env, napi_callback_info info); 629596a2c1Sopenharmony_ci static napi_value SetAppPreferredLanguage(napi_env env, napi_callback_info info); 639596a2c1Sopenharmony_ci static napi_value GetAppPreferredLanguage(napi_env env, napi_callback_info info); 649596a2c1Sopenharmony_ci static napi_value SetUsingLocalDigitAddon(napi_env env, napi_callback_info info); 659596a2c1Sopenharmony_ci static napi_value SetUsingLocalDigitAddonWithError(napi_env env, napi_callback_info info); 669596a2c1Sopenharmony_ci static napi_value GetUsingLocalDigitAddon(napi_env env, napi_callback_info info); 679596a2c1Sopenharmony_ci 689596a2c1Sopenharmony_ci static napi_value GetDisplayCountryImpl(napi_env env, napi_callback_info info, bool throwError); 699596a2c1Sopenharmony_ci static napi_value GetDisplayLanguageImpl(napi_env env, napi_callback_info info, bool throwError); 709596a2c1Sopenharmony_ci static napi_value GetSystemCountriesImpl(napi_env env, napi_callback_info info, bool throwError); 719596a2c1Sopenharmony_ci static napi_value IsSuggestedImpl(napi_env env, napi_callback_info info, bool throwError); 729596a2c1Sopenharmony_ci static napi_value SetSystemLanguageImpl(napi_env env, napi_callback_info info, bool throwError); 739596a2c1Sopenharmony_ci static napi_value SetSystemRegionImpl(napi_env env, napi_callback_info info, bool throwError); 749596a2c1Sopenharmony_ci static napi_value SetSystemLocaleImpl(napi_env env, napi_callback_info info, bool throwError); 759596a2c1Sopenharmony_ci static napi_value Set24HourClockImpl(napi_env env, napi_callback_info info, bool throwError); 769596a2c1Sopenharmony_ci static napi_value AddPreferredLanguageImpl(napi_env env, napi_callback_info info, bool throwError); 779596a2c1Sopenharmony_ci static napi_value RemovePreferredLanguageImpl(napi_env env, napi_callback_info info, bool throwError); 789596a2c1Sopenharmony_ci static napi_value SetUsingLocalDigitAddonImpl(napi_env env, napi_callback_info info, bool throwError); 799596a2c1Sopenharmony_ci static bool GetNapiStringValueWithError(napi_env env, napi_value napiValue, size_t len, char* valueBuf, 809596a2c1Sopenharmony_ci std::string index); 819596a2c1Sopenharmony_ci static bool GetCountryNapiValueWithError(napi_env env, napi_value napiValue, size_t len, char* valueBuf, 829596a2c1Sopenharmony_ci std::string index); 839596a2c1Sopenharmony_ci 849596a2c1Sopenharmony_ci static bool ParseStringParam(napi_env env, napi_value argv, bool throwError, std::string &strParam); 859596a2c1Sopenharmony_ci}; 869596a2c1Sopenharmony_ci} // namespace I18n 879596a2c1Sopenharmony_ci} // namespace Global 889596a2c1Sopenharmony_ci} // namespace OHOS 899596a2c1Sopenharmony_ci#endif