Skip to content

Commit

Permalink
🌐 chore: update i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Nov 26, 2024
1 parent 3426e74 commit 369230b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Typography } from 'antd';
import { createStyles } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { CSSProperties, memo } from 'react';
import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';

import { useChatStore } from '@/store/chat';
Expand All @@ -28,6 +29,7 @@ interface ThreadProps {
}

const Thread = memo<ThreadProps>(({ id, placement, style }) => {
const { t } = useTranslation('chat');
const { styles } = useStyles();

const threads = useChatStore(threadSelectors.getThreadsBySourceMsgId(id), isEqual);
Expand All @@ -43,7 +45,8 @@ const Thread = memo<ThreadProps>(({ id, placement, style }) => {
<Flexbox className={styles.container} gap={4} padding={4} style={{ width: 'fit-content' }}>
<Flexbox gap={8} horizontal paddingInline={6}>
<Typography.Text style={{ fontSize: 12 }} type={'secondary'}>
子话题 {threads.length}
{t('thread.title')}
{threads.length}
</Typography.Text>
</Flexbox>
<Flexbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createStyles } from 'antd-style';
import dayjs from 'dayjs';
import { ChevronRight } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';

import { useIsMobile } from '@/hooks/useIsMobile';
Expand Down Expand Up @@ -34,6 +35,7 @@ const useStyles = createStyles(({ css, token }) => ({
}));

const Item = memo<ThreadItem>(({ id, title, lastActiveAt, sourceMessageId }) => {
const { t } = useTranslation('chat');
const openThreadInPortal = useChatStore((s) => s.openThreadInPortal);
const { styles, cx } = useStyles();
const [isActive, messageCount] = useChatStore((s) => [
Expand All @@ -55,7 +57,7 @@ const Item = memo<ThreadItem>(({ id, title, lastActiveAt, sourceMessageId }) =>
>
{title}
<Flexbox className={styles.extra} horizontal>
{!!messageCount && `${messageCount} 条消息`}
{!!messageCount && t('thread.threadMessageCount', { messageCount })}
{!mobile && ` · ${dayjs(lastActiveAt).format('YYYY-MM-DD')}`}
<Icon icon={ChevronRight} />
</Flexbox>
Expand Down
2 changes: 1 addition & 1 deletion src/app/(main)/chat/(workspace)/_layout/Desktop/Portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
CHAT_PORTAL_WIDTH,
} from '@/const/layoutTokens';
import { useChatStore } from '@/store/chat';
import { chatPortalSelectors, portalThreadSelectors } from '@/store/chat/slices/portal/selectors';
import { chatPortalSelectors, portalThreadSelectors } from '@/store/chat/selectors';

const useStyles = createStyles(({ css, token, isDarkMode }) => ({
content: css`
Expand Down
2 changes: 2 additions & 0 deletions src/locales/default/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export default {
},
thread: {
divider: '子话题',
threadMessageCount: '{{messageCount}} 条消息',
title: '子话题',
},
tokenDetails: {
chats: '会话消息',
Expand Down

0 comments on commit 369230b

Please sign in to comment.