Skip to content

Commit

Permalink
🎨 chore: 整理 common i18n 文件
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Aug 22, 2024
1 parent ed9b231 commit 3489c4d
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/app/chat/ChatInfo/ChatList/BackBottom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface BackBottomProps {

const BackBottom = memo<BackBottomProps>(({ visible, onScrollToBottom }) => {
const { styles, cx } = useStyles();
const { t } = useTranslation('common');
const { t } = useTranslation('chat');

return (
<Button
Expand Down
2 changes: 1 addition & 1 deletion src/app/chat/ChatInfo/DanceList/Item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const DanceItem = (props: DanceItemProps) => {
const isSelected = currentIdentifier === danceItem.danceId;
const hoverRef = useRef(null);
const isHovered = useHover(hoverRef);
const { t } = useTranslation('common');
const { t } = useTranslation('dance');

const { downloading: audioDownloading, percent: audioPercent, fetchAudioUrl } = useLoadAudio();
const { downloading: danceDownloading, percent: dancePercent, fetchDanceUrl } = useLoadDance();
Expand Down
2 changes: 1 addition & 1 deletion src/app/role/RoleEdit/Touch/ActionList/Actions/Play.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default memo((props: Props) => {
icon={loading ? Loader2 : PlayIcon}
spin={loading}
disable={loading}
title={t('actions.play', { ns: 'common' })}
title={t('play', { ns: 'common' })}
key="play"
onClick={() => {
setLoading(true);
Expand Down
2 changes: 1 addition & 1 deletion src/features/ChatItem/Actions/System.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
import type { RenderAction } from '@/features/ChatItem/type';

const SystemActionsBar: RenderAction = ({ onActionClick }) => {
const { t } = useTranslation('common');
const { t } = useTranslation('chat');
const { del } = useChatListActionsBar({
delete: t('actions.del'),
});
Expand Down
2 changes: 1 addition & 1 deletion src/features/ChatItem/Actions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const useActionsClick = (): OnActionsClick => {
s.regenerateMessage,
]);
const { message } = App.useApp();
const { t } = useTranslation('common');
const { t } = useTranslation('chat');

return useCallback<OnActionsClick>(async (action, { id, content, error }) => {
switch (action.key) {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useChatListActionsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface ChatListActionsBar {
}

export const useChatListActionsBar = (): ChatListActionsBar => {
const { t } = useTranslation('common');
const { t } = useTranslation('chat');
return useMemo(
() => ({
copy: {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useDownloadAgent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export const useDownloadAgent = () => {
await setItem(modelKey, model);

addLocalAgent({ ...agent, meta: { ...agent.meta, avatar, cover } });
message.success(agent.meta.name + t('actions.downloadSuccess'));
message.success(agent.meta.name + t('download.success'));
} catch (e) {
console.error(e);
message.error(agent.meta.name + t('actions.downloadFailed'));
message.error(agent.meta.name + t('download.failed'));
} finally {
setDownloading(false);
}
Expand Down
12 changes: 12 additions & 0 deletions src/locales/default/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ export default {
useToken: '消耗 Token 数量计算,包括消息,角色设定与上下文:{{usedTokens}} / {{maxValue}}',
tokenCount: 'Token 数量',
},
actions: {
copy: '复制',
add: '添加',
delAndRegenerate: '删除并重新生成',
copySuccess: '复制成功',
edit: '编辑',
del: '删除',
save: '保存',
share: '分享',
goBottom: '返回底部',
regenerate: '重新生成',
},
info: {
chat: '聊天',
dance: '舞蹈',
Expand Down
35 changes: 12 additions & 23 deletions src/locales/default/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,17 @@ export default {
noData: '暂无数据',
confirm: '确定',
search: '搜索',
actions: {
copy: '复制',
add: '添加',
delAndRegenerate: '删除并重新生成',
edit: '编辑',
save: '保存',
share: '分享',
regenerate: '重新生成',
play: '播放',
pause: '暂停',
copySuccess: '复制成功',
downloadSuccess: '下载成功',
downloadFailed: '下载失败',
subscribe: '订阅',
subscribed: '已订阅',
unsubscribe: '取消订阅',
unsubscribeSuccess: '已取消订阅',
downloadSubscribe: '下载订阅',
danceMarket: '舞蹈市场',
goBottom: '返回底部',
downloadCover: '下载封面',
downloadAvatar: '下载头像',
downloadModel: '下载模型',
play: '播放',
download: {
subscribe: '下载订阅',
success: '下载成功',
failed: '下载失败',
cover: '下载封面',
avatar: '下载头像',
model: '下载模型',
},
subscribe: {
undo: '取消订阅',
success: '已取消订阅',
},
};
4 changes: 4 additions & 0 deletions src/locales/default/dance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export default {
dance: '跳舞',
danceList: '舞蹈列表',
actions: {
play: '播放',
pause: '暂停',
},
play: '播放',
addPlay: '添加到列表',
addPlaySuccess: '已添加到播放列表',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ const Subscribe = memo((props: SubscribeButtonProps) => {
<Flexbox>
<Space>
<Progress steps={30} percent={percent.cover} size="small" />
<span>{t('actions.downloadCover')}</span>
<span>{t('download.cover')}</span>
</Space>
<Space>
<Progress steps={30} percent={percent.avatar} size="small" />
<span>{t('actions.downloadAvatar')}</span>
<span>{t('download.avatar')}</span>
</Space>
<Space>
<Progress steps={30} percent={percent.model} size="small" />
<span>{t('actions.downloadModel')}</span>
<span>{t('download.model')}</span>
</Space>
</Flexbox>
}
Expand All @@ -50,7 +50,7 @@ const Subscribe = memo((props: SubscribeButtonProps) => {
}}
type={isSubscribed ? 'default' : 'primary'}
>
{t('actions.downloadSubscribe')}
{t('download.subscribe')}
</Button>
</Popover>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const UnSubscribe = memo((props: UnSubscribeButtonProps) => {
await removeLocalAgent(agent.agentId);
removeSessionByAgentId(agent.agentId);
setLoading(false);
message.success(t('actions.unsubscribeSuccess', { ns: 'common' }));
message.success(t('subscribe.success', { ns: 'common' }));
}}
title={t('actions.unsubscribe', { ns: 'common' }) + '?'}
title={t('subscribe.undo', { ns: 'common' }) + '?'}
>
<Button danger>{t('actions.unsubscribe', { ns: 'common' })}</Button>
<Button danger>{t('subscribe.undo', { ns: 'common' })}</Button>
</Popconfirm>
);
});
Expand Down

0 comments on commit 3489c4d

Please sign in to comment.