后端国际化

This commit is contained in:
chenjianxing 2020-05-17 16:52:28 +08:00
parent 71dd8d531d
commit aa81e1f430
6 changed files with 39 additions and 8 deletions

View File

@ -9,6 +9,7 @@ import io.metersphere.base.mapper.TestPlanTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.commons.constants.TestCaseConstants; import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.i18n.Translator;
import io.metersphere.track.dto.TestCaseDTO; import io.metersphere.track.dto.TestCaseDTO;
import io.metersphere.track.dto.TestCaseNodeDTO; import io.metersphere.track.dto.TestCaseNodeDTO;
import io.metersphere.exception.ExcelException; import io.metersphere.exception.ExcelException;
@ -46,7 +47,8 @@ public class TestCaseNodeService {
public String addNode(TestCaseNode node) { public String addNode(TestCaseNode node) {
if(node.getLevel() > TestCaseConstants.MAX_NODE_DEPTH){ if(node.getLevel() > TestCaseConstants.MAX_NODE_DEPTH){
throw new RuntimeException("模块树最大深度为" + TestCaseConstants.MAX_NODE_DEPTH + "层!"); throw new RuntimeException(Translator.get("test_case_node_level_tip")
+ TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level"));
} }
node.setCreateTime(System.currentTimeMillis()); node.setCreateTime(System.currentTimeMillis());
node.setUpdateTime(System.currentTimeMillis()); node.setUpdateTime(System.currentTimeMillis());
@ -243,7 +245,7 @@ public class TestCaseNodeService {
nodePaths.forEach(path -> { nodePaths.forEach(path -> {
if (path == null) { if (path == null) {
throw new ExcelException("所属模块不能为空!"); throw new ExcelException(Translator.get("test_case_module_not_null"));
} }
List<String> nodeNameList = new ArrayList<>(Arrays.asList(path.split("/"))); List<String> nodeNameList = new ArrayList<>(Arrays.asList(path.split("/")));
Iterator<String> pathIterator = nodeNameList.iterator(); Iterator<String> pathIterator = nodeNameList.iterator();
@ -252,7 +254,7 @@ public class TestCaseNodeService {
String rootNodeName = null; String rootNodeName = null;
if (nodeNameList.size() <= 1) { if (nodeNameList.size() <= 1) {
throw new ExcelException("创建模块失败:" + path); throw new ExcelException(Translator.get("test_case_module_not_null") + ":" + path);
} else { } else {
pathIterator.next(); pathIterator.next();
pathIterator.remove(); pathIterator.remove();

View File

@ -224,7 +224,8 @@ public class TestCaseService {
} }
public void testCaseTemplateExport(HttpServletResponse response) { public void testCaseTemplateExport(HttpServletResponse response) {
EasyExcelUtil.export(response, TestCaseExcelData.class, generateExportTemplate(), "测试用例模版", "模版"); EasyExcelUtil.export(response, TestCaseExcelData.class, generateExportTemplate(),
Translator.get("test_case_import_template_name"), Translator.get("test_case_import_template_sheet"));
} }
private List<TestCaseExcelData> generateExportTemplate() { private List<TestCaseExcelData> generateExportTemplate() {

View File

@ -1,2 +1,8 @@
test_case_exist= test_case_exist=
before_delete_plan= before_delete_plan=
test_case_node_level_tip=
test_case_node_level=
test_case_module_not_null=
test_case_create_moule_fail=
test_case_import_template_name=
test_case_import_template_sheet=

View File

@ -24,6 +24,7 @@ cannot_edit_load_test_running=Cannot modify the running test
test_not_found=Test cannot be found: test_not_found=Test cannot be found:
test_not_running=Test is not running test_not_running=Test is not running
before_delete_plan=There is an associated test case under this plan, please unlink it first! before_delete_plan=There is an associated test case under this plan, please unlink it first!
test_case_node_level_tip=The node tree maximum depth is
user_email_already_exists=User email already exists user_email_already_exists=User email already exists
user_name_is_null=User name cannot be null user_name_is_null=User name cannot be null
user_email_is_null=User email cannot be null user_email_is_null=User email cannot be null
@ -34,3 +35,8 @@ api_load_script_error=Load script error
user_id_already_exists=User ID already exists user_id_already_exists=User ID already exists
password_modification_failed=Password modification failed password_modification_failed=Password modification failed
cannot_delete_current_user=Cannot delete the user currently logged in cannot_delete_current_user=Cannot delete the user currently logged in
test_case_node_level=level
test_case_module_not_null=The owned module cannot be empty
test_case_create_moule_fail=Failed to create module
test_case_import_template_name=Test case templates
test_case_import_template_sheet=Template

View File

@ -34,3 +34,11 @@ api_load_script_error=读取脚本失败
user_id_already_exists=用户id已存在 user_id_already_exists=用户id已存在
password_modification_failed=密码修改失败 password_modification_failed=密码修改失败
cannot_delete_current_user=无法删除当前登录用户 cannot_delete_current_user=无法删除当前登录用户
#test case start
test_case_node_level=
test_case_node_level_tip=模块树最大深度为
test_case_module_not_null=所属模块不能为空
test_case_create_moule_fail=创建模块失败
test_case_import_template_name=测试用例模版
test_case_import_template_sheet=模版
#test case end

View File

@ -34,3 +34,11 @@ api_load_script_error=讀取腳本失敗
user_id_already_exists=用戶id已存在 user_id_already_exists=用戶id已存在
password_modification_failed=密碼修改失敗 password_modification_failed=密碼修改失敗
cannot_delete_current_user=無法刪除當前登錄用戶 cannot_delete_current_user=無法刪除當前登錄用戶
#test case start
test_case_node_level=
test_case_node_level_tip=模塊樹最大深度為
test_case_module_not_null=所屬模塊不能為空
test_case_create_moule_fail=創建模塊失敗
test_case_import_template_name=測試用例模版
test_case_import_template_sheet=模版
#test case end