⚡ 菜单新建时,可以直接保存对应的国际化信息,以及方便的进行菜单标题国际化的修改
This commit is contained in:
@@ -38,6 +38,14 @@
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
@@ -1,28 +1,39 @@
|
||||
package com.hccake.ballcat.common.i18n;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 对标于 message bundle 的文件消息的抽象
|
||||
*
|
||||
* @author hccake
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("国际化信息")
|
||||
public class I18nMessage {
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
* 国际化标识
|
||||
*/
|
||||
@NotEmpty(message = "{i18nMessage.code}:{}")
|
||||
@ApiModelProperty(value = "国际化标识")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
@NotEmpty(message = "{i18nMessage.message}:{}")
|
||||
@ApiModelProperty(value = "文本值,可以使用 { } 加角标,作为占位符")
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 地区语言标签
|
||||
*/
|
||||
@NotEmpty(message = "{i18nMessage.languageTag}:{}")
|
||||
@ApiModelProperty(value = "语言标签")
|
||||
private String languageTag;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.hccake.ballcat.common.i18n;
|
||||
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* I18nMessage 的创建事件,Listener 监听此事件,进行 I18nMessage 的存储
|
||||
*
|
||||
* @author hccake
|
||||
*/
|
||||
public class I18nMessageCreateEvent extends ApplicationEvent {
|
||||
|
||||
public I18nMessageCreateEvent(List<I18nMessage> i18nMessages) {
|
||||
super(i18nMessages);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<I18nMessage> getI18nMessages() {
|
||||
return (List<I18nMessage>) super.getSource();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
i18nMessage.languageTag=Language Tag
|
||||
i18nMessage.code=Code
|
||||
i18nMessage.message=Message
|
||||
@@ -0,0 +1,3 @@
|
||||
i18nMessage.languageTag=Language Tag
|
||||
i18nMessage.code=Code
|
||||
i18nMessage.message=Message
|
||||
@@ -0,0 +1,3 @@
|
||||
i18nMessage.languageTag=\u8BED\u8A00\u6807\u7B7E
|
||||
i18nMessage.code=\u56FD\u9645\u5316\u6807\u8BC6
|
||||
i18nMessage.message=\u6587\u672C\u503C
|
||||
Reference in New Issue
Block a user