mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-03 05:19:51 +00:00
feat: optimize i18n implementation for better localization (#2062)
* feat: optimize i18n implementation for better localization * delete i18n-ally-custom-framework.yml * update common key
This commit is contained in:
@@ -52,7 +52,7 @@ const ChatHeader = ({
|
||||
<MyIcon name={'history'} w={'14px'} />
|
||||
<Box ml={1}>
|
||||
{history.length === 0
|
||||
? t('core.chat.New Chat')
|
||||
? t('common:core.chat.New Chat')
|
||||
: t('core.chat.History Amount', { amount: history.length })}
|
||||
</Box>
|
||||
</MyTag>
|
||||
|
@@ -86,7 +86,7 @@ const ChatHistorySlider = ({
|
||||
customTitle: item.customTitle,
|
||||
top: item.top
|
||||
}));
|
||||
const newChat: HistoryItemType = { id: activeChatId, title: t('core.chat.New Chat') };
|
||||
const newChat: HistoryItemType = { id: activeChatId, title: t('common:core.chat.New Chat') };
|
||||
const activeChat = histories.find((item) => item.chatId === activeChatId);
|
||||
|
||||
return !activeChat ? [newChat].concat(formatHistories) : formatHistories;
|
||||
@@ -94,8 +94,8 @@ const ChatHistorySlider = ({
|
||||
|
||||
// custom title edit
|
||||
const { onOpenModal, EditModal: EditTitleModal } = useEditTitle({
|
||||
title: t('core.chat.Custom History Title'),
|
||||
placeholder: t('core.chat.Custom History Title Description')
|
||||
title: t('common:core.chat.Custom History Title'),
|
||||
placeholder: t('common:core.chat.Custom History Title Description')
|
||||
});
|
||||
const { openConfirm, ConfirmModal } = useConfirm({
|
||||
content: confirmClearText
|
||||
@@ -164,12 +164,12 @@ const ChatHistorySlider = ({
|
||||
}}
|
||||
list={[
|
||||
...(isTeamChat
|
||||
? [{ label: t('App'), value: TabEnum.recently }]
|
||||
? [{ label: t('common:App'), value: TabEnum.recently }]
|
||||
: [
|
||||
{ label: t('core.chat.Recent use'), value: TabEnum.recently },
|
||||
{ label: t('App'), value: TabEnum.app }
|
||||
{ label: t('common:core.chat.Recent use'), value: TabEnum.recently },
|
||||
{ label: t('common:App'), value: TabEnum.app }
|
||||
]),
|
||||
{ label: t('core.chat.History'), value: TabEnum.history }
|
||||
{ label: t('common:core.chat.History'), value: TabEnum.history }
|
||||
]}
|
||||
value={currentTab}
|
||||
onChange={setCurrentTab}
|
||||
@@ -186,7 +186,7 @@ const ChatHistorySlider = ({
|
||||
overflow={'hidden'}
|
||||
onClick={() => onChangeChatId()}
|
||||
>
|
||||
{t('core.chat.New Chat')}
|
||||
{t('common:core.chat.New Chat')}
|
||||
</Button>
|
||||
{/* Clear */}
|
||||
{isPc && (
|
||||
@@ -266,7 +266,9 @@ const ChatHistorySlider = ({
|
||||
...(onSetHistoryTop
|
||||
? [
|
||||
{
|
||||
label: item.top ? t('core.chat.Unpin') : t('core.chat.Pin'),
|
||||
label: item.top
|
||||
? t('common:core.chat.Unpin')
|
||||
: t('common:core.chat.Pin'),
|
||||
icon: 'core/chat/setTopLight',
|
||||
onClick: () => {
|
||||
onSetHistoryTop({ chatId: item.id, top: !item.top });
|
||||
@@ -277,7 +279,7 @@ const ChatHistorySlider = ({
|
||||
...(onSetCustomTitle
|
||||
? [
|
||||
{
|
||||
label: t('common.Custom Title'),
|
||||
label: t('common:common.Custom Title'),
|
||||
icon: 'common/customTitleLight',
|
||||
onClick: () => {
|
||||
onOpenModal({
|
||||
@@ -293,7 +295,7 @@ const ChatHistorySlider = ({
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: t('common.Delete'),
|
||||
label: t('common:common.Delete'),
|
||||
icon: 'delete',
|
||||
onClick: () => {
|
||||
onDelHistory({ chatId: item.id });
|
||||
@@ -374,7 +376,7 @@ const ChatHistorySlider = ({
|
||||
borderRadius={'50%'}
|
||||
aria-label={''}
|
||||
/>
|
||||
{t('core.chat.Exit Chat')}
|
||||
{t('common:core.chat.Exit Chat')}
|
||||
</Flex>
|
||||
)}
|
||||
<EditTitleModal />
|
||||
|
@@ -22,7 +22,7 @@ const CustomPluginRunBox = (props: PluginRunBoxProps) => {
|
||||
<Grid gridTemplateColumns={'450px 1fr'} h={'100%'}>
|
||||
<Box px={3} py={4} borderRight={'base'} h={'100%'} overflowY={'auto'} w={'100%'}>
|
||||
<Box color={'myGray.900'} mb={5}>
|
||||
{t('common.Input')}
|
||||
{t('common:common.Input')}
|
||||
</Box>
|
||||
<PluginRunBox {...props} tab={PluginRunBoxTabEnum.input} />
|
||||
</Box>
|
||||
@@ -30,7 +30,7 @@ const CustomPluginRunBox = (props: PluginRunBoxProps) => {
|
||||
<Box display={'inline-block'} mb={5}>
|
||||
<LightRowTabs<PluginRunBoxTabEnum>
|
||||
list={[
|
||||
{ label: t('common.Output'), value: PluginRunBoxTabEnum.output },
|
||||
{ label: t('common:common.Output'), value: PluginRunBoxTabEnum.output },
|
||||
{ label: '完整结果', value: PluginRunBoxTabEnum.detail }
|
||||
]}
|
||||
value={tab}
|
||||
@@ -50,8 +50,8 @@ const CustomPluginRunBox = (props: PluginRunBoxProps) => {
|
||||
<Stack py={2} px={4} h={'100%'}>
|
||||
<LightRowTabs<PluginRunBoxTabEnum>
|
||||
list={[
|
||||
{ label: t('common.Input'), value: PluginRunBoxTabEnum.input },
|
||||
{ label: t('common.Output'), value: PluginRunBoxTabEnum.output },
|
||||
{ label: t('common:common.Input'), value: PluginRunBoxTabEnum.input },
|
||||
{ label: t('common:common.Output'), value: PluginRunBoxTabEnum.output },
|
||||
{ label: '完整结果', value: PluginRunBoxTabEnum.detail }
|
||||
]}
|
||||
value={tab}
|
||||
|
@@ -71,7 +71,7 @@ const SliderApps = ({ apps, activeAppId }: { apps: AppListItemType[]; activeAppI
|
||||
borderRadius={'50%'}
|
||||
aria-label={''}
|
||||
/>
|
||||
{t('core.chat.Exit Chat')}
|
||||
{t('common:core.chat.Exit Chat')}
|
||||
</Flex>
|
||||
)}
|
||||
</Box>
|
||||
@@ -86,7 +86,7 @@ const SliderApps = ({ apps, activeAppId }: { apps: AppListItemType[]; activeAppI
|
||||
fontSize={'sm'}
|
||||
justifyContent={'space-between'}
|
||||
>
|
||||
<Box>{t('core.chat.Recent use')}</Box>
|
||||
<Box>{t('common:core.chat.Recent use')}</Box>
|
||||
<MyPopover
|
||||
placement="bottom-end"
|
||||
offset={[20, 10]}
|
||||
@@ -104,7 +104,7 @@ const SliderApps = ({ apps, activeAppId }: { apps: AppListItemType[]; activeAppI
|
||||
bg: 'myGray.200'
|
||||
}}
|
||||
>
|
||||
<Box>{t('common.More')}</Box>
|
||||
<Box>{t('common:common.More')}</Box>
|
||||
<MyIcon name={'common/select'} w={'1rem'} />
|
||||
</HStack>
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ const ToolMenu = ({ history }: { history: ChatItemType[] }) => {
|
||||
children: [
|
||||
{
|
||||
icon: 'core/chat/chatLight',
|
||||
label: t('core.chat.New Chat'),
|
||||
label: t('common:core.chat.New Chat'),
|
||||
onClick: () => {
|
||||
router.replace({
|
||||
query: {
|
||||
@@ -43,17 +43,17 @@ const ToolMenu = ({ history }: { history: ChatItemType[] }) => {
|
||||
children: [
|
||||
// {
|
||||
// icon: 'core/app/appApiLight',
|
||||
// label: `HTML ${t('Export')}`,
|
||||
// label: `HTML ${t('common:Export')}`,
|
||||
// onClick: () => onExportChat({ type: 'html', history })
|
||||
// },
|
||||
{
|
||||
icon: 'file/markdown',
|
||||
label: `Markdown ${t('Export')}`,
|
||||
label: `Markdown ${t('common:Export')}`,
|
||||
onClick: () => onExportChat({ type: 'md', history })
|
||||
}
|
||||
// {
|
||||
// icon: 'core/chat/export/pdf',
|
||||
// label: `PDF ${t('Export')}`,
|
||||
// label: `PDF ${t('common:Export')}`,
|
||||
// onClick: () => onExportChat({ type: 'pdf', history })
|
||||
// }
|
||||
]
|
||||
|
@@ -196,7 +196,7 @@ const Chat = ({
|
||||
})(
|
||||
<ChatHistorySlider
|
||||
apps={myApps}
|
||||
confirmClearText={t('core.chat.Confirm to clear history')}
|
||||
confirmClearText={t('common:core.chat.Confirm to clear history')}
|
||||
appId={appId}
|
||||
appName={chatData.app.name}
|
||||
appAvatar={chatData.app.avatar}
|
||||
@@ -313,7 +313,7 @@ const Render = (props: Props) => {
|
||||
if (apps.length === 0) {
|
||||
toast({
|
||||
status: 'error',
|
||||
title: t('core.chat.You need to a chat app')
|
||||
title: t('common:core.chat.You need to a chat app')
|
||||
});
|
||||
router.replace('/app/list');
|
||||
} else {
|
||||
|
@@ -253,7 +253,7 @@ const OutLink = ({ appName, appIntro, appAvatar }: Props) => {
|
||||
<ChatHistorySlider
|
||||
appName={chatData.app.name}
|
||||
appAvatar={chatData.app.avatar}
|
||||
confirmClearText={t('core.chat.Confirm to clear share chat history')}
|
||||
confirmClearText={t('common:core.chat.Confirm to clear share chat history')}
|
||||
onDelHistory={({ chatId }) =>
|
||||
onDelHistory({ appId: chatData.appId, chatId, shareId, outLinkUid })
|
||||
}
|
||||
|
@@ -156,7 +156,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
|
||||
refreshDeps: [teamId, teamToken, appId, chatId],
|
||||
onError(e: any) {
|
||||
toast({
|
||||
title: getErrText(e, t('core.chat.Failed to initialize chat')),
|
||||
title: getErrText(e, t('common:core.chat.Failed to initialize chat')),
|
||||
status: 'error'
|
||||
});
|
||||
if (chatId) {
|
||||
@@ -202,7 +202,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
|
||||
apps={myApps}
|
||||
appName={chatData.app.name}
|
||||
appAvatar={chatData.app.avatar}
|
||||
confirmClearText={t('core.chat.Confirm to clear history')}
|
||||
confirmClearText={t('common:core.chat.Confirm to clear history')}
|
||||
onDelHistory={(e) => onDelHistory({ ...e, appId, teamId, teamToken })}
|
||||
onClearHistory={() => {
|
||||
onClearHistories({ appId, teamId, teamToken });
|
||||
|
Reference in New Issue
Block a user