1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_ACELITE_INTL_MODULE_H 17 #define OHOS_ACELITE_INTL_MODULE_H 18 #include "acelite_config.h" 19 #if (FEATURE_INTL_MODULE == 1) 20 #include "js_fwk_common.h" 21 #include "non_copyable.h" 22 #include "locale_info.h" 23 namespace OHOS { 24 namespace ACELite { 25 class IntlModule final { 26 public: 27 ACE_DISALLOW_COPY(IntlModule); GetInstance()28 static IntlModule *GetInstance() 29 { 30 static IntlModule intlModule; 31 return &intlModule; 32 } 33 34 /** 35 * @brief: add Intl object to context and register numberformat and dateformat object 36 * and add format method support 37 */ 38 void Init(); 39 40 private: IntlModule()41 IntlModule() {} 42 ~IntlModule()43 ~IntlModule() {} 44 }; 45 } 46 } 47 #endif // FEATURE_INTL_MODULE 48 49 namespace OHOS { 50 namespace ACELite { 51 class IntlControlModule final { 52 public: 53 IntlControlModule() = default; 54 ~IntlControlModule() = default; 55 Load()56 static void Load() 57 { 58 #if (FEATURE_INTL_MODULE == 1) 59 IntlModule *intlModule = IntlModule::GetInstance(); 60 intlModule->Init(); 61 #endif 62 } 63 }; 64 } 65 } 66 67 #endif // INTLMODULE_H 68