Compare commits

...

4 Commits

Author SHA1 Message Date
Zaiming (Stone) Shi 3f9bf9a159 build: check i18n style earlier 2023-03-28 21:48:27 +02:00
Zaiming (Stone) Shi f4d3cf4c33 docs: fix i18n desc style 2023-03-28 21:42:03 +02:00
Zaiming (Stone) Shi f25e8680be refactor(merge-i18n.escript): merge files in rel/i18n 2023-03-28 20:33:39 +02:00
Zaiming (Stone) Shi 1ada840bc9 refactor: relocate i18n files for apps/emqx 2023-03-28 20:33:39 +02:00
95 changed files with 28 additions and 76 deletions

View File

@ -82,7 +82,7 @@ ct: $(REBAR) merge-config
static_checks: static_checks:
@$(REBAR) as check do xref, dialyzer @$(REBAR) as check do xref, dialyzer
@if [ "$${PROFILE}" = 'emqx-enterprise' ]; then $(REBAR) ct --suite apps/emqx/test/emqx_static_checks --readable $(CT_READABLE); fi @if [ "$${PROFILE}" = 'emqx-enterprise' ]; then $(REBAR) ct --suite apps/emqx/test/emqx_static_checks --readable $(CT_READABLE); fi
@if [ "$${PROFILE}" = 'emqx-enterprise' ]; then ./scripts/check-i18n-style.sh; fi ./scripts/check-i18n-style.sh
APPS=$(shell $(SCRIPTS)/find-apps.sh) APPS=$(shell $(SCRIPTS)/find-apps.sh)

View File

@ -6,11 +6,9 @@ emqx_ee_bridge_clickhouse {
matching the local_topic will be forwarded.</br> matching the local_topic will be forwarded.</br>
NOTE: if this bridge is used as the action of a rule (EMQX rule engine), and also local_topic is NOTE: if this bridge is used as the action of a rule (EMQX rule engine), and also local_topic is
configured, then both the data got from the rule and the MQTT messages that match local_topic configured, then both the data got from the rule and the MQTT messages that match local_topic
will be forwarded. will be forwarded."""
"""
zh: """发送到 'local_topic' 的消息都会转发到 Clickhouse。 </br> zh: """发送到 'local_topic' 的消息都会转发到 Clickhouse。 </br>
注意:如果这个 Bridge 被用作规则EMQX 规则引擎)的输出,同时也配置了 'local_topic' ,那么这两部分的消息都会被转发。 注意:如果这个 Bridge 被用作规则EMQX 规则引擎)的输出,同时也配置了 'local_topic' ,那么这两部分的消息都会被转发。"""
"""
} }
label { label {
en: "Local Topic" en: "Local Topic"

View File

@ -546,7 +546,7 @@ emqx_ee_bridge_kafka {
"<code>ts</code>: message timestamp.\n" "<code>ts</code>: message timestamp.\n"
"<code>ts_type</code>: message timestamp type, which is one of" "<code>ts_type</code>: message timestamp type, which is one of"
" <code>create</code>, <code>append</code> or <code>undefined</code>.\n" " <code>create</code>, <code>append</code> or <code>undefined</code>.\n"
"<code>value</code>: Kafka message value (uses the chosen value encoding).\n" "<code>value</code>: Kafka message value (uses the chosen value encoding)."
zh: "用于转换收到的 Kafka 消息的模板。 " zh: "用于转换收到的 Kafka 消息的模板。 "
"默认情况下,它将使用 JSON 格式来序列化来自 Kafka 的所有字段。 " "默认情况下,它将使用 JSON 格式来序列化来自 Kafka 的所有字段。 "
"这些字段包括:" "这些字段包括:"
@ -557,7 +557,7 @@ emqx_ee_bridge_kafka {
"<code>ts</code>: 消息的时间戳。\n" "<code>ts</code>: 消息的时间戳。\n"
"<code>ts_type</code>:消息的时间戳类型,值可能是:" "<code>ts_type</code>:消息的时间戳类型,值可能是:"
" <code>create</code> <code>append</code> 或 <code>undefined</code>。\n" " <code>create</code> <code>append</code> 或 <code>undefined</code>。\n"
"<code>value</code>: Kafka 消息值(使用选择的编码方式编码)。\n" "<code>value</code>: Kafka 消息值(使用选择的编码方式编码)。"
} }
label { label {

View File

@ -6,11 +6,9 @@ emqx_ee_bridge_tdengine {
matching the local_topic will be forwarded.</br> matching the local_topic will be forwarded.</br>
NOTE: if this bridge is used as the action of a rule (EMQX rule engine), and also local_topic is NOTE: if this bridge is used as the action of a rule (EMQX rule engine), and also local_topic is
configured, then both the data got from the rule and the MQTT messages that match local_topic configured, then both the data got from the rule and the MQTT messages that match local_topic
will be forwarded. will be forwarded."""
"""
zh: """发送到 'local_topic' 的消息都会转发到 TDengine。 </br> zh: """发送到 'local_topic' 的消息都会转发到 TDengine。 </br>
注意:如果这个 Bridge 被用作规则EMQX 规则引擎)的输出,同时也配置了 'local_topic' ,那么这两部分的消息都会被转发。 注意:如果这个 Bridge 被用作规则EMQX 规则引擎)的输出,同时也配置了 'local_topic' ,那么这两部分的消息都会被转发。"""
"""
} }
label { label {
en: "Local Topic" en: "Local Topic"

View File

@ -1,4 +1,3 @@
emqx_ee_connector_clickhouse { emqx_ee_connector_clickhouse {
base_url { base_url {

View File

@ -2,8 +2,8 @@ emqx_ee_connector_dynamo {
url { url {
desc { desc {
en: """The url of DynamoDB endpoint.<br/>""" en: """The url of DynamoDB endpoint."""
zh: """DynamoDB 的地址。<br/>""" zh: """DynamoDB 的地址。"""
} }
label: { label: {
en: "DynamoDB Endpoint" en: "DynamoDB Endpoint"

View File

@ -2,16 +2,12 @@ emqx_ee_connector_rocketmq {
server { server {
desc { desc {
en: """ en: """The IPv4 or IPv6 address or the hostname to connect to.<br/>
The IPv4 or IPv6 address or the hostname to connect to.<br/>
A host entry has the following form: `Host[:Port]`.<br/> A host entry has the following form: `Host[:Port]`.<br/>
The RocketMQ default port 9876 is used if `[:Port]` is not specified. The RocketMQ default port 9876 is used if `[:Port]` is not specified."""
""" zh: """将要连接的 IPv4 或 IPv6 地址,或者主机名。<br/>
zh: """
将要连接的 IPv4 或 IPv6 地址,或者主机名。<br/>
主机名具有以下形式:`Host[:Port]`。<br/> 主机名具有以下形式:`Host[:Port]`。<br/>
如果未指定 `[:Port]`,则使用 RocketMQ 默认端口 9876。 如果未指定 `[:Port]`,则使用 RocketMQ 默认端口 9876。"""
"""
} }
label: { label: {
en: "Server Host" en: "Server Host"

View File

@ -2,16 +2,12 @@ emqx_ee_connector_tdengine {
server { server {
desc { desc {
en: """ en: """The IPv4 or IPv6 address or the hostname to connect to.<br/>
The IPv4 or IPv6 address or the hostname to connect to.<br/>
A host entry has the following form: `Host[:Port]`.<br/> A host entry has the following form: `Host[:Port]`.<br/>
The TDengine default port 6041 is used if `[:Port]` is not specified. The TDengine default port 6041 is used if `[:Port]` is not specified."""
""" zh: """将要连接的 IPv4 或 IPv6 地址,或者主机名。<br/>
zh: """
将要连接的 IPv4 或 IPv6 地址,或者主机名。<br/>
主机名具有以下形式:`Host[:Port]`。<br/> 主机名具有以下形式:`Host[:Port]`。<br/>
如果未指定 `[:Port]`,则使用 TDengine 默认端口 6041。 如果未指定 `[:Port]`,则使用 TDengine 默认端口 6041。"""
"""
} }
label: { label: {
en: "Server Host" en: "Server Host"

View File

@ -1,4 +1,3 @@
emqx_mgmt_api_publish { emqx_mgmt_api_publish {
publish_api { publish_api {
desc { desc {

View File

@ -1503,8 +1503,8 @@ In case PSK cipher suites are intended, make sure to configure
common_ssl_opts_schema_hibernate_after { common_ssl_opts_schema_hibernate_after {
desc { desc {
en: """ Hibernate the SSL process after idling for amount of time reducing its memory footprint. """ en: """Hibernate the SSL process after idling for amount of time reducing its memory footprint."""
zh: """ 在闲置一定时间后休眠 SSL 进程,减少其内存占用。""" zh: """在闲置一定时间后休眠 SSL 进程,减少其内存占用。"""
} }
label: { label: {
en: "hibernate after" en: "hibernate after"

View File

@ -1,5 +1,7 @@
#!/usr/bin/env escript #!/usr/bin/env escript
%% called from check-i18n-style.sh
-mode(compile). -mode(compile).
-define(YELLOW, "\e[33m"). -define(YELLOW, "\e[33m").

View File

@ -3,6 +3,6 @@ set -euo pipefail
cd -P -- "$(dirname -- "$0")/.." cd -P -- "$(dirname -- "$0")/.."
all_files="$(git ls-files '*i18n*.conf')" all_files="$(git ls-files 'rel/i18n/*.hocon')"
./scripts/check-i18n-style.escript "$all_files" ./scripts/check-i18n-style.escript "$all_files"

View File

@ -4,12 +4,8 @@
main(_) -> main(_) ->
BaseConf = <<"">>, BaseConf = <<"">>,
Cfgs0 = get_all_cfgs("apps/"), Cfgs0 = get_all_files(),
Cfgs1 = get_all_cfgs("lib-ee/"), Conf = merge(BaseConf, Cfgs0),
Conf0 = merge(BaseConf, Cfgs0),
Conf = [merge(Conf0, Cfgs1),
io_lib:nl()
],
OutputFile = "apps/emqx_dashboard/priv/i18n.conf", OutputFile = "apps/emqx_dashboard/priv/i18n.conf",
ok = filelib:ensure_dir(OutputFile), ok = filelib:ensure_dir(OutputFile),
ok = file:write_file(OutputFile, Conf). ok = file:write_file(OutputFile, Conf).
@ -25,39 +21,7 @@ merge(BaseConf, Cfgs) ->
end end
end, BaseConf, Cfgs). end, BaseConf, Cfgs).
get_all_cfgs(Root) -> get_all_files() ->
Apps = filelib:wildcard("*", Root) -- ["emqx_machine"], Dir = filename:join(["rel","i18n"]),
Dirs = [filename:join([Root, App]) || App <- Apps], Files = filelib:wildcard("*.hocon", Dir),
lists:foldl(fun get_cfgs/2, [], Dirs). lists:map(fun(Name) -> filename:join([Dir, Name]) end, Files).
get_all_cfgs(Dir, Cfgs) ->
Fun = fun(E, Acc) ->
Path = filename:join([Dir, E]),
get_cfgs(Path, Acc)
end,
lists:foldl(Fun, Cfgs, filelib:wildcard("*", Dir)).
get_cfgs(Dir, Cfgs) ->
case filelib:is_dir(Dir) of
false ->
Cfgs;
_ ->
Files = filelib:wildcard("*", Dir),
case lists:member("i18n", Files) of
false ->
try_enter_child(Dir, Files, Cfgs);
true ->
EtcDir = filename:join([Dir, "i18n"]),
Confs = filelib:wildcard("*.conf", EtcDir),
NewCfgs = [filename:join([EtcDir, Name]) || Name <- Confs],
try_enter_child(Dir, Files, NewCfgs ++ Cfgs)
end
end.
try_enter_child(Dir, Files, Cfgs) ->
case lists:member("src", Files) of
false ->
Cfgs;
true ->
get_all_cfgs(filename:join([Dir, "src"]), Cfgs)
end.