1 /** 2 * Copyright (c) 2025 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 #include "plugins/ets/stdlib/native/core/Intl.h" 17 #include "plugins/ets/stdlib/native/core/IntlState.h" 18 #include "plugins/ets/stdlib/native/core/IntlNumberFormat.h" 19 #include "plugins/ets/stdlib/native/core/IntlLocaleMatch.h" 20 #include "plugins/ets/stdlib/native/core/IntlCollator.h" 21 #include "plugins/ets/stdlib/native/core/IntlSegmenter.h" 22 #include "plugins/ets/stdlib/native/core/IntlCommon.h" 23 #include "plugins/ets/stdlib/native/core/IntlLocale.h" 24 #include "plugins/ets/stdlib/native/core/IntlPluralRules.h" 25 #include "plugins/ets/stdlib/native/core/IntlDateTimeFormat.h" 26 #include "plugins/ets/stdlib/native/core/IntlListFormat.h" 27 #include "plugins/ets/stdlib/native/core/IntlRelativeTimeFormat.h" 28 29 #include "plugins/ets/stdlib/native/core/IntlDisplayNames.h" 30 #include "plugins/ets/runtime/ets_napi_env.h" 31 #include "ani/ani.h" 32 33 namespace ark::ets::stdlib::intl { 34 InitCoreIntl(ani_env * env)35ani_status InitCoreIntl(ani_env *env) 36 { 37 // Create internal data 38 CreateIntlState(); 39 40 // Register Native methods. Stop if an error occurred 41 ani_status err = RegisterIntlNumberFormatNativeMethods(env); 42 err = err == ANI_OK ? RegisterIntlLocaleMatch(env) : err; 43 err = err == ANI_OK ? RegisterIntlCollator(env) : err; 44 err = err == ANI_OK ? RegisterIntlLocaleNativeMethods(env) : err; 45 err = err == ANI_OK ? RegisterIntlPluralRules(env) : err; 46 err = err == ANI_OK ? RegisterIntlDateTimeFormatMethods(env) : err; 47 err = err == ANI_OK ? RegisterIntlRelativeTimeFormatMethods(env) : err; 48 err = err == ANI_OK ? RegisterIntlSegmenter(env) : err; 49 err = err == ANI_OK ? RegisterIntlListFormat(env) : err; 50 err = err == ANI_OK ? RegisterIntlDisplayNames(env) : err; 51 return err; 52 } 53 54 } // namespace ark::ets::stdlib::intl 55