This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/dev by this push:
new 6c9203a7 fix: setup install language error
6c9203a7 is described below
commit 6c9203a7bef9a7180a2a4b94c93a6ad0dddda4b3
Author: sy-records <[email protected]>
AuthorDate: Wed Sep 11 17:19:39 2024 +0800
fix: setup install language error
---
ui/src/pages/Install/components/FirstStep/index.tsx | 9 ++++++++-
ui/src/pages/Install/index.tsx | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ui/src/pages/Install/components/FirstStep/index.tsx
b/ui/src/pages/Install/components/FirstStep/index.tsx
index cb79fdfb..3c87ac3b 100644
--- a/ui/src/pages/Install/components/FirstStep/index.tsx
+++ b/ui/src/pages/Install/components/FirstStep/index.tsx
@@ -25,6 +25,8 @@ import type { LangsType, FormValue, FormDataType } from
'@/common/interface';
import Progress from '../Progress';
import { getInstallLangOptions } from '@/services';
import { setupInstallLanguage } from '@/utils/localize';
+import { CURRENT_LANG_STORAGE_KEY } from '@/common/constants';
+import { Storage } from '@/utils';
interface Props {
data: FormValue;
@@ -39,10 +41,15 @@ const Index: FC<Props> = ({ visible, data, changeCallback,
nextCallback }) => {
const getLangs = async () => {
const res: LangsType[] = await getInstallLangOptions();
+ const currentLang = Storage.get(CURRENT_LANG_STORAGE_KEY);
+ const selectedLang = currentLang || res[0].value;
+
setLangs(res);
+ setupInstallLanguage(selectedLang);
+
changeCallback({
lang: {
- value: res[0].value,
+ value: selectedLang,
isInvalid: false,
errorMsg: '',
},
diff --git a/ui/src/pages/Install/index.tsx b/ui/src/pages/Install/index.tsx
index 4b43889a..902f23f3 100644
--- a/ui/src/pages/Install/index.tsx
+++ b/ui/src/pages/Install/index.tsx
@@ -280,6 +280,7 @@ const Index: FC = () => {
db_connection_success: res.db_connection_success,
});
if (res && res.config_file_exist) {
+ setupInstallLanguage(Storage.get(CURRENT_LANG_STORAGE_KEY));
if (res.db_connection_success) {
setStep(6);
} else {
@@ -294,7 +295,6 @@ const Index: FC = () => {
useEffect(() => {
configYmlCheck();
- setupInstallLanguage(Storage.get(CURRENT_LANG_STORAGE_KEY));
}, []);
if (loading) {