summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src/main
diff options
context:
space:
mode:
authoryoubowu <wu.youbo@zte.com.cn>2017-02-24 17:32:24 +0800
committer6092002067 <wu.youbo@zte.com.cn>2017-02-24 17:35:17 +0800
commited7905e254f35d19cc68efb991262419e19b6e06 (patch)
tree568a27131113da6ba22ee05fcc6fe0e6ec8d8e4d /holmes-actions/src/main
parent30dbb0ad8f14302718c2091b7ab16190baa647bc (diff)
Add internationalization parameters
Issue-ID:HOLMES-9 Change-Id: I99d66a3e11ab736288785cab5dfad4fe7de1a6a2 Signed-off-by: youbowu <wu.youbo@zte.com.cn>
Diffstat (limited to 'holmes-actions/src/main')
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json11
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json11
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java14
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java5
4 files changed, 18 insertions, 23 deletions
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json
index 9581b40..8288f6e 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json
+++ b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json
@@ -16,15 +16,14 @@
"RULE_MANAGEMENT__CALL_CHECK_RULE_REST_FAILED": "From the rules engine calls the check of interface failure",
"RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED": "Create query exception",
"RULE_MANAGEMENT_QUERY_RULE_FAILED": "Query rule failed",
- "RULE_MANAGEMENT_CREATE_RULE_FAILED": "Failed to create rule",
- "RULE_MANAGEMENT_DELETE_RULE_FAILED": "Delete rule failed",
- "RULE_MANAGEMENT_UPDATE_RULE_FAILED": "Update rule failed",
"RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY": "Request object is empty",
"RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE": "Rule does not exist",
- "RULE_MANAGEMENT_UNKNOWN_EXCEPTION": "Unknown exception",
"RULE_MANAGEMENT_REPEAT_RULE_NAME": "Rule name repetition",
- "RULE_MANAGEMENT_RULE_NAME_IS_EMPTY": "Rule name is empty",
+ "RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY": "Rule name cannot be empty",
"RULE_MANAGEMENT_DATA_FORMAT_ERROR": "Data format error",
"RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR": "Parameter enabled can only be 0 (not enabled) and 1 (enabled)",
- "RULE_MANAGEMENT_DB_ERROR": "db error"
+ "RULE_MANAGEMENT_DB_ERROR": "db error",
+ "RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR":"Parsing call deployment rule return the result of the failure",
+ "RULE_MANAGEMENT_CHECK_NO_PASS":"Content inspection not by rule",
+ "RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY":"Content cannot be empty"
}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json
index 1a59c2f..347986a 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json
+++ b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json
@@ -12,16 +12,15 @@
"RULE_MANAGEMENT__CALL_CHECK_RULE_REST_FAILED": "从引擎调用校验规则接口失败",
"RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED": "创建查询语句异常",
"RULE_MANAGEMENT_QUERY_RULE_FAILED": "查询规则失败",
- "RULE_MANAGEMENT_CREATE_RULE_FAILED": "创建规则失败",
- "RULE_MANAGEMENT_DELETE_RULE_FAILED": "删除规则失败",
- "RULE_MANAGEMENT_UPDATE_RULE_FAILED": "更新规则失败",
"RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY":"请求对象为空",
"RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE": "规则不存在",
- "RULE_MANAGEMENT_UNKNOWN_EXCEPTION": "未知异常",
"RULE_MANAGEMENT_REPEAT_RULE_NAME" : "规则名字重复",
- "RULE_MANAGEMENT_RULE_NAME_IS_EMPTY" : "规则名字为空",
+ "RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY" : "规则名字不能为空",
"RULE_MANAGEMENT_DATA_FORMAT_ERROR": "数据格式异常",
"RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR" : "参数enabled只能为0(未启用)和1(启用)",
- "RULE_MANAGEMENT_DB_ERROR" : "数据库异常"
+ "RULE_MANAGEMENT_DB_ERROR" : "数据库异常",
+ "RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR":"解析调用部署规则返回的结果错误",
+ "RULE_MANAGEMENT_CHECK_NO_PASS":"规则内容检查不通过",
+ "RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY":"规则内容不能为空"
}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java
index 2c74f03..75aacb9 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java
+++ b/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java
@@ -41,18 +41,16 @@ public class I18nProxy {
public static final String RULE_MANAGEMENT__CALL_CHECK_RULE_REST_FAILED = "RULE_MANAGEMENT__CALL_CHECK_RULE_REST_FAILED";
public static final String RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED = "RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED";
public static final String RULE_MANAGEMENT_QUERY_RULE_FAILED = "RULE_MANAGEMENT_QUERY_RULE_FAILED";
- public static final String RULE_MANAGEMENT_CREATE_RULE_FAILED = "RULE_MANAGEMENT_CREATE_RULE_FAILED";
- public static final String RULE_MANAGEMENT_DELETE_RULE_FAILED = "RULE_MANAGEMENT_DELETE_RULE_FAILED";
- public static final String RULE_MANAGEMENT_UPDATE_RULE_FAILED = "RULE_MANAGEMENT_UPDATE_RULE_FAILED";
public static final String RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY = "RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY";
- public static final String RULE_MANAGEMENT_RULE_NAME_IS_EMPTY = "RULE_MANAGEMENT_RULE_NAME_IS_EMPTY";
+ public static final String RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY = "RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY";
public static final String RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE = "RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE";
- public static final String RULE_MANAGEMENT_UNKNOWN_EXCEPTION = "RULE_MANAGEMENT_UNKNOWN_EXCEPTION";
public static final String RULE_MANAGEMENT_REPEAT_RULE_NAME = "RULE_MANAGEMENT_REPEAT_RULE_NAME";
public static final String RULE_MANAGEMENT_DATA_FORMAT_ERROR = "RULE_MANAGEMENT_DATA_FORMAT_ERROR";
public static final String RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR = "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR";
public static final String RULE_MANAGEMENT_DB_ERROR = "RULE_MANAGEMENT_DB_ERROR";
-
+ public static final String RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR = "RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR";
+ public static final String RULE_MANAGEMENT_CHECK_NO_PASS = "RULE_MANAGEMENT_CHECK_NO_PASS";
+ public static final String RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY = "RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY";
private Optional<I18n> optional = null;
private I18nProxy() {
@@ -94,9 +92,9 @@ public class I18nProxy {
try {
value = JacksonUtil.beanToJson(optional.get().getLabelValues(key, args));
} catch (JsonProcessingException e) {
- log.info("get i18n error, key is :" + key, e);
+ log.warn("get i18n error, key is :" + key, e);
} catch (IllegalArgumentException e) {
- log.info("get i18n error IllegalArgumentException, key is :" + key + ",args is : " + Arrays.toString(args),
+ log.warn("get i18n error IllegalArgumentException, key is :" + key + ",args is : " + Arrays.toString(args),
e);
}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java
index 484b9a4..571ecee 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java
+++ b/holmes-actions/src/main/java/org/openo/holmes/common/utils/LanguageUtil.java
@@ -27,7 +27,7 @@ public class LanguageUtil {
public static String getLanguage(HttpServletRequest servletRequest) {
String language = (String) servletRequest.getHeader("language-option");
if (JudgeNullUtil.isEmpty(language)) {
- language = AlarmConst.ZH_CN;
+ language = AlarmConst.I18N_EN;
}
if (language.startsWith(AlarmConst.I18N_ZH)) {
language = AlarmConst.I18N_ZH;
@@ -47,7 +47,6 @@ public class LanguageUtil {
} else if (language.startsWith(AlarmConst.I18N_EN)) {
language = AlarmConst.I18N_EN;
}
- Locale locale = new Locale(language);
- return locale;
+ return new Locale(language);
}
}