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 169596a2c1Sopenharmony_ci#ifndef OHOS_GLOBAL_I18N_I18N_SERVICE_ABILITY_PROXY_H 179596a2c1Sopenharmony_ci#define OHOS_GLOBAL_I18N_I18N_SERVICE_ABILITY_PROXY_H 189596a2c1Sopenharmony_ci 199596a2c1Sopenharmony_ci#include "ii18n_service_ability.h" 209596a2c1Sopenharmony_ci#include "iremote_broker.h" 219596a2c1Sopenharmony_ci#include "iremote_proxy.h" 229596a2c1Sopenharmony_ci 239596a2c1Sopenharmony_cinamespace OHOS { 249596a2c1Sopenharmony_cinamespace Global { 259596a2c1Sopenharmony_cinamespace I18n { 269596a2c1Sopenharmony_ci/** 279596a2c1Sopenharmony_ci * @brief I18n Service Proxy class which responsible for initiating service requests. 289596a2c1Sopenharmony_ci */ 299596a2c1Sopenharmony_ciclass I18nServiceAbilityProxy : public IRemoteProxy<II18nServiceAbility> { 309596a2c1Sopenharmony_cipublic: 319596a2c1Sopenharmony_ci explicit I18nServiceAbilityProxy(const sptr<IRemoteObject> &impl); 329596a2c1Sopenharmony_ci ~I18nServiceAbilityProxy() = default; 339596a2c1Sopenharmony_ci 349596a2c1Sopenharmony_ci /** 359596a2c1Sopenharmony_ci * @brief Initiating set system language request to i18n service. 369596a2c1Sopenharmony_ci * 379596a2c1Sopenharmony_ci * @param language language tag to set. 389596a2c1Sopenharmony_ci * @return I18nErrorCode Return SUCCESS indicates that the request was successful. 399596a2c1Sopenharmony_ci */ 409596a2c1Sopenharmony_ci I18nErrorCode SetSystemLanguage(const std::string &language); 419596a2c1Sopenharmony_ci 429596a2c1Sopenharmony_ci /** 439596a2c1Sopenharmony_ci * @brief Initiating set system region request to i18n service. 449596a2c1Sopenharmony_ci * 459596a2c1Sopenharmony_ci * @param region region tag to set. 469596a2c1Sopenharmony_ci * @return I18nErrorCode Return SUCCESS indicates that the request was successful. 479596a2c1Sopenharmony_ci */ 489596a2c1Sopenharmony_ci I18nErrorCode SetSystemRegion(const std::string ®ion); 499596a2c1Sopenharmony_ci 509596a2c1Sopenharmony_ci /** 519596a2c1Sopenharmony_ci * @brief Initiating set system locale request to i18n service. 529596a2c1Sopenharmony_ci * 539596a2c1Sopenharmony_ci * @param locale locale tag to set. 549596a2c1Sopenharmony_ci * @return I18nErrorCode Return SUCCESS indicates that the request was successful. 559596a2c1Sopenharmony_ci */ 569596a2c1Sopenharmony_ci I18nErrorCode SetSystemLocale(const std::string &locale); 579596a2c1Sopenharmony_ci 589596a2c1Sopenharmony_ci /** 599596a2c1Sopenharmony_ci * @brief Initiating set system 12 or 24-hour clock request to i18n service. 609596a2c1Sopenharmony_ci * 619596a2c1Sopenharmony_ci * @param flag When flag is true, the system adopts 24-hour clock; 629596a2c1Sopenharmony_ci * When flag is false, the system adopts 12-hour clock; When flag is empty string, the system adopts 639596a2c1Sopenharmony_ci * system locale default behavior. 649596a2c1Sopenharmony_ci * @return I18nErrorCode Return SUCCESS indicates that the request was successful. 659596a2c1Sopenharmony_ci */ 669596a2c1Sopenharmony_ci I18nErrorCode Set24HourClock(const std::string &flag); 679596a2c1Sopenharmony_ci 689596a2c1Sopenharmony_ci /** 699596a2c1Sopenharmony_ci * @brief Initiating set system digit request to i18n service. 709596a2c1Sopenharmony_ci * 719596a2c1Sopenharmony_ci * @param flag When flag is True, request to adopt local digit; 729596a2c1Sopenharmony_ci * When flag is False, request to adopt arbic digit; 739596a2c1Sopenharmony_ci * @return I18nErrorCode Return SUCCESS indicates that the request was successful. 749596a2c1Sopenharmony_ci */ 759596a2c1Sopenharmony_ci I18nErrorCode SetUsingLocalDigit(bool flag); 769596a2c1Sopenharmony_ci 779596a2c1Sopenharmony_ci /** 789596a2c1Sopenharmony_ci * @brief Initiating add system preferred language request to i18n service. 799596a2c1Sopenharmony_ci * 809596a2c1Sopenharmony_ci * @param language preferred language tag to set. 819596a2c1Sopenharmony_ci * @param index Indicats added preferred language index. 829596a2c1Sopenharmony_ci * @return I18nErrorCode Return SUCCESS indicates that the request was successful. 839596a2c1Sopenharmony_ci */ 849596a2c1Sopenharmony_ci I18nErrorCode AddPreferredLanguage(const std::string &language, int32_t index); 859596a2c1Sopenharmony_ci 869596a2c1Sopenharmony_ci /** 879596a2c1Sopenharmony_ci * @brief Initiating remove system preferred language request to i18n service. 889596a2c1Sopenharmony_ci * 899596a2c1Sopenharmony_ci * @param index Indicats removed preferred language index. 909596a2c1Sopenharmony_ci * @return I18nErrorCode Return SUCCESS indicates that the request was successful. 919596a2c1Sopenharmony_ci */ 929596a2c1Sopenharmony_ci I18nErrorCode RemovePreferredLanguage(int32_t index); 939596a2c1Sopenharmony_ci 949596a2c1Sopenharmony_ciprivate: 959596a2c1Sopenharmony_ci static I18nErrorCode ProcessReply(int32_t reply); 969596a2c1Sopenharmony_ci static inline BrokerDelegator<I18nServiceAbilityProxy> delegator_; 979596a2c1Sopenharmony_ci}; 989596a2c1Sopenharmony_ci} // namespace I18n 999596a2c1Sopenharmony_ci} // namespace Global 1009596a2c1Sopenharmony_ci} // namespace OHOS 1019596a2c1Sopenharmony_ci#endif // OHOS_GLOBAL_I18N_I18N_SERVICE_ABILITY_PROXY_H