Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Global I18n Standard
提交
3a16db46
G
Global I18n Standard
项目概览
OpenHarmony
/
Global I18n Standard
大约 1 年 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Global I18n Standard
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3a16db46
编写于
9月 07, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 07, 2021
浏览文件
操作
浏览文件
下载
差异文件
!47 添加i18n模块接口
Merge pull request !47 from 多肉包包与旺旺肉松/master
上级
0f556db6
a1cee298
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
457 addition
and
3 deletion
+457
-3
interfaces/js/kits/@ohos.i18n.d.ts
interfaces/js/kits/@ohos.i18n.d.ts
+3
-3
interfaces/js/kits/BUILD.gn
interfaces/js/kits/BUILD.gn
+28
-0
interfaces/js/kits/include/i18n_addon.h
interfaces/js/kits/include/i18n_addon.h
+47
-0
interfaces/js/kits/src/i18n_addon.cpp
interfaces/js/kits/src/i18n_addon.cpp
+378
-0
ohos.build
ohos.build
+1
-0
未找到文件。
interfaces/js/kits/@ohos.i18n.d.ts
浏览文件 @
3a16db46
...
...
@@ -77,7 +77,7 @@ export function getSystemLanguage(): string;
* @param language The language to be used.
* @since 7
*/
export
function
setSystemLanguage
(
language
:
string
);
export
function
setSystemLanguage
(
language
:
string
)
:
boolean
;
/**
* Obtain the region currently used by the system.
...
...
@@ -93,7 +93,7 @@ export function getSystemRegion(): string;
* @param region The region to be used.
* @since 7
*/
export
function
setSystemRegion
(
region
:
string
);
export
function
setSystemRegion
(
region
:
string
)
:
boolean
;
/**
* Obtain the locale currently used by the system.
...
...
@@ -109,5 +109,5 @@ export function getSystemLocale(): string;
* @param locale The locale to be used.
* @since 7
*/
export
function
setSystemLocale
(
locale
:
string
);
export
function
setSystemLocale
(
locale
:
string
)
:
boolean
;
}
\ No newline at end of file
interfaces/js/kits/BUILD.gn
浏览文件 @
3a16db46
...
...
@@ -39,3 +39,31 @@ ohos_shared_library("intl") {
subsystem_name = "global"
part_name = "i18n_standard"
}
ohos_shared_library("i18n") {
include_dirs = [
"//base/global/i18n_standard/frameworks/intl/include",
"//base/global/i18n_standard/interfaces/js/kits/include",
"//base/hiviewdfx/interfaces/native/innerkits/include",
"//foundation/ace/napi/native_engine",
"//foundation/ace/napi/interfaces/kits",
"//third_party/node/src",
"//third_party/icu/icu4c/source",
"//third_party/icu/icu4c/source/common",
"//third_party/icu/icu4c/source/i18n",
]
sources = [ "src/i18n_addon.cpp" ]
deps = [
"//base/global/i18n_standard/frameworks/intl:intl_util",
"//foundation/ace/napi:ace_napi",
"//third_party/icu/icu4c:shared_icui18n",
"//third_party/icu/icu4c:shared_icuuc",
]
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
relative_install_dir = "module"
subsystem_name = "global"
part_name = "i18n_standard"
}
interfaces/js/kits/include/i18n_addon.h
0 → 100644
浏览文件 @
3a16db46
/*
* 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.
*/
#ifndef I18N_ADDON_H
#define I18N_ADDON_H
#include <string>
#include "napi/native_api.h"
#include "napi/native_node_api.h"
#include "locale_config.h"
namespace
OHOS
{
namespace
Global
{
namespace
I18n
{
class
I18nAddon
{
public:
static
napi_value
Init
(
napi_env
env
,
napi_value
exports
);
static
void
Destructor
(
napi_env
env
,
void
*
nativeObject
,
void
*
finalize_hint
);
I18nAddon
();
virtual
~
I18nAddon
();
static
napi_value
GetSystemLanguages
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
GetSystemCountries
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
IsSuggested
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
GetDisplayLanguage
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
GetDisplayCountry
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
GetSystemLanguage
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
GetSystemRegion
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
GetSystemLocale
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
SetSystemLanguage
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
SetSystemRegion
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
SetSystemLocale
(
napi_env
env
,
napi_callback_info
info
);
};
}
// namespace I18n
}
// namespace Global
}
// namespace OHOS
#endif
\ No newline at end of file
interfaces/js/kits/src/i18n_addon.cpp
0 → 100644
浏览文件 @
3a16db46
/*
* 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 <vector>
#include "i18n_addon.h"
#include "hilog/log.h"
#include "node_api.h"
namespace
OHOS
{
namespace
Global
{
namespace
I18n
{
static
constexpr
OHOS
::
HiviewDFX
::
HiLogLabel
LABEL
=
{
LOG_CORE
,
0xD001E00
,
"I18nJs"
};
using
namespace
OHOS
::
HiviewDFX
;
I18nAddon
::
I18nAddon
()
{}
I18nAddon
::~
I18nAddon
()
{
}
void
I18nAddon
::
Destructor
(
napi_env
env
,
void
*
nativeObject
,
void
*
hint
)
{
if
(
nativeObject
==
nullptr
)
{
return
;
}
reinterpret_cast
<
I18nAddon
*>
(
nativeObject
)
->~
I18nAddon
();
}
napi_value
I18nAddon
::
Init
(
napi_env
env
,
napi_value
exports
)
{
napi_status
status
;
napi_property_descriptor
properties
[]
=
{
DECLARE_NAPI_FUNCTION
(
"getSystemLanguages"
,
GetSystemLanguages
),
DECLARE_NAPI_FUNCTION
(
"getSystemCountries"
,
GetSystemCountries
),
DECLARE_NAPI_FUNCTION
(
"isSuggested"
,
IsSuggested
),
DECLARE_NAPI_FUNCTION
(
"getDisplayLanguage"
,
GetDisplayLanguage
),
DECLARE_NAPI_FUNCTION
(
"getDisplayCountry"
,
GetDisplayCountry
),
DECLARE_NAPI_FUNCTION
(
"getSystemLanguage"
,
GetSystemLanguage
),
DECLARE_NAPI_FUNCTION
(
"getSystemRegion"
,
GetSystemRegion
),
DECLARE_NAPI_FUNCTION
(
"getSystemLocale"
,
GetSystemLocale
),
DECLARE_NAPI_FUNCTION
(
"setSystemLanguage"
,
SetSystemLanguage
),
DECLARE_NAPI_FUNCTION
(
"setSystemRegion"
,
SetSystemRegion
),
DECLARE_NAPI_FUNCTION
(
"setSystemLocale"
,
SetSystemLocale
),
};
status
=
napi_define_properties
(
env
,
exports
,
sizeof
(
properties
)
/
sizeof
(
napi_property_descriptor
),
properties
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to set properties at init"
);
return
nullptr
;
}
return
exports
;
}
napi_value
I18nAddon
::
GetSystemLanguages
(
napi_env
env
,
napi_callback_info
info
)
{
std
::
vector
<
std
::
string
>
systemLanguages
;
LocaleConfig
::
GetSystemLanguages
(
systemLanguages
);
napi_value
result
;
napi_status
status
=
napi_create_array_with_length
(
env
,
systemLanguages
.
size
(),
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to create array"
);
return
nullptr
;
}
for
(
size_t
i
=
0
;
i
<
systemLanguages
.
size
();
i
++
)
{
napi_value
value
;
status
=
napi_create_string_utf8
(
env
,
systemLanguages
[
i
].
c_str
(),
NAPI_AUTO_LENGTH
,
&
value
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to create string item"
);
return
nullptr
;
}
status
=
napi_set_element
(
env
,
result
,
i
,
value
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to set array item"
);
return
nullptr
;
}
}
return
result
;
}
napi_value
I18nAddon
::
GetSystemCountries
(
napi_env
env
,
napi_callback_info
info
)
{
size_t
argc
=
1
;
napi_value
argv
[
1
]
=
{
0
};
napi_value
thisVar
=
nullptr
;
void
*
data
=
nullptr
;
napi_status
status
=
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
&
thisVar
,
&
data
);
size_t
len
;
napi_get_value_string_utf8
(
env
,
argv
[
0
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
localeBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
0
],
localeBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
std
::
vector
<
std
::
string
>
systemCountries
;
LocaleConfig
::
GetSystemCountries
(
systemCountries
);
napi_value
result
;
status
=
napi_create_array_with_length
(
env
,
systemCountries
.
size
(),
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to create array"
);
return
nullptr
;
}
for
(
size_t
i
=
0
;
i
<
systemCountries
.
size
();
i
++
)
{
napi_value
value
;
status
=
napi_create_string_utf8
(
env
,
systemCountries
[
i
].
c_str
(),
NAPI_AUTO_LENGTH
,
&
value
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to create string item"
);
return
nullptr
;
}
status
=
napi_set_element
(
env
,
result
,
i
,
value
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to set array item"
);
return
nullptr
;
}
}
return
result
;
}
napi_value
I18nAddon
::
GetSystemLanguage
(
napi_env
env
,
napi_callback_info
info
)
{
std
::
string
value
=
LocaleConfig
::
GetSystemLanguage
();
napi_value
result
;
napi_status
status
=
napi_create_string_utf8
(
env
,
value
.
c_str
(),
NAPI_AUTO_LENGTH
,
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to create string item"
);
return
nullptr
;
}
return
result
;
}
napi_value
I18nAddon
::
GetSystemRegion
(
napi_env
env
,
napi_callback_info
info
)
{
std
::
string
value
=
LocaleConfig
::
GetSystemRegion
();
napi_value
result
;
napi_status
status
=
napi_create_string_utf8
(
env
,
value
.
c_str
(),
NAPI_AUTO_LENGTH
,
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to create string item"
);
return
nullptr
;
}
return
result
;
}
napi_value
I18nAddon
::
GetSystemLocale
(
napi_env
env
,
napi_callback_info
info
)
{
std
::
string
value
=
LocaleConfig
::
GetSystemLocale
();
napi_value
result
;
napi_status
status
=
napi_create_string_utf8
(
env
,
value
.
c_str
(),
NAPI_AUTO_LENGTH
,
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to create string item"
);
return
nullptr
;
}
return
result
;
}
napi_value
I18nAddon
::
GetDisplayLanguage
(
napi_env
env
,
napi_callback_info
info
)
{
// Need to get three parameters to get the display Language.
size_t
argc
=
3
;
napi_value
argv
[
3
]
=
{
0
};
napi_value
thisVar
=
nullptr
;
void
*
data
=
nullptr
;
napi_status
status
=
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
&
thisVar
,
&
data
);
size_t
len
;
napi_get_value_string_utf8
(
env
,
argv
[
0
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
localeBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
0
],
localeBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
napi_get_value_string_utf8
(
env
,
argv
[
1
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
displayLocaleBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
1
],
displayLocaleBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
bool
sentenceCase
=
true
;
int
sentenceCaseIndex
=
2
;
if
(
argv
[
sentenceCaseIndex
]
!=
nullptr
)
{
napi_get_value_bool
(
env
,
argv
[
sentenceCaseIndex
],
&
sentenceCase
);
}
std
::
string
value
=
LocaleConfig
::
GetDisplayLanguage
(
localeBuf
.
data
(),
displayLocaleBuf
.
data
(),
sentenceCase
);
napi_value
result
;
status
=
napi_create_string_utf8
(
env
,
value
.
c_str
(),
NAPI_AUTO_LENGTH
,
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to create string item"
);
return
nullptr
;
}
return
result
;
}
napi_value
I18nAddon
::
GetDisplayCountry
(
napi_env
env
,
napi_callback_info
info
)
{
// Need to get three parameters to get the display country.
size_t
argc
=
3
;
napi_value
argv
[
3
]
=
{
0
};
napi_value
thisVar
=
nullptr
;
void
*
data
=
nullptr
;
napi_status
status
=
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
&
thisVar
,
&
data
);
size_t
len
;
napi_get_value_string_utf8
(
env
,
argv
[
0
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
localeBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
0
],
localeBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
napi_get_value_string_utf8
(
env
,
argv
[
1
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
displayLocaleBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
1
],
displayLocaleBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
bool
sentenceCase
=
true
;
int
sentenceCaseIndex
=
2
;
if
(
argv
[
sentenceCaseIndex
]
!=
nullptr
)
{
napi_get_value_bool
(
env
,
argv
[
sentenceCaseIndex
],
&
sentenceCase
);
}
std
::
string
value
=
LocaleConfig
::
GetDisplayRegion
(
localeBuf
.
data
(),
displayLocaleBuf
.
data
(),
sentenceCase
);
napi_value
result
;
status
=
napi_create_string_utf8
(
env
,
value
.
c_str
(),
NAPI_AUTO_LENGTH
,
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to create string item"
);
return
nullptr
;
}
return
result
;
}
napi_value
I18nAddon
::
IsSuggested
(
napi_env
env
,
napi_callback_info
info
)
{
// Need to get two parameters to check is suggested or not.
size_t
argc
=
2
;
napi_value
argv
[
2
]
=
{
0
};
napi_value
thisVar
=
nullptr
;
void
*
data
=
nullptr
;
napi_status
status
=
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
&
thisVar
,
&
data
);
size_t
len
;
napi_get_value_string_utf8
(
env
,
argv
[
0
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
languageBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
0
],
languageBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
bool
isSuggested
=
false
;
if
(
argv
[
1
]
!=
nullptr
)
{
napi_get_value_string_utf8
(
env
,
argv
[
1
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
regionBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
1
],
regionBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
isSuggested
=
LocaleConfig
::
IsSuggested
(
languageBuf
.
data
(),
regionBuf
.
data
());
}
else
{
isSuggested
=
LocaleConfig
::
IsSuggested
(
languageBuf
.
data
());
}
napi_value
result
;
status
=
napi_get_boolean
(
env
,
isSuggested
,
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Create case first boolean value failed"
);
return
nullptr
;
}
return
result
;
}
napi_value
I18nAddon
::
SetSystemLanguage
(
napi_env
env
,
napi_callback_info
info
)
{
size_t
argc
=
1
;
napi_value
argv
[
1
]
=
{
0
};
napi_value
thisVar
=
nullptr
;
void
*
data
=
nullptr
;
napi_status
status
=
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
&
thisVar
,
&
data
);
size_t
len
;
napi_get_value_string_utf8
(
env
,
argv
[
0
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
languageBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
0
],
languageBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
bool
success
=
LocaleConfig
::
SetSystemLanguage
(
languageBuf
.
data
());
napi_value
result
;
status
=
napi_get_boolean
(
env
,
success
,
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Create set system language boolean value failed"
);
return
nullptr
;
}
return
result
;
}
napi_value
I18nAddon
::
SetSystemRegion
(
napi_env
env
,
napi_callback_info
info
)
{
size_t
argc
=
1
;
napi_value
argv
[
1
]
=
{
0
};
napi_value
thisVar
=
nullptr
;
void
*
data
=
nullptr
;
napi_status
status
=
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
&
thisVar
,
&
data
);
size_t
len
;
napi_get_value_string_utf8
(
env
,
argv
[
0
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
regionBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
0
],
regionBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
bool
success
=
LocaleConfig
::
SetSystemRegion
(
regionBuf
.
data
());
napi_value
result
;
status
=
napi_get_boolean
(
env
,
success
,
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Create set system language boolean value failed"
);
return
nullptr
;
}
return
result
;
}
napi_value
I18nAddon
::
SetSystemLocale
(
napi_env
env
,
napi_callback_info
info
)
{
size_t
argc
=
1
;
napi_value
argv
[
1
]
=
{
0
};
napi_value
thisVar
=
nullptr
;
void
*
data
=
nullptr
;
napi_status
status
=
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
&
thisVar
,
&
data
);
size_t
len
;
napi_get_value_string_utf8
(
env
,
argv
[
0
],
nullptr
,
0
,
&
len
);
std
::
vector
<
char
>
localeBuf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
0
],
localeBuf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Failed to get string item"
);
return
nullptr
;
}
bool
success
=
LocaleConfig
::
SetSystemLocale
(
localeBuf
.
data
());
napi_value
result
;
status
=
napi_get_boolean
(
env
,
success
,
&
result
);
if
(
status
!=
napi_ok
)
{
HiLog
::
Error
(
LABEL
,
"Create set system language boolean value failed"
);
return
nullptr
;
}
return
result
;
}
napi_value
Init
(
napi_env
env
,
napi_value
exports
)
{
return
I18nAddon
::
Init
(
env
,
exports
);
}
static
napi_module
g_i18nModule
=
{
.
nm_version
=
1
,
.
nm_flags
=
0
,
.
nm_filename
=
nullptr
,
.
nm_register_func
=
Init
,
.
nm_modname
=
"i18n"
,
.
nm_priv
=
((
void
*
)
0
),
.
reserved
=
{
0
}
};
extern
"C"
__attribute__
((
constructor
))
void
I18nRegister
()
{
napi_module_register
(
&
g_i18nModule
);
}
}
// namespace I18n
}
// namespace Global
}
// namespace OHOS
\ No newline at end of file
ohos.build
浏览文件 @
3a16db46
...
...
@@ -6,6 +6,7 @@
"//base/global/i18n_standard/frameworks/zone:zone_util",
"//base/global/i18n_standard/frameworks/intl:intl_util",
"//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",
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录