feat: write the UI in English, select only conversation content
- source strings are English again; Chinese comes from lib/l10n/zh.dart through tr()/trArgs() and AppText, and a language without a table (Spanish, ...) reads English instead of Chinese - server and user data (titles, messages, file names, notes, task names) is drawn with plain Text, so it is never looked up in the table - SelectionArea moved from the whole message list to the messages, the answer text, an opened tool call's details and the turn footer; status lines and folded tool rows no longer start a selection - a message the transcript does not know (its start event was lost while the stream was down) fetches the tail once, so a turn continued from another client comes in with its prompt - bump to 0.5.3
This commit is contained in:
1 parent
7b5bccf28f
commit
511c3b006b
43 files changed
+1620
-1791
No files matched your search
@@ -60,7 +60,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
project.label,
|
||||
project.canonical,
|
||||
),
|
||||
_TaskScope(Client.scheduledChatsScope, tr('聊天')),
|
||||
_TaskScope(Client.scheduledChatsScope, tr('Chat')),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
setState(() {
|
||||
_loading = false;
|
||||
_tasks = const [];
|
||||
_error = client == null ? '未连接服务器' : null;
|
||||
_error = client == null ? tr('Not connected to a server') : null;
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -105,15 +105,15 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
_loading = false;
|
||||
_tasks = const [];
|
||||
_error = e.status == 404
|
||||
? '服务器不支持计划任务'
|
||||
: trArgs('加载计划任务失败:{0}', [e.message]);
|
||||
? 'The server doesn\'t support scheduled tasks'
|
||||
: trArgs('Couldn\'t load scheduled tasks: {0}', [e.message]);
|
||||
});
|
||||
} catch (e) {
|
||||
if (!mounted || _scope?.id != scope.id) return;
|
||||
setState(() {
|
||||
_loading = false;
|
||||
_tasks = const [];
|
||||
_error = trArgs('加载计划任务失败:{0}', [e]);
|
||||
_error = trArgs('Couldn\'t load scheduled tasks: {0}', [e]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -144,20 +144,20 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
Future<bool> _save(_TaskScope scope, ScheduledTask draft) async {
|
||||
final client = app.client;
|
||||
if (client == null) {
|
||||
_say('未连接服务器');
|
||||
_say(tr('Not connected to a server'));
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
final tasks = await client.saveScheduledTask(scope.id, draft);
|
||||
if (!mounted) return true;
|
||||
if (_scope?.id == scope.id) setState(() => _tasks = tasks);
|
||||
_say('计划任务已保存');
|
||||
_say('Scheduled task saved');
|
||||
return true;
|
||||
} on ApiError catch (e) {
|
||||
_say(e.message.isEmpty ? '保存任务失败' : e.message);
|
||||
_say(e.message.isEmpty ? 'Couldn\'t save task' : e.message);
|
||||
return false;
|
||||
} catch (e) {
|
||||
_say(trArgs('保存任务失败:{0}', [e]));
|
||||
_say(trArgs('Couldn\'t save task: {0}', [e]));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -173,7 +173,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
if (!mounted) return;
|
||||
if (_scope?.id == scope.id) setState(() => _tasks = tasks);
|
||||
} catch (e) {
|
||||
_say(e is ApiError && e.message.isNotEmpty ? e.message : '更新任务失败');
|
||||
_say(e is ApiError && e.message.isNotEmpty ? e.message : 'Couldn\'t update task');
|
||||
await _load();
|
||||
} finally {
|
||||
if (mounted) setState(() => _busyId = '');
|
||||
@@ -187,12 +187,12 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
setState(() => _busyId = task.id);
|
||||
try {
|
||||
await client.runScheduledTask(scope.id, task.id);
|
||||
_say('任务已启动');
|
||||
_say('Task started');
|
||||
await _load();
|
||||
} on ApiError catch (e) {
|
||||
_say(e.status == 409 ? '任务已在队列中等待' : (e.message.isEmpty ? '运行任务失败' : e.message));
|
||||
_say(e.status == 409 ? 'Task is already waiting in the queue' : (e.message.isEmpty ? 'Couldn\'t run task' : e.message));
|
||||
} catch (e) {
|
||||
_say(trArgs('运行任务失败:{0}', [e]));
|
||||
_say(trArgs('Couldn\'t run task: {0}', [e]));
|
||||
} finally {
|
||||
if (mounted) setState(() => _busyId = '');
|
||||
}
|
||||
@@ -205,15 +205,15 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
final ok = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (dialog) => AlertDialog(
|
||||
title: const AppText('删除计划任务?'),
|
||||
content: AppText(trArgs('“{0}”及其计划会被删除。', [task.name])),
|
||||
title: const AppText('Delete scheduled task?'),
|
||||
content: AppText(trArgs('“{0}” and its schedule will be deleted.', [task.name])),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialog, false),
|
||||
child: const AppText('取消')),
|
||||
child: const AppText('Cancel')),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.pop(dialog, true),
|
||||
child: const AppText('删除')),
|
||||
child: const AppText('Delete')),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -223,9 +223,9 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
final tasks = await client.deleteScheduledTask(scope.id, task.id);
|
||||
if (!mounted) return;
|
||||
if (_scope?.id == scope.id) setState(() => _tasks = tasks);
|
||||
_say('计划任务已删除');
|
||||
_say('Scheduled task deleted');
|
||||
} catch (e) {
|
||||
_say(e is ApiError && e.message.isNotEmpty ? e.message : '删除任务失败');
|
||||
_say(e is ApiError && e.message.isNotEmpty ? e.message : 'Couldn\'t delete task');
|
||||
} finally {
|
||||
if (mounted) setState(() => _busyId = '');
|
||||
}
|
||||
@@ -236,16 +236,16 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const AppText('计划任务'),
|
||||
title: const AppText('Scheduled tasks'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
tooltip: tr('刷新'),
|
||||
tooltip: tr('Refresh'),
|
||||
onPressed: _loading ? null : _load,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add),
|
||||
tooltip: tr('新建任务'),
|
||||
tooltip: tr('New task'),
|
||||
onPressed: _scope == null ? null : () => _openEditor(),
|
||||
),
|
||||
],
|
||||
@@ -267,7 +267,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
children: [
|
||||
Icon(Icons.folder_outlined, size: 18, color: theme.hintColor),
|
||||
const SizedBox(width: 8),
|
||||
AppText('运行位置', style: TextStyle(fontSize: 13, color: theme.hintColor)),
|
||||
AppText('Runs in', style: TextStyle(fontSize: 13, color: theme.hintColor)),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: DropdownButtonHideUnderline(
|
||||
@@ -278,7 +278,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
for (final scope in _scopes)
|
||||
DropdownMenuItem(
|
||||
value: scope.id,
|
||||
child: AppText(scope.label,
|
||||
child: Text(scope.label,
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
],
|
||||
@@ -309,9 +309,9 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AppText(_error!, style: TextStyle(color: theme.hintColor)),
|
||||
Text(_error!, style: TextStyle(color: theme.hintColor)),
|
||||
const SizedBox(height: 8),
|
||||
TextButton(onPressed: _load, child: const AppText('重试')),
|
||||
TextButton(onPressed: _load, child: const AppText('Retry')),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -323,12 +323,12 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
children: [
|
||||
Icon(Icons.event_note_outlined, size: 36, color: theme.hintColor),
|
||||
const SizedBox(height: 10),
|
||||
AppText('暂无计划任务。', style: TextStyle(color: theme.hintColor)),
|
||||
AppText('No scheduled tasks yet.', style: TextStyle(color: theme.hintColor)),
|
||||
const SizedBox(height: 8),
|
||||
FilledButton.tonalIcon(
|
||||
onPressed: () => _openEditor(),
|
||||
icon: const Icon(Icons.add, size: 18),
|
||||
label: const AppText('新建任务'),
|
||||
label: const AppText('New task'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -353,14 +353,14 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
_ => theme.hintColor,
|
||||
};
|
||||
final next = task.nextRunAt > 0 && task.enabled
|
||||
? trArgs('下次:{0}', [scheduledRelativeTime(task.nextRunAt)])
|
||||
: (task.enabled ? '' : '已暂停');
|
||||
? trArgs('Next: {0}', [scheduledRelativeTime(task.nextRunAt)])
|
||||
: (task.enabled ? '' : 'Paused');
|
||||
final last = task.lastRunAt > 0
|
||||
? trArgs('上次运行 {0} · {1}', [
|
||||
? trArgs('Last run {0} · {1}', [
|
||||
scheduledClock(task.lastRunAt),
|
||||
scheduledStatusLabel(task.lastStatus),
|
||||
])
|
||||
: '从未运行';
|
||||
: 'Never run';
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 2),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
@@ -374,7 +374,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppText(
|
||||
child: Text(
|
||||
task.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -396,7 +396,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
onChanged: (v) => _toggle(task, v),
|
||||
),
|
||||
PopupMenuButton<String>(
|
||||
tooltip: tr('更多'),
|
||||
tooltip: tr('More'),
|
||||
onSelected: (value) {
|
||||
switch (value) {
|
||||
case 'run':
|
||||
@@ -408,23 +408,23 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
}
|
||||
},
|
||||
itemBuilder: (_) => [
|
||||
const PopupMenuItem(value: 'run', child: AppText('立即运行')),
|
||||
const PopupMenuItem(value: 'edit', child: AppText('编辑')),
|
||||
const PopupMenuItem(value: 'run', child: AppText('Run now')),
|
||||
const PopupMenuItem(value: 'edit', child: AppText('Edit')),
|
||||
PopupMenuItem(
|
||||
value: 'delete',
|
||||
child: AppText('删除',
|
||||
child: AppText('Delete',
|
||||
style: TextStyle(color: theme.colorScheme.error)),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
AppText(scheduledScheduleText(task),
|
||||
Text(scheduledScheduleText(task),
|
||||
style: TextStyle(fontSize: 13, color: theme.colorScheme.onSurfaceVariant)),
|
||||
if (task.targetSessionId.isEmpty)
|
||||
const SizedBox.shrink()
|
||||
else
|
||||
AppText('发送到现有会话', style: TextStyle(fontSize: 11.5, color: theme.hintColor)),
|
||||
AppText('Sends to an existing session', style: TextStyle(fontSize: 11.5, color: theme.hintColor)),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
@@ -441,7 +441,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
Expanded(
|
||||
child: AppText(
|
||||
child: Text(
|
||||
last,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -449,7 +449,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
),
|
||||
),
|
||||
if (next.isNotEmpty)
|
||||
AppText(next,
|
||||
Text(next,
|
||||
style:
|
||||
TextStyle(fontSize: 11.5, color: theme.hintColor)),
|
||||
],
|
||||
@@ -457,7 +457,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
if (task.lastError.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: AppText(
|
||||
child: Text(
|
||||
task.lastError,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -466,7 +466,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
AppText(
|
||||
Text(
|
||||
task.modelLabel,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
Reference in new issue
Block a user