mirror of
https://gitee.com/openharmony/global_i18n
synced 2025-02-17 06:31:45 +00:00
add bundle.json
Signed-off-by: the-minions-of-cplu <jinqi2@huawei.com>
This commit is contained in:
parent
9ecf4b82d0
commit
5503e65939
113
bundle.json
Normal file
113
bundle.json
Normal file
@ -0,0 +1,113 @@
|
||||
{
|
||||
"name": "@ohos/global_i18n_standard",
|
||||
"version": "1.0.0",
|
||||
"description": "Provides internationalization APIS for implementing functions such date and time formatting.",
|
||||
"homePage": "https://gitee.com/openharmony/",
|
||||
"license": "Apache V2",
|
||||
"repository": "https://gitee.com/openharmony/global_i18n_standard",
|
||||
"domain": "os",
|
||||
"language": "",
|
||||
"publishAs": "code-segment",
|
||||
"private": false,
|
||||
"scripts": {},
|
||||
"tags": [
|
||||
"global"
|
||||
],
|
||||
"keywords": [
|
||||
"i18n",
|
||||
"standard"
|
||||
],
|
||||
"envs": [],
|
||||
"dirs": [],
|
||||
"author": {
|
||||
"name": "",
|
||||
"email": "",
|
||||
"url": ""
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "",
|
||||
"email": "",
|
||||
"url": ""
|
||||
}
|
||||
],
|
||||
"segment": {
|
||||
"destPath": "base/global/i18n_standard"
|
||||
},
|
||||
"component": {
|
||||
"name": "i18n_standard",
|
||||
"subsystem": "global",
|
||||
"syscap": [
|
||||
"SystemCapability.I18N"
|
||||
],
|
||||
"features": [],
|
||||
"adapted_system_type": [
|
||||
"standard"
|
||||
],
|
||||
"rom": "",
|
||||
"ram": "",
|
||||
"deps": {
|
||||
"components": [
|
||||
"app_manager",
|
||||
"want",
|
||||
"appexecfwk_base",
|
||||
"appexecfwk_core",
|
||||
"ipc_core",
|
||||
"syspara",
|
||||
"utils",
|
||||
"tel_core_service_api",
|
||||
"libhilog",
|
||||
"samgr_proxy",
|
||||
"ace_napi",
|
||||
"base"
|
||||
],
|
||||
"third_party": [
|
||||
"icu",
|
||||
"libxml2",
|
||||
"libphonenumber"
|
||||
]
|
||||
},
|
||||
"build": {
|
||||
"sub_component": [
|
||||
"//base/global/i18n_standard/frameworks/zone:zone_util",
|
||||
"//base/global/i18n_standard/frameworks/intl:build_module",
|
||||
"//base/global/i18n_standard/interfaces/js/kits:build_module",
|
||||
"//third_party/icu/icu4c:ohos_icudat"
|
||||
],
|
||||
"inner_kits": [
|
||||
{
|
||||
"name": "//base/global/i18n_standard/frameworks/zone:zone_util",
|
||||
"header": {
|
||||
"header_files": [
|
||||
"zone_util.h"
|
||||
],
|
||||
"header_base": "//base/global/i18n_standard/interfaces/native/innerkits/zone/include"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "//base/global/i18n_standard/frameworks/intl:intl_util",
|
||||
"header": {
|
||||
"header_files": [
|
||||
"locale_config.h",
|
||||
"locale_info.h"
|
||||
],
|
||||
"header_base": "//base/global/i18n_standard/frameworks/intl/include"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "//base/global/i18n_standard/frameworks/intl:preferred_language",
|
||||
"header": {
|
||||
"header_files": [
|
||||
"preferred_language.h"
|
||||
],
|
||||
"header_base": "//base/global/i18n_standard/interfaces/native/innerkits/preferred_language/include"
|
||||
}
|
||||
}
|
||||
],
|
||||
"test": [
|
||||
"//base/global/i18n_standard/frameworks/intl/test:intl_test",
|
||||
"//base/global/i18n_standard/frameworks/zone/test:zone_util_test"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -13,21 +13,28 @@
|
||||
|
||||
import("//build/ohos.gni")
|
||||
|
||||
group("build_module") {
|
||||
deps = [
|
||||
":intl_util",
|
||||
":preferred_language",
|
||||
]
|
||||
}
|
||||
|
||||
config("preferred_language_config") {
|
||||
include_dirs = [ "//base/global/i18n_standard/interfaces/native/innerkits/preferred_language/include" ]
|
||||
}
|
||||
ohos_shared_library("preferred_language") {
|
||||
public_configs = [ ":preferred_language_config" ]
|
||||
include_dirs = [
|
||||
"//base/global/i18n_standard/frameworks/intl/include",
|
||||
"//base/global/resmgr_standard/frameworks/resmgr/include",
|
||||
"include",
|
||||
]
|
||||
sources = [ "src/preferred_language.cpp" ]
|
||||
cflags_cc = [
|
||||
"-Wall",
|
||||
"-fPIC",
|
||||
]
|
||||
deps = [
|
||||
"//base/global/i18n_standard/frameworks/intl:intl_util",
|
||||
"//base/global/resmgr_standard/frameworks/resmgr:global_resmgr",
|
||||
"//base/startup/syspara_lite/interfaces/innerkits/native/syspara:syspara",
|
||||
]
|
||||
deps = [ "//base/global/i18n_standard/frameworks/intl:intl_util" ]
|
||||
external_deps = [
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:want",
|
||||
@ -36,19 +43,26 @@ ohos_shared_library("preferred_language") {
|
||||
"core_service:tel_core_service_api",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
"resmgr_standard:global_resmgr",
|
||||
"startup_l2:syspara",
|
||||
]
|
||||
subsystem_name = "global"
|
||||
part_name = "i18n_standard"
|
||||
}
|
||||
|
||||
ohos_shared_library("intl_util") {
|
||||
config("intl_util_config") {
|
||||
include_dirs = [
|
||||
"//third_party/icu/icu4c/source",
|
||||
"//third_party/icu/icu4c/source/common",
|
||||
"//third_party/icu/icu4c/source/i18n",
|
||||
"//third_party/icu/icu4c/source/common/unicode",
|
||||
"//base/global/i18n_standard/frameworks/intl/include",
|
||||
"//base/global/i18n_standard/interfaces/native/innerkits/i18n/include",
|
||||
]
|
||||
}
|
||||
ohos_shared_library("intl_util") {
|
||||
public_configs = [ ":intl_util_config" ]
|
||||
include_dirs = [
|
||||
"include",
|
||||
"//utils/native/base/include",
|
||||
"//third_party/libxml2/include",
|
||||
"//third_party/libphonenumber/cpp/src",
|
||||
@ -82,18 +96,17 @@ ohos_shared_library("intl_util") {
|
||||
":forbidden_regions_xml",
|
||||
":language_config.para",
|
||||
":white_languages_xml",
|
||||
"//base/startup/syspara_lite/interfaces/innerkits/native/syspara:syspara",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
|
||||
"//third_party/icu/icu4c:shared_icui18n",
|
||||
"//third_party/icu/icu4c:shared_icuuc",
|
||||
"//third_party/libphonenumber/cpp:phonenumber_standard",
|
||||
"//third_party/libxml2:xml2",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
external_deps = [
|
||||
"core_service:tel_core_service_api",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
"startup_l2:syspara",
|
||||
"utils_base:utils",
|
||||
]
|
||||
subsystem_name = "global"
|
||||
part_name = "i18n_standard"
|
||||
|
27
frameworks/intl/src/locale_util.cpp
Normal file
27
frameworks/intl/src/locale_util.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "locale_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace I18n {
|
||||
bool LocaleUtil::IsRTL(const std::string &locale)
|
||||
{
|
||||
icu::Locale curLocale(locale.c_str());
|
||||
return curLocale.isRightToLeft();
|
||||
}
|
||||
} // I18n
|
||||
} // Global
|
||||
} // OHOS
|
@ -38,6 +38,5 @@ ohos_unittest("intl_test") {
|
||||
|
||||
group("unittest") {
|
||||
testonly = true
|
||||
deps = []
|
||||
deps += [ ":intl_test" ]
|
||||
deps = [ ":intl_test" ]
|
||||
}
|
||||
|
@ -13,19 +13,22 @@
|
||||
|
||||
import("//build/ohos.gni")
|
||||
|
||||
ohos_shared_library("zone_util") {
|
||||
config("zone_util_public_configs") {
|
||||
include_dirs = [
|
||||
"//third_party/icu/icu4c/source",
|
||||
"//third_party/icu/icu4c/source/common",
|
||||
"//third_party/icu/icu4c/source/common/unicode",
|
||||
"//third_party/icu/icu4c/source/i18n",
|
||||
"//third_party/icu/icu4c/source/i18n/unicode",
|
||||
"//base/global/i18n_standard/interfaces/native/innerkits/zone/include",
|
||||
"//third_party/libphonenumber/cpp/src",
|
||||
"//third_party/protobuf/src",
|
||||
"//third_party/protobuf/src/google",
|
||||
"//third_party/protobuf/src/google/protobuf",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_shared_library("zone_util") {
|
||||
public_configs = [ ":zone_util_public_configs" ]
|
||||
sources = [ "src/zone_util.cpp" ]
|
||||
cflags_cc = [
|
||||
"-Wall",
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <cctype>
|
||||
#include "ohos/init_data.h"
|
||||
#include "strenum.h"
|
||||
#include "timezone.h"
|
||||
#include "unicode/timezone.h"
|
||||
|
||||
using namespace OHOS::Global::I18n;
|
||||
using namespace icu;
|
||||
@ -90,9 +90,7 @@ string ZoneUtil::GetDefaultZone(const int32_t number)
|
||||
return "";
|
||||
}
|
||||
string ret = GetDefaultZone(*region_code);
|
||||
if (region_code != nullptr) {
|
||||
delete region_code;
|
||||
}
|
||||
delete region_code;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -124,10 +122,7 @@ string ZoneUtil::GetDefaultZone(const int32_t number, const int32_t offset)
|
||||
return "";
|
||||
}
|
||||
string ret = GetDefaultZone(*region_code, offset);
|
||||
if (region_code != nullptr) {
|
||||
delete region_code;
|
||||
region_code = nullptr;
|
||||
}
|
||||
delete region_code;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -218,4 +213,4 @@ bool ZoneUtil::Init()
|
||||
{
|
||||
SetHwIcuDirectory();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,13 @@
|
||||
|
||||
import("//build/ohos.gni")
|
||||
|
||||
group("build_module") {
|
||||
deps = [
|
||||
":i18n",
|
||||
":intl",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_shared_library("intl") {
|
||||
include_dirs = [
|
||||
"//base/global/i18n_standard/frameworks/intl/include",
|
||||
@ -65,12 +72,14 @@ ohos_shared_library("i18n") {
|
||||
deps = [
|
||||
"//base/global/i18n_standard/frameworks/intl:intl_util",
|
||||
"//base/global/i18n_standard/frameworks/intl:preferred_language",
|
||||
"//foundation/ace/napi:ace_napi",
|
||||
"//third_party/icu/icu4c:shared_icui18n",
|
||||
"//third_party/icu/icu4c:shared_icuuc",
|
||||
"//third_party/libphonenumber/cpp:phonenumber_standard",
|
||||
]
|
||||
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
|
||||
external_deps = [
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"napi:ace_napi",
|
||||
]
|
||||
relative_install_dir = "module"
|
||||
subsystem_name = "global"
|
||||
part_name = "i18n_standard"
|
||||
|
@ -12,22 +12,20 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef I18N_STANDARD_ISRTL_LOCALE_UTIL_H
|
||||
#define I18N_STANDARD_ISRTL_LOCALE_UTIL_H
|
||||
#ifndef OHOS_GLOBAL_I18N_LOCALE_UTIL_H
|
||||
#define OHOS_GLOBAL_I18N_LOCALE_UTIL_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "locid.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace I18n {
|
||||
static inline bool IsRTL(const std::string &locale)
|
||||
{
|
||||
icu::Locale curLocale(locale.c_str());
|
||||
return curLocale.isRightToLeft();
|
||||
class LocaleUtil {
|
||||
public:
|
||||
static bool IsRTL(const std::string &locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // I18n
|
||||
} // Global
|
||||
} // OHOS
|
||||
#endif
|
||||
|
46
ohos.build
46
ohos.build
@ -1,46 +0,0 @@
|
||||
{
|
||||
"subsystem":"global",
|
||||
"parts": {
|
||||
"i18n_standard": {
|
||||
"module_list": [
|
||||
"//base/global/i18n_standard/frameworks/zone:zone_util",
|
||||
"//base/global/i18n_standard/frameworks/intl:intl_util",
|
||||
"//base/global/i18n_standard/frameworks/intl:preferred_language",
|
||||
"//base/global/i18n_standard/interfaces/js/kits:intl",
|
||||
"//base/global/i18n_standard/interfaces/js/kits:i18n",
|
||||
"//third_party/icu/icu4c:shared_icuuc",
|
||||
"//third_party/icu/icu4c:shared_icui18n",
|
||||
"//third_party/icu/icu4c:ohos_icudat",
|
||||
"//third_party/libphonenumber/cpp:phonenumber_standard",
|
||||
"//third_party/protobuf/src:protobuf_standard"
|
||||
|
||||
],
|
||||
"inner_kits": [
|
||||
{
|
||||
"header": {
|
||||
"header_base": "//base/global/i18n_standard/interfaces/native/innerkits/zone/include",
|
||||
"header_files": [
|
||||
"zone_util.h"
|
||||
]
|
||||
},
|
||||
"name": "//base/global/i18n_standard/frameworks/zone:zone_util"
|
||||
},
|
||||
{
|
||||
"header": {
|
||||
"header_base": "//third_party/libphonenumber",
|
||||
"header_files": [
|
||||
"cpp/src/phonenumbers/phonenumber.pb.h",
|
||||
"cpp/src/phonenumbers/phonenumberutil.h"
|
||||
]
|
||||
},
|
||||
"name": "//third_party/libphonenumber/cpp:phonenumber_standard"
|
||||
}
|
||||
],
|
||||
"test_list": [
|
||||
"//base/global/i18n_standard/frameworks/zone/test:zone_util_test",
|
||||
"//third_party/libphonenumber/cpp/test:libphonenumber_test",
|
||||
"//base/global/i18n_standard/frameworks/intl/test:intl_test"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user