Skip to content

Commit 2fe3fce

Browse files
author
yaojiping
committed
chore: adjust default locale
1 parent 684d268 commit 2fe3fce

5 files changed

Lines changed: 18 additions & 14 deletions

File tree

web/pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/src/locales/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function setupI18n() {
1111
interpolation: {
1212
escapeValue: false
1313
},
14-
lng: localStg.get('lang') || 'zh-CN',
14+
lng: localStg.get('lang') || 'en-US',
1515
resources: locales,
1616
nsSeparator: '___'
1717
});

web/widgets/ui-search/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@emotion/is-prop-valid": "^1.4.0",
6161
"@emotion/react": "^11.14.0",
6262
"@infinilabs/ai-answer": "^0.0.11",
63-
"@infinilabs/ai-chat": "^0.0.23",
63+
"@infinilabs/ai-chat": "^0.0.26",
6464
"@infinilabs/attachments": "^0.0.4",
6565
"@infinilabs/doc-detail": "^0.0.19",
6666
"@infinilabs/filter": "^0.0.14",

web/widgets/ui-search/src/FullscreenModal.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const FullscreenModal = (props) => {
2727
style={{ top: 0, margin: 0, padding: 0, maxWidth: '100vw' }}
2828
width={'100%'}
2929
onCancel={() => setVisible(false)}
30-
destroyOnClose
30+
destroyOnHidden
3131
getContainer={root}
3232
footer={null}
3333
styles={{

web/widgets/ui-search/src/pages/Chat.jsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ import {
44
AssistantList,
55
ChatInput,
66
} from "@infinilabs/ai-chat";
7-
import { useEffect, useRef, useState } from "react";
7+
import { useEffect, useMemo, useRef, useState } from "react";
88
import { useTranslation } from 'react-i18next';
99

1010
import ChatHeader from "../ChatHeader";
1111
import ChatLayout from "../Layout/ChatLayout";
1212

1313
export default function Chat({
1414
commonProps,
15-
language,
1615
apiConfig,
1716
onBackToSearch,
1817
defaultParams,
1918
setDefaultParams,
2019
setAttachments
2120
}) {
2221
const { BaseUrl, Token, endpoint, headers } = apiConfig || {};
22+
const { language } = commonProps || {};
2323

2424
const chatRef = useRef(null);
2525
const { t } = useTranslation();
@@ -62,6 +62,10 @@ export default function Chat({
6262
}
6363
};
6464

65+
const locale = useMemo(() => {
66+
return language === "zh-CN" ? "zh" : "en"
67+
}, [language]);
68+
6569
return (
6670
<ChatLayout
6771
{...commonProps}
@@ -78,14 +82,14 @@ export default function Chat({
7882
}}
7983
Token={Token}
8084
headers={headers}
81-
locale={language === "zh-CN" ? "zh" : "en"}
85+
locale={locale}
8286
t={t}
8387
/>
8488
}
8589
input={
8690
<ChatInput
8791
t={t}
88-
locale={language === "zh-CN" ? "zh" : "en"}
92+
locale={locale}
8993
inputValue={inputValue}
9094
onSend={onSendMessage}
9195
changeInput={setInputValue}
@@ -106,7 +110,7 @@ export default function Chat({
106110
BaseUrl={BaseUrl}
107111
Token={Token}
108112
headers={headers}
109-
locale={language === "zh-CN" ? "zh" : "en"}
113+
locale={locale}
110114
t={t}
111115
/>
112116
}
@@ -121,7 +125,7 @@ export default function Chat({
121125
BaseUrl={BaseUrl}
122126
Token={Token}
123127
headers={headers}
124-
locale={language === "zh-CN" ? "zh" : "en"}
128+
locale={locale}
125129
t={t}
126130
/>
127131
}

0 commit comments

Comments
 (0)