From ecec69a45ec613532462e7ac723085ec9dbaa9c8 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Thu, 23 Nov 2023 10:32:33 +0800 Subject: [PATCH] =?UTF-8?q?TASK:=20=E6=9E=9A=E4=B8=BE=E7=B1=BB=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/config/exception/BusinessException.java | 6 +++++- .../ai/da/service/impl/WorkspaceServiceImpl.java | 10 +++++----- src/main/resources/messages_en.properties | 14 +++++++++++++- 3 files changed, 23 insertions(+), 7 deletions(-) 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