From 96576a959591de7407210b84638e1f08ba0bff3c Mon Sep 17 00:00:00 2001 From: Licho Date: Wed, 11 Oct 2023 09:14:40 +0800 Subject: [PATCH] explicit set locale default value (#2376) * refactor: explicit set default locale * fix: task information changed function * Spotless Apply --------- Co-authored-by: leechor --- dinky-common/src/main/java/org/dinky/utils/I18n.java | 7 +++++-- .../AuthCenter/Token/component/TokenModalForm/index.tsx | 3 +-- dinky-web/src/pages/DataStudio/index.tsx | 1 + .../Alert/AlertGroup/components/AlertGroupForm/index.tsx | 2 +- .../RegCenter/GitProject/components/ProjectModal/index.tsx | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dinky-common/src/main/java/org/dinky/utils/I18n.java b/dinky-common/src/main/java/org/dinky/utils/I18n.java index 67d7fefab2..fdc268a630 100644 --- a/dinky-common/src/main/java/org/dinky/utils/I18n.java +++ b/dinky-common/src/main/java/org/dinky/utils/I18n.java @@ -34,7 +34,10 @@ public final class I18n { private static final Logger logger = LoggerFactory.getLogger(I18n.class); private static final String MESSAGES_BASE = "i18n.messages"; - private static ResourceBundle bundle; + + static { + Locale.setDefault(Locale.US); + } private I18n() {} @@ -52,7 +55,7 @@ public static void setLocale(Locale l) { } public static String getMessage(String key) { - bundle = ResourceBundle.getBundle(MESSAGES_BASE); + ResourceBundle bundle = ResourceBundle.getBundle(MESSAGES_BASE); String message = bundle.getString(key); if (!JDK_ABOVE_1_8) { message = new String(message.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); diff --git a/dinky-web/src/pages/AuthCenter/Token/component/TokenModalForm/index.tsx b/dinky-web/src/pages/AuthCenter/Token/component/TokenModalForm/index.tsx index 3201b3872c..1a1e25cd2b 100644 --- a/dinky-web/src/pages/AuthCenter/Token/component/TokenModalForm/index.tsx +++ b/dinky-web/src/pages/AuthCenter/Token/component/TokenModalForm/index.tsx @@ -150,7 +150,6 @@ const TokenModalForm: React.FC = (props) => { form.setFieldValue('tokenValue', tokenValue); }; - return ( <> @@ -165,7 +164,7 @@ const TokenModalForm: React.FC = (props) => { initialValues={{ ...value }} modalProps={{ destroyOnClose: true, - onCancel: () => handleCancel(), + onCancel: () => handleCancel() }} > diff --git a/dinky-web/src/pages/DataStudio/index.tsx b/dinky-web/src/pages/DataStudio/index.tsx index 4570e2759b..557267fd09 100644 --- a/dinky-web/src/pages/DataStudio/index.tsx +++ b/dinky-web/src/pages/DataStudio/index.tsx @@ -183,6 +183,7 @@ const DataStudio = (props: any) => { console.log('changed', key, info[key], params.taskData[key]); return true; } + return false; }); if (changed) { diff --git a/dinky-web/src/pages/RegCenter/Alert/AlertGroup/components/AlertGroupForm/index.tsx b/dinky-web/src/pages/RegCenter/Alert/AlertGroup/components/AlertGroupForm/index.tsx index c9d50eed99..edc3f9eb40 100644 --- a/dinky-web/src/pages/RegCenter/Alert/AlertGroup/components/AlertGroupForm/index.tsx +++ b/dinky-web/src/pages/RegCenter/Alert/AlertGroup/components/AlertGroupForm/index.tsx @@ -149,7 +149,7 @@ const AlertGroupForm: React.FC = (props) => { submitter={{ render: () => [...renderFooter()] }} modalProps={{ destroyOnClose: true, - onCancel: () => handleModalVisible(false), + onCancel: () => handleModalVisible(false) }} > {renderAlertGroupForm()} diff --git a/dinky-web/src/pages/RegCenter/GitProject/components/ProjectModal/index.tsx b/dinky-web/src/pages/RegCenter/GitProject/components/ProjectModal/index.tsx index fccdaea40f..9fc0482e81 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/components/ProjectModal/index.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/components/ProjectModal/index.tsx @@ -111,7 +111,7 @@ const ProjectModal: React.FC = (props) => { initialValues={values} modalProps={{ destroyOnClose: true, - onCancel: () => handleCancel(), + onCancel: () => handleCancel() }} >