Skip to content

Commit

Permalink
explicit set locale default value (DataLinkDC#2376)
Browse files Browse the repository at this point in the history
* refactor: explicit set default locale

* fix: task information changed function

* Spotless Apply

---------

Co-authored-by: leechor <leechor@users.noreply.github.com>
  • Loading branch information
leechor and leechor authored Oct 11, 2023
1 parent b4b18f7 commit 96576a9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions dinky-common/src/main/java/org/dinky/utils/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ const TokenModalForm: React.FC<TokenModalFormProps & connect> = (props) => {
form.setFieldValue('tokenValue', tokenValue);
};


return (
<>
<ModalForm<SysToken>
Expand All @@ -165,7 +164,7 @@ const TokenModalForm: React.FC<TokenModalFormProps & connect> = (props) => {
initialValues={{ ...value }}
modalProps={{
destroyOnClose: true,
onCancel: () => handleCancel(),
onCancel: () => handleCancel()
}}
>
<TokenForm expireType={expireType} buildToken={handleBuildToken} />
Expand Down
1 change: 1 addition & 0 deletions dinky-web/src/pages/DataStudio/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ const DataStudio = (props: any) => {
console.log('changed', key, info[key], params.taskData[key]);
return true;
}
return false;
});

if (changed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const AlertGroupForm: React.FC<AlertGroupFormProps> = (props) => {
submitter={{ render: () => [...renderFooter()] }}
modalProps={{
destroyOnClose: true,
onCancel: () => handleModalVisible(false),
onCancel: () => handleModalVisible(false)
}}
>
{renderAlertGroupForm()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const ProjectModal: React.FC<ProjectModalProps> = (props) => {
initialValues={values}
modalProps={{
destroyOnClose: true,
onCancel: () => handleCancel(),
onCancel: () => handleCancel()
}}
>
<ProjectForm values={values} form={form} />
Expand Down

0 comments on commit 96576a9

Please sign in to comment.