diff --git a/src/main/java/com/ai/da/common/config/exception/BusinessException.java b/src/main/java/com/ai/da/common/config/exception/BusinessException.java index 35774162..46f24694 100644 --- a/src/main/java/com/ai/da/common/config/exception/BusinessException.java +++ b/src/main/java/com/ai/da/common/config/exception/BusinessException.java @@ -53,7 +53,11 @@ public class BusinessException extends RuntimeException { return new Locale(Language.valueOf(userInfo.getLanguage()).getValue()); } - private static String getMessageFromResource(String msg, Locale userLocale) { + public static String getMessageFromResource(String msg) { + return getMessageFromResource(msg, getUserLocale()); + } + + public static String getMessageFromResource(String msg, Locale userLocale) { try (InputStream inputStream = BusinessException.class.getClassLoader().getResourceAsStream("messages_" + userLocale.getLanguage() + ".properties")) { if (inputStream != null) { ResourceBundle bundle = new PropertyResourceBundle(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); diff --git a/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java b/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java index 0bcd1c9f..01f2064a 100644 --- a/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java @@ -196,8 +196,8 @@ public class WorkspaceServiceImpl extends ServiceImpl kvs = new ArrayList(); IEnumDisplay[] items = (IEnumDisplay[]) clazz.getEnumConstants(); for (IEnumDisplay item : items) { - kvs.add(new BizJson(item.getValue(), item.name(), null)); + kvs.add(new BizJson(item.getValue(), item.name(), BusinessException.getMessageFromResource(item.name()))); } return kvs; } diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties index ec32a4d5..25febc3e 100644 --- a/src/main/resources/messages_en.properties +++ b/src/main/resources/messages_en.properties @@ -161,4 +161,16 @@ processSketchBoards.interface.exception=We encountered an error uploading sketch designProcess.interface.exception=There's been an issue loading the progress bar. (Please try again later. If this issue persists, please contact us at help@aida.com.hk.) generate.interface.exception=We are currently experiencing a high volume of generating requests. (Please try again later. If the problem continues, reach out to us at help@aida.com.hk for support.) generate.interface.error=We encountered an error with the generate interface. (Please try again later. If this issue persists, please contact us at help@aida.com.hk.) -chat-bot.interface.exception=We encountered an error with the chat robot interface.(Please try again later. If this issue persists, please contact us at help@aida.com.hk.) \ No newline at end of file +chat-bot.interface.exception=We encountered an error with the chat robot interface.(Please try again later. If this issue persists, please contact us at help@aida.com.hk.) + +# 多语言返回 +OVERALL=Overall +TOPS=Tops +BOTTOMS=Bottoms +OUTWEAR=Outwear +BLOUSE=Blouse +DRESS=Dress +TROUSERS=Trousers +SKIRT=Skirt +FEMALE=Female +MALE=Male \ No newline at end of file