mirror of https://github.com/halo-dev/halo
🎨 翻译部分页面
parent
ce3a596c76
commit
cc7552d989
|
@ -61,6 +61,8 @@ Let's start: http://localhost:8090
|
|||
|
||||
[宋浩志博客](http://songhaozhi.com)
|
||||
|
||||
[KingYiFan'S Blog](https://blog.cnbuilder.cn)
|
||||
|
||||
## Download
|
||||
|
||||
> For deployment to the server, please refer to [Halo部署教程](https://ryanc.cc/archives/halo-run-with-git-maven) or [Wiki](https://github.com/ruibaby/halo/wiki).
|
||||
|
|
|
@ -61,6 +61,8 @@ Let's start: http://localhost:8090
|
|||
|
||||
[宋浩志博客](http://songhaozhi.com)
|
||||
|
||||
[KingYiFan'S Blog](https://blog.cnbuilder.cn)
|
||||
|
||||
## 下载部署
|
||||
|
||||
> 如需部署到服务器,请参考[Halo部署教程](https://ryanc.cc/archives/halo-run-with-git-maven)或者[Wiki](https://github.com/ruibaby/halo/wiki)。
|
||||
|
|
|
@ -11,6 +11,7 @@ import cc.ryanc.halo.service.GalleryService;
|
|||
import cc.ryanc.halo.service.LinkService;
|
||||
import cc.ryanc.halo.service.LogsService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.utils.LocaleMessageUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
|
@ -59,6 +60,9 @@ public class PageController {
|
|||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Autowired
|
||||
LocaleMessageUtil localeMessageUtil;
|
||||
|
||||
/**
|
||||
* 页面管理页面
|
||||
*
|
||||
|
@ -193,9 +197,9 @@ public class PageController {
|
|||
galleryService.removeByGalleryId(galleryId);
|
||||
} catch (Exception e) {
|
||||
log.error("删除图片失败:{}", e.getMessage());
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "删除失败!");
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.delete-failed"));
|
||||
}
|
||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "删除成功!");
|
||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.common.delete-success"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -218,7 +222,7 @@ public class PageController {
|
|||
@PostMapping(value = "/new/push")
|
||||
@ResponseBody
|
||||
public JsonResult pushPage(@ModelAttribute Post post, HttpSession session) {
|
||||
String msg = "发表成功";
|
||||
String msg = localeMessageUtil.getMessage("code.admin.common.save-success");
|
||||
try {
|
||||
post.setPostDate(DateUtil.date());
|
||||
//发表用户
|
||||
|
@ -229,7 +233,7 @@ public class PageController {
|
|||
post.setPostViews(postService.findByPostId(post.getPostId()).get().getPostViews());
|
||||
post.setPostDate(postService.findByPostId(post.getPostId()).get().getPostDate());
|
||||
post.setPostUpdate(DateUtil.date());
|
||||
msg = "更新成功";
|
||||
msg = localeMessageUtil.getMessage("code.admin.common.update-success");
|
||||
} else {
|
||||
post.setPostDate(DateUtil.date());
|
||||
post.setPostUpdate(DateUtil.date());
|
||||
|
@ -243,7 +247,7 @@ public class PageController {
|
|||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("保存页面失败:{}", e.getMessage());
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "保存失败");
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.save-failed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import cc.ryanc.halo.service.LogsService;
|
|||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.service.TagService;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import cc.ryanc.halo.utils.LocaleMessageUtil;
|
||||
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
|
@ -64,6 +65,9 @@ public class PostController extends BaseController {
|
|||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Autowired
|
||||
private LocaleMessageUtil localeMessageUtil;
|
||||
|
||||
/**
|
||||
* 去除html,htm后缀,以及将空格替换成-
|
||||
*
|
||||
|
@ -165,7 +169,7 @@ public class PostController extends BaseController {
|
|||
@ResponseBody
|
||||
public JsonResult pushPost(@ModelAttribute Post post, @RequestParam("cateList") List<String> cateList, @RequestParam("tagList") String tagList, HttpSession session) {
|
||||
User user = (User) session.getAttribute(HaloConst.USER_SESSION_KEY);
|
||||
String msg = "发表成功";
|
||||
String msg = localeMessageUtil.getMessage("code.admin.common.save-success");
|
||||
try {
|
||||
//提取摘要
|
||||
int postSummary = 50;
|
||||
|
@ -186,7 +190,7 @@ public class PostController extends BaseController {
|
|||
post.setPostDate(oldPost.getPostDate());
|
||||
post.setPostUpdate(DateUtil.date());
|
||||
post.setPostViews(oldPost.getPostViews());
|
||||
msg = "更新成功";
|
||||
msg = localeMessageUtil.getMessage("code.admin.common.update-success");
|
||||
} else {
|
||||
post.setPostDate(DateUtil.date());
|
||||
post.setPostUpdate(DateUtil.date());
|
||||
|
@ -208,7 +212,7 @@ public class PostController extends BaseController {
|
|||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("保存文章失败:{}", e.getMessage());
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "保存失败");
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.save-failed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,9 +265,9 @@ public class PostController extends BaseController {
|
|||
post.setUser(user);
|
||||
} catch (Exception e) {
|
||||
log.error("未知错误:{}", e.getMessage());
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "保存失败");
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.save-failed"));
|
||||
}
|
||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "保存成功", postService.saveByPost(post));
|
||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.common.save-success"), postService.saveByPost(post));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import cc.ryanc.halo.model.domain.User;
|
|||
import cc.ryanc.halo.model.dto.JsonResult;
|
||||
import cc.ryanc.halo.model.enums.ResultCodeEnum;
|
||||
import cc.ryanc.halo.service.UserService;
|
||||
import cc.ryanc.halo.utils.LocaleMessageUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import freemarker.template.Configuration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -35,6 +36,9 @@ public class UserController {
|
|||
@Autowired
|
||||
private Configuration configuration;
|
||||
|
||||
@Autowired
|
||||
private LocaleMessageUtil localeMessageUtil;
|
||||
|
||||
/**
|
||||
* 获取用户信息并跳转
|
||||
*
|
||||
|
@ -66,9 +70,9 @@ public class UserController {
|
|||
session.invalidate();
|
||||
} catch (Exception e) {
|
||||
log.error("修改用户资料失败:{}", e.getMessage());
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "修改失败!");
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.edit-failed"));
|
||||
}
|
||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "修改成功!");
|
||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.common.edit-success"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,12 +97,12 @@ public class UserController {
|
|||
userService.saveByUser(user);
|
||||
session.invalidate();
|
||||
} else {
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "原密码错误!");
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.user.old-password-error"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("修改密码失败:{}", e.getMessage());
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), "密码修改失败!");
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.user.update-password-failed"));
|
||||
}
|
||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), "修改密码成功!");
|
||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.user.update-password-success"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,11 @@ admin.index.widgets.logs-lastest = Newest logs
|
|||
admin.index.widgets.btn.clear-logs = Clear logs
|
||||
admin.index.blog-data.motto = Come on! Don’t forget why you left because you’re too far away.
|
||||
admin.index.blog-data.during = During this period:
|
||||
admin.index.blog-data.posts-count-text = A total of %s posts has been published.
|
||||
admin.index.blog-data.tags-count-text = A total of {0} tags has been created.
|
||||
admin.index.blog-data.comments-count-text = A total of {0} comments was received.
|
||||
admin.index.blog-data.links-count-text = A total of {0} friend chains have been added.
|
||||
admin.index.blog-data.views-count-text = The posts was visited {0} times in total.
|
||||
|
||||
# attachments page
|
||||
admin.attachments.title = Attachments manage
|
||||
|
@ -266,9 +271,17 @@ code.admin.backup.have-new-backup = Have a new backup!
|
|||
code.admin.theme.change-success = Theme has been set to {0}
|
||||
code.admin.theme.change-failed = Theme settings failed!
|
||||
|
||||
code.admin.user.old-password-error = The original password is wrong!
|
||||
code.admin.user.update-password-failed = Failed to change password!
|
||||
code.admin.user.update-password-success = Password has been updated!
|
||||
|
||||
code.admin.common.delete-success = Deleted successfully!
|
||||
code.admin.common.delete-failed = Deleted Failed!
|
||||
code.admin.common.no-post = The mailing mailbox is not configured!
|
||||
|
||||
code.admin.common.save-success = Saved successfully!
|
||||
code.admin.common.save-failed = Save failed!
|
||||
code.admin.common.update-success = Updated successfully!
|
||||
|
||||
code.admin.common.edit-success = Successfully modified!
|
||||
code.admin.common.edit-failed = Fail to update!
|
||||
|
|
|
@ -72,6 +72,11 @@ admin.index.widgets.logs-lastest = 最新日志
|
|||
admin.index.widgets.btn.clear-logs = 清空日志
|
||||
admin.index.blog-data.motto = 加油!不要因为走的太远,而忘了当初为什么出发。
|
||||
admin.index.blog-data.during = 在此期间:
|
||||
admin.index.blog-data.posts-count-text = 累计发表了 {0} 篇文章。
|
||||
admin.index.blog-data.tags-count-text = 累计创建了 {0} 个标签。
|
||||
admin.index.blog-data.comments-count-text = 累计获得了 {0} 条评论。
|
||||
admin.index.blog-data.links-count-text = 累计添加了 {0} 个友链。
|
||||
admin.index.blog-data.views-count-text = 文章总访问 {0} 次。
|
||||
|
||||
# 附件管理页面
|
||||
admin.attachments.title = 附件管理
|
||||
|
@ -229,7 +234,7 @@ common.th.file-type = 文件类型
|
|||
common.status.published = 已发布
|
||||
common.status.checking = 待审核
|
||||
common.status.recycle-bin = 回收站
|
||||
common.status.draft = 草 稿
|
||||
common.status.draft = 草 稿
|
||||
|
||||
common.text.no-data = 暂无数据
|
||||
common.text.tips = 提示
|
||||
|
@ -266,9 +271,17 @@ code.admin.backup.have-new-backup = 有新的备份!
|
|||
code.admin.theme.change-success = 主题已设置为{0}
|
||||
code.admin.theme.change-failed = 主题设置失败!
|
||||
|
||||
code.admin.user.old-password-error = 原密码错误!
|
||||
code.admin.user.update-password-failed = 修改密码失败!
|
||||
code.admin.user.update-password-success = 修改密码成功!
|
||||
|
||||
code.admin.common.delete-success = 删除成功!
|
||||
code.admin.common.delete-failed = 删除失败!
|
||||
code.admin.common.no-post = 发信邮箱没有配置!
|
||||
|
||||
code.admin.common.save-success = 保存成功!
|
||||
code.admin.common.save-failed = 保存失败!
|
||||
code.admin.common.update-success = 更新成功!
|
||||
|
||||
code.admin.common.edit-success = 修改成功!
|
||||
code.admin.common.edit-failed = 修改失败!
|
||||
|
|
|
@ -67,7 +67,7 @@ function initMenu() {
|
|||
function showMsg(text,icon,hideAfter) {
|
||||
$.toast({
|
||||
text: text,
|
||||
heading: '提示',
|
||||
heading: heading,
|
||||
icon: icon,
|
||||
showHideTransition: 'fade',
|
||||
allowToastClose: true,
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
},500);
|
||||
});
|
||||
</#if>
|
||||
var heading = "<@spring.message code='common.text.tips' />";
|
||||
</script>
|
||||
</@compress>
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue