1 /*
2  * Copyright (c) 2021-2022 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 defined(FEATURE_INTL_MODULE) && (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 namespace OHOS {
49 namespace ACELite {
50 class IntlControlModule final {
51 public:
52     IntlControlModule() = default;
53     ~IntlControlModule() = default;
54 
Load()55     static void Load()
56     {
57 #if defined(FEATURE_INTL_MODULE) && (FEATURE_INTL_MODULE == 1)
58         IntlModule *intlModule = IntlModule::GetInstance();
59         intlModule->Init();
60 #endif
61     }
62 };
63 }
64 }
65 
66 #endif // INTLMODULE_H
67