Skip to content

Commit eb4b6b8

Browse files
committed
🌐 i18n(emoji): localize panel labels
🌐 i18n(model): localize selector text 🌐 i18n(todos): localize panel text ♻️ refactor(settings): update theme options 🔧 chore(config): update default report times 🔧 chore(pthink): raise default threshold 🔧 chore(report): update default time 🔧 chore(config): sync default settings
1 parent a06f81c commit eb4b6b8

18 files changed

Lines changed: 159 additions & 50 deletions

File tree

packages/app/components/Editor/components/Emoji/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState } from 'react'
22
import { useMemoizedFn } from 'ahooks'
3+
import { useTranslation } from 'react-i18next'
34

45
import { Button } from '@/__shadcn__/components/ui/button'
56
import { Input } from '@/__shadcn__/components/ui/input'
@@ -10,6 +11,7 @@ const emojis = ['😀', '😂', '😍', '🤔', '😭', '🎉', '🔥', '✅', '
1011

1112
const Index = (props: IPropsModal) => {
1213
const { editor } = props
14+
const { t } = useTranslation()
1315
const [value, setValue] = useState('')
1416

1517
const onSelect = useMemoizedFn((v: string) => {
@@ -49,9 +51,13 @@ const Index = (props: IPropsModal) => {
4951
))}
5052
</div>
5153
<div className='flex gap-2'>
52-
<Input placeholder='Emoji' value={value} onChange={e => setValue(e.target.value)}></Input>
54+
<Input
55+
placeholder={t('emoji_panel.placeholder')}
56+
value={value}
57+
onChange={e => setValue(e.target.value)}
58+
></Input>
5359
<Button type='button' onClick={() => value && onSelect(value)}>
54-
Insert
60+
{t('emoji_panel.insert')}
5561
</Button>
5662
</div>
5763
</div>

packages/app/components/ModelSelect.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useMemo } from 'react'
22
import { useMemoizedFn } from 'ahooks'
33
import { observer } from 'mobx-react-lite'
4+
import { useTranslation } from 'react-i18next'
45

56
import {
67
Combobox,
@@ -92,6 +93,7 @@ const Index = (props: IProps) => {
9293
props
9394

9495
const global = useGlobal()
96+
const { t } = useTranslation()
9597

9698
const s = global.setting
9799
const providers = $copy([...s.providers.providers, ...(s.providers.custom_providers || [])])
@@ -177,10 +179,10 @@ const Index = (props: IProps) => {
177179
className={inputClassName}
178180
ghost={ghost}
179181
showTrigger={showTrigger}
180-
placeholder='Select a default model'
182+
placeholder={t('model_select.placeholder')}
181183
/>
182184
<ComboboxContent ghost={ghost}>
183-
<ComboboxEmpty>No providers found.</ComboboxEmpty>
185+
<ComboboxEmpty>{t('model_select.empty')}</ComboboxEmpty>
184186
<ComboboxList>
185187
{(group, index) => (
186188
<ComboboxGroup key={group.value} items={group.items}>

packages/app/components/Todos.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useTranslation } from 'react-i18next'
2+
13
type TodoItem = {
24
id: string
35
title: string
@@ -31,10 +33,11 @@ const Index = (props: IProps) => {
3133
onCancelRenameTodo,
3234
onClickRemoveTodo
3335
} = props
36+
const { t } = useTranslation()
3437

3538
return (
3639
<div className='flex flex-col gap-2'>
37-
<div className='text-std-400 text-xs font-medium'>Todos</div>
40+
<div className='text-std-400 text-xs font-medium'>{t('todos_panel.title')}</div>
3841
<div className='flex gap-2'>
3942
<input
4043
className='
@@ -45,7 +48,7 @@ const Index = (props: IProps) => {
4548
bg-transparent
4649
border border-border-light
4750
'
48-
placeholder='New todo'
51+
placeholder={t('todos_panel.new_placeholder')}
4952
value={todoInputValue}
5053
onChange={event => onChangeTodoInput(event.target.value)}
5154
onKeyDown={event => {
@@ -62,7 +65,7 @@ const Index = (props: IProps) => {
6265
onClickCreateTodo()
6366
}}
6467
>
65-
Add
68+
{t('todos_panel.add')}
6669
</button>
6770
</div>
6871
<div className='flex flex-col gap-1'>
@@ -111,7 +114,7 @@ const Index = (props: IProps) => {
111114
className='text-std-400 text-xs'
112115
onClick={() => onStartRenameTodo(item.id, item.title)}
113116
>
114-
Rename
117+
{t('todos_panel.rename')}
115118
</button>
116119
{todoEditingId === item.id && (
117120
<button

packages/app/layout/components/Header/components/SessionsStatus/Dialog.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ArrowLeft, CircleAlert, Grip, Loader, MessageSquareDot } from 'lucide-react'
22
import { observer } from 'mobx-react-lite'
3+
import { useTranslation } from 'react-i18next'
34

45
import { Dialog, Session, Tabs } from '@/components'
56

@@ -18,12 +19,18 @@ const tab_items = [
1819
const Index = (props: IProps) => {
1920
const { x } = props
2021
const current_list = x.list
22+
const { t } = useTranslation('layout')
23+
const tab_items = [
24+
{ key: 'unread', title: t('sessions_status.unread'), Icon: MessageSquareDot },
25+
{ key: 'running', title: t('sessions_status.running'), Icon: Loader },
26+
{ key: 'error', title: t('sessions_status.error'), Icon: CircleAlert }
27+
]
2128

2229
return (
2330
<Dialog
2431
open={x.open}
25-
title='Active Sessions'
26-
desc='A panel for quickly viewing dynamic session changes'
32+
title={t('sessions_status.title')}
33+
desc={t('sessions_status.desc')}
2734
className='w-[800px] max-w-none! gap-4'
2835
maxHeight='h-[80vh]'
2936
setOpen={x.toggleOpen}
@@ -95,7 +102,7 @@ const Index = (props: IProps) => {
95102
text-sm text-std-300
96103
'
97104
>
98-
No sessions
105+
{t('sessions_status.empty')}
99106
</div>
100107
)}
101108
</div>
@@ -112,7 +119,7 @@ const Index = (props: IProps) => {
112119
text-sm text-std-300
113120
'
114121
>
115-
No session selected
122+
{t('sessions_status.not_selected')}
116123
</div>
117124
)}
118125
</div>

packages/app/locales/en/layout.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,14 @@ export default {
2020
collapse: 'Collapse',
2121
loading_notifications: 'Loading notifications...',
2222
empty_notifications: 'No notifications.'
23+
},
24+
sessions_status: {
25+
title: 'Active Sessions',
26+
desc: 'A panel for quickly viewing dynamic session changes',
27+
unread: 'Unread',
28+
running: 'Running',
29+
error: 'Error',
30+
empty: 'No sessions',
31+
not_selected: 'No session selected'
2332
}
2433
} as const

packages/app/locales/en/setting.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ export default {
113113
option_next_year_first_day: 'Next year first day',
114114
option_english: 'English',
115115
option_simplified_chinese: 'Simplified Chinese',
116+
option_light: 'Light',
117+
option_dark: 'Dark',
118+
option_system: 'Follow System',
116119
option_minutes: '{{count}} min',
117120
option_messages: '{{count}} messages',
118121
toast_auth_enabled: 'Auth enabled.',

packages/app/locales/en/translation.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,29 @@ export default {
2020
save: 'Save',
2121
saving: 'Saving',
2222
save_failed: 'Failed to save bookmark.'
23+
},
24+
login: {
25+
title: 'Polywise Login',
26+
desc: 'Sign in to the standalone web runtime.',
27+
account: 'Account',
28+
password: 'Password',
29+
password_required: 'Password is required.',
30+
sign_in: 'Sign In',
31+
signing_in: 'Signing in...',
32+
no_password_configured: 'No password configured yet. Set it in Settings.'
33+
},
34+
model_select: {
35+
placeholder: 'Select a default model',
36+
empty: 'No providers found.'
37+
},
38+
emoji_panel: {
39+
placeholder: 'Emoji',
40+
insert: 'Insert'
41+
},
42+
todos_panel: {
43+
title: 'Todos',
44+
new_placeholder: 'New todo',
45+
add: 'Add',
46+
rename: 'Rename'
2347
}
2448
} as const

packages/app/locales/zh-cn/home.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default {
101101
frozen_nodes_edges_combined: '{{total}} 个冻结节点与边合计',
102102
window_messages: '{{value}} 条消息',
103103
window_activity_desc: '{{sessions}} 个会话 · {{posts}} 篇帖子 · {{tokens}} tokens',
104-
total_post_think_reviews: '{{count}} 次 post-think 复盘总计',
104+
total_post_think_reviews: '{{count}} 次后思考复盘总计',
105105
last_review_relative: '{{status}} · 最近复盘于 {{value}}',
106106
last_output_mix: '{{articles}} 篇文章 · {{skills}} 个技能 · {{tools}} 个工具'
107107
},
@@ -198,7 +198,7 @@ export default {
198198
review_volume: '复盘数量',
199199
last_review_gap: '距上次复盘',
200200
last_output_mix: '最近输出构成',
201-
no_post_think_review_generated: '还没有生成 post-think 复盘。',
201+
no_post_think_review_generated: '还没有生成后思考复盘。',
202202
no_durable_output_yet: '还没有产生可持久化输出。',
203203
none: '无',
204204
avg_chunks_per_article: '平均每篇 {{count}} 个分块',

packages/app/locales/zh-cn/layout.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,14 @@ export default {
2020
collapse: '收起',
2121
loading_notifications: '正在加载通知...',
2222
empty_notifications: '暂无通知。'
23+
},
24+
sessions_status: {
25+
title: '活跃会话',
26+
desc: '用于快速查看动态会话变化的面板',
27+
unread: '未读',
28+
running: '运行中',
29+
error: '异常',
30+
empty: '暂无会话',
31+
not_selected: '尚未选择会话'
2332
}
2433
} as const

packages/app/locales/zh-cn/setting.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default {
8080
monthly_report_desc: '在当月最后一天或次月第一天运行。',
8181
yearly_report: '每年报告',
8282
yearly_report_desc: '在当年最后一天或次年第一天运行。',
83-
post_think: 'Post-Think',
83+
post_think: '后思考',
8484
post_think_desc:
8585
'当应用空闲且未审阅消息数达到阈值时,回顾今天新增的消息,并把值得长期保留的结论沉淀为文章;只有在理由充分时,才进一步产出技能或工具。',
8686
idle_grace: '空闲宽限',
@@ -109,6 +109,9 @@ export default {
109109
option_next_year_first_day: '次年第一天',
110110
option_english: 'English',
111111
option_simplified_chinese: '简体中文',
112+
option_light: '浅色',
113+
option_dark: '深色',
114+
option_system: '跟随系统',
112115
option_minutes: '{{count}} 分钟',
113116
option_messages: '{{count}} 条消息',
114117
toast_auth_enabled: '已启用认证。',

0 commit comments

Comments
 (0)