I want to implment a maven plugin that can generate i18n resource boundle from source according special emum class with special field commont like this:
public enum MyColor implements I18nAble {
/**
* @zh_CN 红色
* @en_US red
*/
RED,
/**
* @zh_CN 蓝色
* @en_US blue
*/
BLUE,
/**
* @zh_CN 绿色
* @en_US green
*/
GREEN,
String i18nCode;
MyColor(String code) {
this.i18nCode = "color." + code;
}
@Override
public String getCode(){
return i18nCode;
}
}
when mvn package
, it generate some xxx.properties files like:
color.red=red
color.blue=blue
color.green=green
color.red=红色
color.blue=蓝色
color.green=绿色
Now I have generated keys already, but I can't extract the comment accurately.(I want to use jdk.javadoc.*
rather than regex
)
jdk: jdk11
not jdk1.8