Skip to content

Let's use AI to Earn!

Multi-language configuration

bulaienaofutuojiesenzhang4dfe41f994ce
diff --git a/src/app/[lng]/interactive/page.tsx b/src/app/[lng]/interactive/page.tsx
index a5d17835..b12f881d 100644
--- a/src/app/[lng]/interactive/page.tsx
+++ b/src/app/[lng]/interactive/page.tsx
@@ -22,7 +22,6 @@ export default function InteractivePage() {
const { lng } = useParams();
const { userInfo, token } = useUserStore();
const { t } = useTransClient('interactive' as any);
- const tt = t as any;
// 账户侧边栏相关
const { accountInit, accountActive, setAccountActive } = useAccountStore(
@@ -128,7 +127,7 @@ export default function InteractivePage() {
{item.thumbnail ? (
<img src={item.thumbnail} alt={item.title} />
) : (
- <div className={styles.thumbPlaceholder}>No Image</div>
+ <div className={styles.thumbPlaceholder}>{t('ui.noImage')}</div>
)}
{/* {item.mediaType === 'video' && (
<span className={styles.playIcon}>
@@ -136,7 +135,7 @@ export default function InteractivePage() {
</span>
)} */}
<span className={styles.mediaType}>
- <Tag color={item.mediaType==='video'?'blue':item.mediaType==='image'?'green':'purple'}>{item.mediaType}</Tag>
+ <Tag color={item.mediaType==='video'?'blue':item.mediaType==='image'?'green':'purple'}>{t(`mediaTypes.${item.mediaType}` as any)}</Tag>
</span>
</a>
<div className={styles.postMeta}>
@@ -255,10 +254,10 @@ export default function InteractivePage() {
setReplyText('');
setReplyTarget(null);
await loadCommentsV2(commentPost.postId);
- message.success('已评论');
+ message.success(t('messages.commentSuccess'));
}
} catch (error) {
- message.error('评论失败,请重试');
+ message.error(t('messages.commentFailed'));
} finally {
setSending(false);
}
@@ -276,10 +275,10 @@ export default function InteractivePage() {
setReplyText('');
setReplyTarget(null);
await loadCommentsV2(commentPost.postId);
- message.success('已回复');
+ message.success(t('messages.replySuccess'));
}
} catch (error) {
- message.error('回复失败,请重试');
+ message.error(t('messages.replyFailed'));
} finally {
setSending(false);
}
@@ -291,7 +290,7 @@ export default function InteractivePage() {
useEffect(() => {
if (!token) {
- message.error(tt('messages.pleaseLoginFirst'));
+ message.error(t('messages.pleaseLoginFirst'));
router.push('/login');
return;
}
@@ -342,8 +341,8 @@ export default function InteractivePage() {
}}>
<CommentOutlined style={{ fontSize: 36, color: '#9ca3af' }} />
</div>
- <div style={{ fontSize: 18, fontWeight: 600, color: '#111827', marginBottom: 8 }}>请在左侧选择需要互动的频道</div>
- <div style={{ color: '#6b7280' }}>选择一个账号后,将自动加载该频道的最新作品与评论互动功能。</div>
+ <div style={{ fontSize: 18, fontWeight: 600, color: '#111827', marginBottom: 8 }}>{t('ui.selectChannel')}</div>
+ <div style={{ color: '#6b7280' }}>{t('ui.selectChannelDesc')}</div>
</div>
</Card>
) : (
@@ -361,10 +360,10 @@ export default function InteractivePage() {
onClick={() => fetchEngagementPosts(pagination.current + 1, pagination.pageSize)}
disabled={loading}
>
- 加载更多
+ {t('ui.loadMore')}
</Button>
) : (
- <span style={{ color: '#999' }}>没有更多作品</span>
+ <span style={{ color: '#999' }}>{t('ui.noMorePosts')}</span>
)}
</div>
<div ref={loadMoreRef} style={{ height: 1 }} />
@@ -376,7 +375,7 @@ export default function InteractivePage() {
<Modal
open={commentVisible}
onCancel={() => setCommentVisible(false)}
- title={commentPost?.title || '评论'}
+ title={commentPost?.title || t('ui.reply')}
footer={null}
width={600}
>
@@ -393,9 +392,9 @@ export default function InteractivePage() {
style={{ alignItems: 'flex-start' }}
actions={[
canExpand && !expanded ? (
- <a key="expand" onClick={() => expandReplies(c.id)}>展开回复</a>
+ <a key="expand" onClick={() => expandReplies(c.id)}>{t('ui.expandReplies')}</a>
) : canExpand && expanded ? (
- <a key="collapse" onClick={() => collapseReplies(c.id)}>收起回复</a>
+ <a key="collapse" onClick={() => collapseReplies(c.id)}>{t('ui.collapseReplies')}</a>
) : null,
<a
key="reply"
@@ -405,7 +404,7 @@ export default function InteractivePage() {
setTimeout(() => replyInputRef.current?.focus?.(), 0);
}}
>
- 回复
+ {t('ui.reply')}
</a>,
].filter(Boolean)}
>
@@ -433,7 +432,7 @@ export default function InteractivePage() {
/>
<div style={{ display: 'flex', justifyContent: 'flex-start', paddingLeft: 40 }}>
<Button size="small" type="link" onClick={() => loadMoreReplies(c.id)} disabled={!replyState?.cursor?.after} loading={replyState?.loading}>
- 加载更多回复
+ {t('ui.loadMoreReplies')}
</Button>
</div>
</div>
@@ -447,7 +446,7 @@ export default function InteractivePage() {
style={{ textAlign: 'center', marginTop: 10, color: '#1677ff', cursor: 'pointer' }}
onClick={() => !commentLoading && loadCommentsV2(commentPost!.postId, undefined, commentsCursor?.after)}
>
- {commentLoading ? '加载中…' : '加载更多评论'}
+ {commentLoading ? t('ui.loading') : t('ui.loadMoreComments')}
</div>
)}
<div style={{ display: 'flex', gap: 8, marginTop: 12, paddingBottom: 20 }}>
@@ -456,7 +455,7 @@ export default function InteractivePage() {
value={replyText}
onChange={(e) => setReplyText(e.target.value)}
rows={1}
- placeholder={replyTarget ? `回复@${replyTarget.name}` : '输入评论...'}
+ placeholder={replyTarget ? t('ui.replyPlaceholder', { name: replyTarget.name }) : t('ui.commentPlaceholder')}
/>
<Button
type="primary"
@@ -465,7 +464,7 @@ export default function InteractivePage() {
onClick={() => (replyTarget ? submitReply(replyTarget.id) : submitPostComment())}
style={{ width: 88, minWidth: 88 }}
>
- {sending ? '发送中...' : '发送'}
+ {sending ? t('ui.sending') : t('ui.send')}
</Button>
</div>
</Modal>
diff --git a/src/app/i18n/locales/zh-CN/interactive.json b/src/app/i18n/locales/zh-CN/interactive.json
new file mode 100644
index 00000000..dc1c066b
--- /dev/null
+++ b/src/app/i18n/locales/zh-CN/interactive.json
@@ -0,0 +1,41 @@
+{
+ "title": "互动管理",
+ "messages": {
+ "pleaseLoginFirst": "请先登录",
+ "commentSuccess": "评论成功",
+ "commentFailed": "评论失败,请重试",
+ "replySuccess": "回复成功",
+ "replyFailed": "回复失败,请重试"
+ },
+ "ui": {
+ "selectChannel": "请在左侧选择需要互动的频道",
+ "selectChannelDesc": "选择一个账号后,将自动加载该频道的最新作品与评论互动功能。",
+ "loadMore": "加载更多",
+ "noMorePosts": "没有更多作品",
+ "loading": "加载中...",
+ "sending": "发送中...",
+ "send": "发送",
+ "reply": "回复",
+ "expandReplies": "展开回复",
+ "collapseReplies": "收起回复",
+ "loadMoreReplies": "加载更多回复",
+ "loadMoreComments": "加载更多评论",
+ "commentPlaceholder": "输入评论...",
+ "replyPlaceholder": "回复@{name}",
+ "noImage": "无图片"
+ },
+ "stats": {
+ "likes": "点赞",
+ "comments": "评论",
+ "views": "浏览",
+ "shares": "分享",
+ "clicks": "点击",
+ "impressions": "曝光",
+ "favorites": "收藏"
+ },
+ "mediaTypes": {
+ "video": "视频",
+ "image": "图片",
+ "article": "文章"
+ }
+}