refactor: 国际化

This commit is contained in:
wangjiahao 2022-05-10 10:43:39 +08:00
parent 41c13cf0a1
commit 700a19b86a
4 changed files with 20 additions and 6 deletions

View File

@ -4,6 +4,8 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysRole;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
@ -122,17 +124,17 @@ public class SysUserController {
Long userId = AuthUtils.getUser().getUserId();
// 防止修改他人信息 防止必填内容留空
if (!request.getUserId().equals(userId) || request.getEmail() == null || request.getNickName() == null) {
throw new RuntimeException("内容不合法");
DataEaseException.throwException(Translator.get("i18n_wrong_content"));
}
// 再次验证匹配格式
if (!request.getPhone().isEmpty() && !request.getPhone().matches("^1[3|4|5|7|8][0-9]{9}$")) {
throw new RuntimeException("电话格式错误");
DataEaseException.throwException(Translator.get("i18n_wrong_tel"));
}
if (!request.getEmail().matches("^[a-zA-Z0-9_._-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$")) {
throw new RuntimeException("邮箱格式错误");
DataEaseException.throwException(Translator.get("i18n_wrong_email"));
}
if (!(2 <= request.getNickName().length() && request.getNickName().length() <= 50)) {
throw new RuntimeException("姓名格式错误");
DataEaseException.throwException(Translator.get("i18n_wrong_name_format"));
}
sysUserService.updatePersonBasicInfo(request);
}

View File

@ -123,4 +123,8 @@ theme_name_empty=name can not be empty
i18n_public_chart=【Public Chart】
i18n_class_blue=Blue Tone
插件管理=Plugins
i18n_plugin_not_allow_delete=The plugin in in use cannot be deleted
i18n_plugin_not_allow_delete=The plugin in in use cannot be deleted
i18n_wrong_content=Wrong content
i18n_wrong_tel=Wrong tel format
i18n_wrong_email=Wrong email format
i18n_wrong_name_format=Wrong name format

View File

@ -123,4 +123,8 @@ i18n_public_chart=【存量视图】
i18n_class_blue=蓝色调
插件管理=插件管理
i18n_plugin_not_allow_delete=正在使用的插件不允许删除
i18n_wrong_content=内容不合法
i18n_wrong_tel=电话格式错误
i18n_wrong_email=邮箱格式错误
i18n_wrong_name_format=姓名格式错误

View File

@ -123,4 +123,8 @@ theme_name_empty=名稱不能為空
i18n_public_chart=【存量视图】
i18n_class_blue=蓝色调
插件管理=插件管理
i18n_plugin_not_allow_delete=正在使用的插件不允許刪除
i18n_plugin_not_allow_delete=正在使用的插件不允許刪除
i18n_wrong_content=內容不合法
i18n_wrong_tel=電話格式錯誤
i18n_wrong_email=郵箱格式錯誤
i18n_wrong_name_format=姓名格式錯誤