Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: setup install language error

sy-records6c9203a7bef9
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) {