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:
blumia committed 2026-11-26 11:48:16 +08:00
1 parent 7b5bccf28f
commit 511c3b006b
43 files changed
+1593 -1764

No files matched your search

+15 -7
View File
@@ -5,17 +5,25 @@
--- ---
## 0.5.2 中英双语与长按选择文本(分支 `flutter`) ## 0.5.3 英文为源、按范围选择文本(分支 `flutter`)
| 项 | 结果 | | 项 | 结果 |
| --- | --- | | --- | --- |
| 语言 | 默认跟随系统(中文系统用中文,其它用英文),可在 设置 → 常规 → 语言 里固定「中文 / English」;选择保存在本机,启动时先读取再出第一帧,系统语言变化时「跟随系统」会立即重绘 | | 语言 | 默认跟随系统(中文系统用中文,其它语言用英文),可在 设置 → 常规 → 语言 里固定「中文 / English」;选择保存在本机,启动时先读取再出第一帧,系统语言变化时「跟随系统」会立即重绘 |
| 文案 | 界面文案以中文写在代码里,`tr()` / `trArgs()` 查英文表(`lib/l10n/en_*.dart`),`AppText` 取代 `Text` 自动翻译;缺条目回退中文,不会出现空文案。服务器与用户数据(会话标题、消息、任务名、文件内容等)不翻译 | | 文案 | 代码里直接写英文;`tr()` / `trArgs()` 查中文表 `lib/l10n/zh.dart`,`AppText` 同理。没有对应表的语言(西班牙语等)按英文显示,缺条目也回退英文,不会出现空文案。服务器与用户数据(会话标题、消息、任务名、文件内容等)用 `Text` 原样显示 |
| 系统组件 | 接入 `flutter_localizations`,日期/时间选择器、文本选择菜单等系统文案随语言切换 | | 系统组件 | 接入 `flutter_localizations`,日期/时间选择器、文本选择菜单等系统文案随语言切换 |
| 选择文本 | 会话消息区包进 `SelectionArea`:手机上长按即可选中消息文本,并出现复制/全选菜单(此前只能选中工具输出等少数 `SelectableText`) | | 选择文本 | 只有会话内容可选中:消息气泡、回答正文、展开后的工具调用详情(命令/参数/输出)、一轮结束后的「模型 · 模式 · 耗时」行。未展开的工具调用行与「已完成 · X 次工具调用」等状态提示不可选中 |
| 测试 | 新增 `test/l10n_test.dart`:查表回退、占位符替换、`AppText` 跟随语言、lib 里每个中文字面量都有英文条目;原有测试在中文下不变 | | 会话同步 | 事件流断开期间开始的回合,其开始事件收不到:收到未知助手消息的事件时先拉取一次尾部,补齐用户消息与完整答复,而不是只拼出后续增量 |
| 验证 | 模拟器:默认跟随系统(系统英文 → 英文界面);设置 → 常规 → 语言 切到中文,标题与整页立即变中文,重启后保持;再切英文并设回「跟随系统」。英文下设置索引、全部功能、计划任务、编辑器与系统时间选择器均为英文;中文下同页为中文。会话里长按消息文本出现选择手柄与 Copy / Share / Select all / Read aloud 菜单。98 项测试全过 | | 测试 | `test/l10n_test.dart`:中文查表与回退、无表的系统语言读英文、`AppText` 跟随语言、代码里每处 `AppText`/`tr`/`trArgs` 字面量都有中文条目 |
| 版本 | **0.5.2(code 502)** | | 验证 | 模拟器:系统英文 → 全英文;切中文后整页与系统时间选择器立即变中文,重启保持;切回「跟随系统」;中文与英文下逐页检查;长按消息文本出现选择菜单,长按未展开的工具行与状态提示不再触发选择;断网重连后从网页端继续会话,手机端自动补齐新回合 |
| 版本 | **0.5.3(code 503)** |
---
## 0.5.2 中英双语与长按选择文本(分支 `flutter`,已被 0.5.3 调整)
- 初版:界面文案以中文写在代码里、查英文表;会话消息区整体包进 `SelectionArea`,长按任意位置都能选文本;接入 `flutter_localizations`。
- 0.5.3 起改为英文为源、按范围选择文本,见上。
--- ---
+1 -1
View File
@@ -5,7 +5,7 @@ Android first. This branch (`flutter`) is a framework evaluation: the same
feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in
Flutter to compare mobile UI maturity. Flutter to compare mobile UI maturity.
Status: 0.5.2 — servers (passwordless / password login, HTTP/HTTPS and Status: 0.5.3 — servers (passwordless / password login, HTTP/HTTPS and
SOCKS5/socks5h proxy, self-signed certificates and pinning, or a pairing link SOCKS5/socks5h proxy, self-signed certificates and pinning, or a pairing link
over the OpenChamber private relay with end-to-end encryption; the pairing over the OpenChamber private relay with end-to-end encryption; the pairing
link is pasted or scanned with the camera), session list with search and live link is pasted or scanned with the camera), session list with search and live
+3 -3
View File
@@ -907,9 +907,9 @@ class AgentMemoryEntry {
); );
String get typeLabel => switch (type) { String get typeLabel => switch (type) {
'preference' => tr('偏好'), 'preference' => tr('Preference'),
'reference' => tr('参考'), 'reference' => tr('Reference'),
_ => tr('事实'), _ => tr('Fact'),
}; };
} }
+1 -1
View File
@@ -84,7 +84,7 @@ class RelayTransport implements Transport {
final bytes = await response.body final bytes = await response.body
.fold<List<int>>(<int>[], (all, chunk) => all..addAll(chunk)); .fold<List<int>>(<int>[], (all, chunk) => all..addAll(chunk));
if (response.status < 200 || response.status >= 300) { if (response.status < 200 || response.status >= 300) {
throw RelayTunnelException(trArgs('无法获取 WebSocket 令牌({0})', [response.status])); throw RelayTunnelException(trArgs('Could not get a WebSocket token ({0})', [response.status]));
} }
try { try {
final decoded = jsonDecode(utf8.decode(bytes, allowMalformed: true)); final decoded = jsonDecode(utf8.decode(bytes, allowMalformed: true));
+13 -13
View File
@@ -133,11 +133,11 @@ class RelayTunnel {
try { try {
decoded = jsonDecode(utf8.decode(payload)); decoded = jsonDecode(utf8.decode(payload));
} catch (_) { } catch (_) {
finish(error: RelayTunnelException(tr('响应头无效'))); finish(error: RelayTunnelException(tr('Invalid response headers')));
return; return;
} }
if (decoded is! Map) { if (decoded is! Map) {
finish(error: RelayTunnelException(tr('响应头无效'))); finish(error: RelayTunnelException(tr('Invalid response headers')));
return; return;
} }
final status = (decoded['status'] as num?)?.toInt() ?? 0; final status = (decoded['status'] as num?)?.toInt() ?? 0;
@@ -162,7 +162,7 @@ class RelayTunnel {
controller.close(); controller.close();
break; break;
case RelayFrameType.streamAbort: case RelayFrameType.streamAbort:
var reason = tr('传输被中断'); var reason = tr('Transfer interrupted');
try { try {
final decoded = jsonDecode(utf8.decode(payload)); final decoded = jsonDecode(utf8.decode(payload));
if (decoded is Map && decoded['reason'] is String) { if (decoded is Map && decoded['reason'] is String) {
@@ -269,7 +269,7 @@ class RelayTunnel {
ws = await WebSocket.connect(uri.toString(), customClient: _http) ws = await WebSocket.connect(uri.toString(), customClient: _http)
.timeout(_connectTimeout); .timeout(_connectTimeout);
} catch (error) { } catch (error) {
throw RelayTunnelException(trArgs('无法连接 Relay:{0}', [error])); throw RelayTunnelException(trArgs('Could not connect to the relay: {0}', [error]));
} }
final channel = _RelayChannel(ws); final channel = _RelayChannel(ws);
final ready = Completer<void>(); final ready = Completer<void>();
@@ -326,7 +326,7 @@ class RelayTunnel {
deadline?.cancel(); deadline?.cancel();
ready.complete(); ready.complete();
} catch (error) { } catch (error) {
closeWith(RelayTunnelException(trArgs('密钥协商失败:{0}', [error]))); closeWith(RelayTunnelException(trArgs('Key exchange failed: {0}', [error])));
} }
} }
return; return;
@@ -334,7 +334,7 @@ class RelayTunnel {
// After the channel is up the host may repeat `ready` for a retried // After the channel is up the host may repeat `ready` for a retried
// hello; anything else plaintext is a protocol violation. // hello; anything else plaintext is a protocol violation.
if (raw.contains('"ready"')) return; if (raw.contains('"ready"')) return;
closeWith(RelayTunnelException(tr('握手后收到明文帧'))); closeWith(RelayTunnelException(tr('Received a plaintext frame after the handshake')));
return; return;
} }
if (raw is! List<int>) return; if (raw is! List<int>) return;
@@ -344,24 +344,24 @@ class RelayTunnel {
final plaintext = channel.decryptor.decrypt(Uint8List.fromList(raw)); final plaintext = channel.decryptor.decrypt(Uint8List.fromList(raw));
channel.handlePlaintext(plaintext); channel.handlePlaintext(plaintext);
} catch (error) { } catch (error) {
closeWith(RelayTunnelException(trArgs('解密失败:{0}', [error]))); closeWith(RelayTunnelException(trArgs('Decryption failed: {0}', [error])));
} }
} }
subscription = ws.listen( subscription = ws.listen(
onData, onData,
onError: (Object error) => closeWith(RelayTunnelException(trArgs('Relay 连接出错:{0}', [error]))), onError: (Object error) => closeWith(RelayTunnelException(trArgs('Relay connection error: {0}', [error]))),
onDone: () { onDone: () {
if (!finished) { if (!finished) {
closeWith(RelayTunnelException(trArgs( closeWith(RelayTunnelException(trArgs(
'Relay 连接已关闭({0} {1})', 'Relay connection closed ({0} {1})',
[ws.closeCode ?? '-', ws.closeReason ?? '']))); [ws.closeCode ?? '-', ws.closeReason ?? ''])));
} }
}, },
cancelOnError: true, cancelOnError: true,
); );
channel.onClosed = () => channel.onClosed = () =>
closeWith(RelayTunnelException(tr('Relay 连接已关闭'))); closeWith(RelayTunnelException(tr('Relay connection closed')));
void sendHello() { void sendHello() {
if (finished) return; if (finished) return;
@@ -373,13 +373,13 @@ class RelayTunnel {
sendHello(); sendHello();
helloTimer = Timer.periodic(const Duration(seconds: 1), (_) => sendHello()); helloTimer = Timer.periodic(const Duration(seconds: 1), (_) => sendHello());
deadline = Timer(_handshakeTimeout, () { deadline = Timer(_handshakeTimeout, () {
closeWith(RelayTunnelException(tr('Relay 握手超时'))); closeWith(RelayTunnelException(tr('Relay handshake timed out')));
}); });
await ready.future; await ready.future;
if (channel.dead) { if (channel.dead) {
throw RelayTunnelException(trArgs( throw RelayTunnelException(trArgs(
'Relay 连接已关闭({0} {1})', 'Relay connection closed ({0} {1})',
[ws.closeCode ?? '-', ws.closeReason ?? ''])); [ws.closeCode ?? '-', ws.closeReason ?? '']));
} }
channel.startKeepAlive(); channel.startKeepAlive();
@@ -604,7 +604,7 @@ class _RelaySocket implements TransportSocket {
_finish(); _finish();
break; break;
case RelayFrameType.streamAbort: case RelayFrameType.streamAbort:
_finish(error: RelayTunnelException(tr('WebSocket 子流被中断'))); _finish(error: RelayTunnelException(tr('WebSocket substream interrupted')));
break; break;
} }
} }
+26 -26
View File
@@ -166,57 +166,57 @@ class ScheduledTask {
/// The model line: a fixed choice, or that the run uses the session's. /// The model line: a fixed choice, or that the run uses the session's.
String get modelLabel { String get modelLabel {
if (useDefaults || modelId.isEmpty) return tr('使用默认模型与智能体'); if (useDefaults || modelId.isEmpty) return tr('Use default model and agent');
final model = [providerId, modelId].where((s) => s.isNotEmpty).join('/'); final model = [providerId, modelId].where((s) => s.isNotEmpty).join('/');
return agent.isEmpty ? model : '$model · $agent'; return agent.isEmpty ? model : '$model · $agent';
} }
} }
const scheduledWeekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; const scheduledWeekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const scheduledTaskKindLabels = { const scheduledTaskKindLabels = {
'daily': '每天', 'daily': 'Daily',
'weekly': '每周', 'weekly': 'Weekly',
'once': '一次性', 'once': 'Once',
'cron': 'Cron', 'cron': 'Cron',
}; };
/// '每天 09:00', '每周 周一、周三 09:00', '一次性 2026-12-01 09:00', … /// '每天 09:00', '每周 周一、周三 09:00', '一次性 2026-12-01 09:00', …
String scheduledScheduleText(ScheduledTask task) { String scheduledScheduleText(ScheduledTask task) {
final separator = tr('、'); final separator = tr(', ');
final times = task.times.isEmpty ? task.time : task.times.join(separator); final times = task.times.isEmpty ? task.time : task.times.join(separator);
switch (task.kind) { switch (task.kind) {
case 'daily': case 'daily':
return trArgs('每天 {0}', [times.isEmpty ? '--:--' : times]); return trArgs('Daily {0}', [times.isEmpty ? '--:--' : times]);
case 'weekly': case 'weekly':
final days = [ final days = [
for (final day in task.weekdays) for (final day in task.weekdays)
if (day >= 0 && day < scheduledWeekdays.length) if (day >= 0 && day < scheduledWeekdays.length)
tr(scheduledWeekdays[day]), tr(scheduledWeekdays[day]),
].join(separator); ].join(separator);
return trArgs('每周 {0} {1}', [ return trArgs('Weekly {0} {1}', [
days.isEmpty ? tr('未选') : days, days.isEmpty ? tr('no days') : days,
times.isEmpty ? '--:--' : times, times.isEmpty ? '--:--' : times,
]); ]);
case 'once': case 'once':
return trArgs('一次性 {0} {1}', [ return trArgs('Once {0} {1}', [
task.date.isEmpty ? tr('未选日期') : task.date, task.date.isEmpty ? tr('no date') : task.date,
task.time.isEmpty ? '--:--' : task.time, task.time.isEmpty ? '--:--' : task.time,
]); ]);
case 'cron': case 'cron':
return trArgs('Cron:{0}', [task.cron]); return trArgs('Cron: {0}', [task.cron]);
} }
return ''; return '';
} }
String scheduledStatusLabel(String status) => switch (status) { String scheduledStatusLabel(String status) => switch (status) {
'success' || 'sent' => tr('成功'), 'success' || 'sent' => tr('Success'),
'error' || 'failed' => tr('错误'), 'error' || 'failed' => tr('Error'),
'running' => tr('运行中'), 'running' => tr('Running'),
'queued' => tr('已排队'), 'queued' => tr('Queued'),
'skipped' => tr('已跳过'), 'skipped' => tr('Skipped'),
'cancelled' => tr('已取消'), 'cancelled' => tr('Cancelled'),
_ => tr('空闲'), _ => tr('Idle'),
}; };
/// How far away a moment is, in the words the web client uses. /// How far away a moment is, in the words the web client uses.
@@ -228,24 +228,24 @@ String scheduledRelativeTime(int milliseconds) {
const hour = 60 * minute; const hour = 60 * minute;
const day = 24 * hour; const day = 24 * hour;
final future = diff >= 0; final future = diff >= 0;
if (abs < minute) return future ? tr('不到 1 分钟后') : tr('刚刚'); if (abs < minute) return future ? tr('In less than a minute') : tr('Just now');
if (abs < hour) { if (abs < hour) {
final m = (abs / minute).round(); final m = (abs / minute).round();
return future return future
? trArgs('{0} 分钟后', [m]) ? trArgs('In {0} min', [m])
: trArgs('{0} 分钟前', [m]); : trArgs('{0} min ago', [m]);
} }
if (abs < day) { if (abs < day) {
final h = abs ~/ hour; final h = abs ~/ hour;
final m = ((abs % hour) / minute).round(); final m = ((abs % hour) / minute).round();
final body = final body =
m > 0 ? trArgs('{0} 小时 {1} 分钟', [h, m]) : trArgs('{0} 小时', [h]); m > 0 ? trArgs('{0} hr {1} min', [h, m]) : trArgs('{0} hr', [h]);
return future ? trArgs('{0}后', [body]) : trArgs('{0}前', [body]); return future ? trArgs('In {0}', [body]) : trArgs('{0} ago', [body]);
} }
final d = abs ~/ day; final d = abs ~/ day;
final h = ((abs % day) / hour).round(); final h = ((abs % day) / hour).round();
final body = h > 0 ? trArgs('{0} 天 {1} 小时', [d, h]) : trArgs('{0} 天', [d]); final body = h > 0 ? trArgs('{0} days {1} hr', [d, h]) : trArgs('{0} days', [d]);
return future ? trArgs('{0}后', [body]) : trArgs('{0}前', [body]); return future ? trArgs('In {0}', [body]) : trArgs('{0} ago', [body]);
} }
String scheduledClock(int milliseconds) { String scheduledClock(int milliseconds) {
+2 -2
View File
@@ -239,11 +239,11 @@ const shellOutputTailBytes = 256 * 1024;
/// `12秒`, `3分05秒`, `1:02:03`: the running clock a task row shows. /// `12秒`, `3分05秒`, `1:02:03`: the running clock a task row shows.
String formatElapsed(int milliseconds) { String formatElapsed(int milliseconds) {
final secs = milliseconds <= 0 ? 0 : milliseconds ~/ 1000; final secs = milliseconds <= 0 ? 0 : milliseconds ~/ 1000;
if (secs < 60) return trArgs('{0}秒', [secs]); if (secs < 60) return trArgs('{0}s', [secs]);
if (secs < 3600) { if (secs < 3600) {
final rest = secs % 60; final rest = secs % 60;
return trArgs( return trArgs(
'{0}分{1}秒', [secs ~/ 60, rest.toString().padLeft(2, '0')]); '{0}m{1}s', [secs ~/ 60, rest.toString().padLeft(2, '0')]);
} }
final hours = secs ~/ 3600; final hours = secs ~/ 3600;
final mins = (secs % 3600) ~/ 60; final mins = (secs % 3600) ~/ 60;
+4 -4
View File
@@ -98,7 +98,7 @@ class CancelToken {
class DownloadCancelled implements Exception { class DownloadCancelled implements Exception {
const DownloadCancelled(); const DownloadCancelled();
@override @override
String toString() => tr('下载已取消'); String toString() => tr('Download cancelled');
} }
/// A proxy as configured: an HTTP CONNECT proxy, or a SOCKS5 one. /// A proxy as configured: an HTTP CONNECT proxy, or a SOCKS5 one.
@@ -120,14 +120,14 @@ ProxyConfig? parseProxy(String? raw) {
if (!normalized.contains('://')) normalized = 'http://$normalized'; if (!normalized.contains('://')) normalized = 'http://$normalized';
final uri = Uri.tryParse(normalized); final uri = Uri.tryParse(normalized);
if (uri == null || uri.host.isEmpty) { if (uri == null || uri.host.isEmpty) {
throw ArgumentError(trArgs('代理地址无效:{0}', [raw])); throw ArgumentError(trArgs('Invalid proxy address: {0}', [raw]));
} }
final scheme = uri.scheme.toLowerCase(); final scheme = uri.scheme.toLowerCase();
final socks = scheme == 'socks' || scheme == 'socks5' || scheme == 'socks5h'; final socks = scheme == 'socks' || scheme == 'socks5' || scheme == 'socks5h';
final http = scheme == 'http' || scheme == 'https'; final http = scheme == 'http' || scheme == 'https';
if (!socks && !http) { if (!socks && !http) {
throw ArgumentError(trArgs( throw ArgumentError(trArgs(
'不支持的代理协议:{0}(支持 http、https、socks5、socks5h)', [scheme])); 'Unsupported proxy protocol: {0} (supported: http, https, socks5, socks5h)', [scheme]));
} }
String? user; String? user;
String? pass; String? pass;
@@ -193,7 +193,7 @@ class DirectTransport implements Transport {
if (_proxyAddress != null) return _proxyAddress!; if (_proxyAddress != null) return _proxyAddress!;
final addresses = await InternetAddress.lookup(_proxyConfig!.host); final addresses = await InternetAddress.lookup(_proxyConfig!.host);
if (addresses.isEmpty) { if (addresses.isEmpty) {
throw SocketException(tr('无法解析代理主机')); throw SocketException(tr('Could not resolve the proxy host'));
} }
return _proxyAddress = addresses.first; return _proxyAddress = addresses.first;
} }
+23 -41
View File
@@ -1,44 +1,17 @@
// The app speaks Chinese and English. Our own text is written in Chinese and // The app speaks English and Chinese. Code writes English; Chinese comes from
// translated by lookup: `tr('保存')` in code that builds strings, `AppText` // the table in l10n/zh.dart through tr()/trArgs(), and AppText for the many
// for the many Text leaves. `设置 → 常规 → 语言` chooses between the system // Text leaves. 设置 → 常规 → 语言 chooses between the system language, Chinese
// language, Chinese and English; Chinese is the fallback for a missing entry, // and English; a language we have no table for reads English, and a missing
// so a new string never disappears. // entry falls back to the English source, so text never disappears.
import 'dart:async'; import 'dart:async';
import 'dart:ui' show PlatformDispatcher; import 'dart:ui' show PlatformDispatcher;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'l10n/en_chat.dart'; import 'l10n/zh.dart';
import 'l10n/en_core.dart';
import 'l10n/en_servers.dart';
import 'l10n/en_sessions.dart';
import 'l10n/en_settings.dart';
import 'l10n/en_tools.dart';
/// Every English string, keyed by the Chinese text it replaces. enum AppLanguage { system, zh, en }
final Map<String, String> englishStrings = <String, String>{
...enCore,
...enChat,
...enSessions,
...enSettings,
...enTools,
...enServers,
};
enum AppLanguage {
system('跟随系统', 'System'),
zh('中文', '中文'),
en('English', 'English');
/// What the choice reads as, in each language.
final String zhLabel;
final String enLabel;
const AppLanguage(this.zhLabel, this.enLabel);
String labelFor(bool english) => english ? enLabel : zhLabel;
}
/// The language the UI is drawn in, and the lookup behind [tr] and [AppText]. /// The language the UI is drawn in, and the lookup behind [tr] and [AppText].
class L10n extends ChangeNotifier { class L10n extends ChangeNotifier {
@@ -92,6 +65,8 @@ class L10n extends ChangeNotifier {
Locale get locale => switch (_choice) { Locale get locale => switch (_choice) {
AppLanguage.zh => const Locale('zh', 'CN'), AppLanguage.zh => const Locale('zh', 'CN'),
AppLanguage.en => const Locale('en'), AppLanguage.en => const Locale('en'),
// Only Chinese is translated; every other system language reads
// English.
AppLanguage.system => AppLanguage.system =>
_systemIsChinese ? const Locale('zh', 'CN') : const Locale('en'), _systemIsChinese ? const Locale('zh', 'CN') : const Locale('en'),
}; };
@@ -106,14 +81,21 @@ class L10n extends ChangeNotifier {
bool get isEnglish => locale.languageCode == 'en'; bool get isEnglish => locale.languageCode == 'en';
/// The English text for [zh], or [zh] when none is written yet. /// What a language choice reads as: a language names itself.
String tr(String zh) => isEnglish ? (englishStrings[zh] ?? zh) : zh; String languageLabel(AppLanguage choice) => switch (choice) {
AppLanguage.system => tr('System'),
AppLanguage.zh => '中文',
AppLanguage.en => 'English',
};
/// Same, for text built from parts: `trArgs('{0} 个子代理', [n])`. The /// The Chinese text for [en], or [en] when there is none.
/// Chinese template is filled as written; English entries use the same String tr(String en) => isEnglish ? en : (chineseStrings[en] ?? en);
/// Same, for text built from parts: `trArgs('{0} subagents', [n])`. The
/// English template is filled as written; Chinese entries use the same
/// `{0}`, `{1}` placeholders. /// `{0}`, `{1}` placeholders.
String trArgs(String template, [List<Object?> args = const []]) { String trArgs(String template, [List<Object?> args = const []]) {
var out = isEnglish ? (englishStrings[template] ?? template) : template; var out = isEnglish ? template : (chineseStrings[template] ?? template);
for (var i = 0; i < args.length; i++) { for (var i = 0; i < args.length; i++) {
out = out.replaceAll('{$i}', '${args[i] ?? ''}'); out = out.replaceAll('{$i}', '${args[i] ?? ''}');
} }
@@ -127,7 +109,7 @@ class L10n extends ChangeNotifier {
} }
} }
String tr(String zh) => L10n.instance.tr(zh); String tr(String en) => L10n.instance.tr(en);
String trArgs(String template, [List<Object?> args = const []]) => String trArgs(String template, [List<Object?> args = const []]) =>
L10n.instance.trArgs(template, args); L10n.instance.trArgs(template, args);
@@ -135,7 +117,7 @@ String trArgs(String template, [List<Object?> args = const []]) =>
/// [Text] that goes through the same lookup. It is const-constructible, so a /// [Text] that goes through the same lookup. It is const-constructible, so a
/// tree does not have to give up `const` to be translated. Content that comes /// tree does not have to give up `const` to be translated. Content that comes
/// from the server (message text, titles) is drawn with plain [Text]: only /// from the server (message text, titles) is drawn with plain [Text]: only
/// our own strings are keys. /// our own source strings are keys.
class AppText extends StatelessWidget { class AppText extends StatelessWidget {
final String data; final String data;
final TextStyle? style; final TextStyle? style;
-183
View File
@@ -1,183 +0,0 @@
// English strings for one part of the app; merged into L10n's table. Keys are
// the Chinese text the code writes, including {0}, {1} placeholders for text
// that is built from parts.
const Map<String, String> enChat = {
'附件不能超过 10MB': 'Attachments cannot be larger than 10 MB',
// Chat app bar and transcript
'返回父会话': 'Back to parent session',
'会话': 'Session',
'文件': 'Files',
'重试': 'Retry',
'载入更早的消息': 'Load earlier messages',
'正在思考…': 'Thinking…',
'此会话由 Lead 管理,接管后才能继续。':
'This session is managed by a Lead; take it over to continue.',
'无法向子智能体会话发送提示。': 'Cannot send prompts to a subagent session.',
'无法打开子代理会话': 'Cannot open the subagent session',
// Pending prompts and message actions
'📎 {0} 个附件': '📎 {0} attachments',
'附件': 'Attachment',
'未发送': 'Not sent',
'正在转入当前回合…': 'Joining this turn…',
'已排队,本轮结束后发送': 'Queued; sends after this turn',
'改为排队': 'Queue instead',
'转为转向': 'Steer instead',
'撤回': 'Withdraw',
'复制': 'Copy',
'复制消息': 'Copy message',
'撤回此消息及之后': 'Withdraw this and later messages',
'从这里分叉': 'Fork from here',
'复制回答': 'Copy answer',
'撤回消息?': 'Withdraw message?',
'这条消息及其之后的内容会从会话中删除,且无法恢复。':
'This message and everything after it will be removed from the session '
'and cannot be recovered.',
'没有可复制的文字': 'Nothing to copy',
'已复制': 'Copied',
// Tool steps and activity
'思考': 'Thinking',
'运行': 'Run',
'读取': 'Read',
'写入': 'Write',
'编辑': 'Edit',
'补丁': 'Patch',
'搜索': 'Search',
'列出': 'List',
'抓取': 'Fetch',
'任务': 'Task',
'子代理': 'Subagent',
'技能': 'Skill',
'生成图片': 'Generate image',
'工具': 'Tool',
'后台': 'Background',
'思考中…': 'Thinking…',
'思考过程': 'Thought process',
'有步骤失败 · {0} 次工具调用': 'A step failed · {0} tool calls',
'执行中 · {0} 次工具调用': 'Running · {0} tool calls',
'已完成 · {0} 次工具调用': 'Done · {0} tool calls',
'正在{0}': '{0} in progress',
'正在回复': 'Replying',
'思考中': 'Thinking',
'{0} 秒': '{0}s',
'输出较大,正在载入…': 'Large output, loading…',
'无输出': 'No output',
'无内容': 'No content',
// Errors
'未知错误': 'Unknown error',
'压缩失败:{0}': 'Compaction failed: {0}',
'OpenCode 发送消息失败,正在重试:{0}':
'OpenCode could not send the message; retrying: {0}',
'OpenCode 发送消息失败:{0}': 'OpenCode could not send the message: {0}',
'模型的认证失败,请在服务端重新登录或检查 API Key。':
'The model failed to authenticate. Sign in again on the server or check '
'the API key.',
'本轮已停止。': 'This turn was stopped.',
'用户停止了这条命令。': 'You stopped this command.',
'停止失败:{0}': 'Could not stop: {0}',
// Compaction
'正在压缩对话': 'Compacting conversation',
'对话已压缩': 'Conversation compacted',
'隐藏摘要': 'Hide summary',
'显示摘要': 'Show summary',
'正在生成摘要…': 'Generating summary…',
'(摘要为空)': '(No summary)',
'收起详情': 'Hide details',
'显示详情': 'Show details',
// Composer
'生成中,仍可输入…': 'Generating; you can still type…',
'发消息…': 'Send a message…',
'添加附件': 'Add attachment',
'停止': 'Stop',
'发送': 'Send',
'选择失败:{0}': 'Selection failed: {0}',
'发送方式': 'Delivery',
'转向当前回合': 'Steer into this turn',
'在下一步加入,工作继续': 'Join at the next step; work continues',
'排队': 'Queue',
'等本轮结束后发送': 'Send after this turn ends',
// Permissions and forms
'请求权限: {0}': 'Permission requested: {0}',
'、': ', ',
'允许一次': 'Allow once',
'总是允许': 'Always allow',
'拒绝': 'Deny',
'取消': 'Cancel',
'请填写:{0}': 'Required: {0}',
'请选择': 'Choose one',
'其他…': 'Other…',
'{0}({1})': '{0} ({1})',
// Usage sheet
'上下文占用': 'Context usage',
'模型': 'Model',
'已用 tokens': 'Tokens used',
'上下文上限': 'Context limit',
'输出预留': 'Reserved output',
'占用': 'Usage',
'本轮费用': 'Turn cost',
'输出预留按最多 32K tokens 计算,与官方客户端一致。':
'Reserved output assumes at most 32K tokens, matching the official '
'client.',
// Images
'图片': 'Image',
'图片无法显示': 'Cannot display image',
'无效的 data URL': 'Invalid data URL',
'不支持的 data URL': 'Unsupported data URL',
'图片加载失败:{0}': 'Could not load image: {0}',
'无法预览:{0}': 'Cannot preview: {0}',
'关闭': 'Close',
// Background commands
'正在执行 {0} 条命令': 'Running {0} commands',
'已结束': 'Ended',
'停止中…': 'Stopping…',
'读取输出…': 'Reading output…',
'等待输出…': 'Waiting for output…',
'没有输出': 'No output',
'回到最新': 'Jump to latest',
'已复制输出': 'Output copied',
'后台输出': 'Background output',
'运行中': 'Running',
'查看全部': 'View all',
'停止这个任务?': 'Stop this task?',
'读取输出失败:{0}': 'Could not read output: {0}',
// Slash palette
'压缩': 'Compact',
'初始化': 'Init',
'审查': 'Review',
'目标': 'Goal',
'新建扩展': 'New extension',
'权限': 'Permission',
'计划': 'Plan',
'反馈': 'Feedback',
'没有可用的指令': 'No commands available',
'这个目录还没有注册指令或技能':
'This directory has no commands or skills yet',
// Model picker and controls
'选择模型': 'Choose model',
'正在载入模型…': 'Loading models…',
'没有结果': 'No results',
'收藏': 'Favorites',
'取消收藏': 'Remove from favorites',
'最近': 'Recent',
'其它': 'Other',
'{0} 上下文': '{0} context',
'思考强度': 'Thinking effort',
'完成': 'Done',
'模式': 'Mode',
'先规划,不改动文件': 'Plan first without changing files',
'直接构建': 'Build directly',
// Diff view
'文件 {0}': 'File {0}',
'仅显示前 {0} 行,共 {1} 行': 'Showing the first {0} of {1} lines',
};
-95
View File
@@ -1,95 +0,0 @@
// English strings for one part of the app; merged into L10n's table. Keys are
// the Chinese text the code writes, including {0}, {1} placeholders for text
// that is built from parts.
const Map<String, String> enCore = {
// state.dart
'未连接': 'Not connected',
'保存失败:{0}': 'Could not save: {0}',
'配对链接无效或已过期': 'Pairing link is invalid or expired',
'服务器没有返回设备令牌': 'Server did not return a device token',
'配对失败': 'Pairing failed',
'Relay 服务器': 'Relay server',
'配对已失效,请重新配对': 'Pairing expired, please pair again',
'需要密码或已保存的凭据': 'Password or saved credentials required',
'登录成功但没有返回令牌': 'Signed in but no token was returned',
'密码错误,请重试': 'Wrong password, try again',
'连接超时:检查服务器与代理地址':
'Connection timed out: check the server and proxy address',
'连接被拒绝:服务器或代理未启动,或端口不对':
'Connection refused: server or proxy not running, or wrong port',
'无法解析地址:检查服务器或代理主机名':
'Could not resolve address: check the server or proxy hostname',
'网络不可达': 'Network unreachable',
'连接被断开:检查代理是否可用':
'Connection closed: check whether the proxy works',
'网络错误:{0}': 'Network error: {0}',
'使用 AI 压缩会话历史以减少上下文大小':
'Use AI to compact the session history and reduce context size',
'聊天': 'Chat',
'无法打开子代理会话:{0}': 'Could not open the subagent session: {0}',
'未连接服务器': 'Not connected to a server',
'服务器没有提供聊天目录': 'Server did not provide a chat directory',
'无法创建聊天目录:{0}': 'Could not create the chat directory: {0}',
'连接中断,正在重连…': 'Connection lost, reconnecting…',
'附件': 'Attachment',
// api/relay_tunnel.dart
'响应头无效': 'Invalid response headers',
'传输被中断': 'Transfer interrupted',
'无法连接 Relay:{0}': 'Could not connect to the relay: {0}',
'密钥协商失败:{0}': 'Key exchange failed: {0}',
'握手后收到明文帧': 'Received a plaintext frame after the handshake',
'解密失败:{0}': 'Decryption failed: {0}',
'Relay 连接出错:{0}': 'Relay connection error: {0}',
'Relay 连接已关闭({0} {1})': 'Relay connection closed ({0} {1})',
'Relay 连接已关闭': 'Relay connection closed',
'Relay 握手超时': 'Relay handshake timed out',
'WebSocket 子流被中断': 'WebSocket substream interrupted',
// pets/pet_library.dart
'文件为空': 'File is empty',
'宠物包不能超过 40MB': 'Pet pack cannot exceed 40 MB',
'不是有效的 zip 文件': 'Not a valid zip file',
'压缩包里没有 pack.json': 'The archive has no pack.json',
'pack.json 不是有效的宠物包': 'pack.json is not a valid pet pack',
'pack.json 缺少动画或状态': 'pack.json is missing animations or states',
'解压后超过 60MB': 'Extracted size exceeds 60 MB',
'动画 {0} 没有精灵图': 'Animation {0} has no sprite sheet',
'缺少精灵图 {0}': 'Missing sprite sheet {0}',
// model_prefs.dart
'默认': 'Default',
'无': 'None',
'极低': 'Minimal',
'低': 'Low',
'中': 'Medium',
'高': 'High',
'极高': 'Extra high',
// terminal_state.dart
'终端 {0}': 'Terminal {0}',
'终端 1': 'Terminal 1',
'终端': 'Terminal',
'已退出': 'Exited',
'退出码 {0}': 'Exit code {0}',
'终端连接失败': 'Terminal connection failed',
// api/transport.dart
'下载已取消': 'Download cancelled',
'代理地址无效:{0}': 'Invalid proxy address: {0}',
'不支持的代理协议:{0}(支持 http、https、socks5、socks5h)':
'Unsupported proxy protocol: {0} (supported: http, https, socks5, socks5h)',
'无法解析代理主机': 'Could not resolve the proxy host',
// api/models.dart
'偏好': 'Preference',
'参考': 'Reference',
'事实': 'Fact',
// api/shells.dart
'{0}秒': '{0}s',
'{0}分{1}秒': '{0}m{1}s',
// api/relay_transport.dart
'无法获取 WebSocket 令牌({0})': 'Could not get a WebSocket token ({0})',
};
-71
View File
@@ -1,71 +0,0 @@
// English strings for one part of the app; merged into L10n's table. Keys are
// the Chinese text the code writes, including {0}, {1} placeholders for text
// that is built from parts.
const Map<String, String> enServers = {
'需要密码': 'Password',
// Server list
'连接你的 OpenChamber 服务器': 'Connect to your OpenChamber server',
'添加服务器': 'Add server',
'配对链接': 'Pairing link',
'经由 Relay · {0}': 'Via Relay · {0}',
'经由 {0}': 'Via {0}',
'已连接': 'Connected',
'连接': 'Connect',
'编辑': 'Edit',
'删除': 'Delete',
'删除服务器?': 'Delete server?',
'“{0}”将从列表移除,设备令牌也会删除。':
'“{0}” will be removed from the list, and its device token will be deleted.',
'取消': 'Cancel',
'配对失败': 'Pairing failed',
// Connect form
'连接 {0}': 'Connect to {0}',
'名称': 'Name',
'如 我的电脑': 'e.g. My computer',
'通过 Relay 连接': 'Connect through Relay',
'端到端加密;服务器与设备令牌保持不变':
'End-to-end encrypted; the server and device token stay the same',
'服务器地址': 'Server address',
'代理(可选)': 'Proxy (optional)',
'http://… 或 socks5://…': 'http://… or socks5://…',
'自签证书指纹(可选)': 'Self-signed certificate fingerprint (optional)',
'SHA-256 十六进制': 'SHA-256 hex',
'信任自签名证书': 'Trust self-signed certificates',
'密码(如果需要)': 'Password (if required)',
'服务器密码;服务器未设置可留空':
'Server password; leave empty if the server has none',
// Pairing dialog
'在 OpenChamber 网页端打开「连接设备」,粘贴链接或直接扫描二维码。'
'链接里带一次性密钥,以及直连地址或私有 Relay。':
'In the OpenChamber web app, open “Connect a device”, then paste the link '
'or scan the QR code. The link carries a one-time key and either a '
'direct address or a private Relay.',
'扫码': 'Scan QR code',
'粘贴': 'Paste',
'配对并连接': 'Pair and connect',
// QR scanner
'没有可用的相机': 'No camera available',
'没有收到相机画面,请关闭后重试':
'No camera frames received; close and try again',
'还没识别到二维码,试着靠近一点或让二维码占满取景框':
'No QR code yet; move closer or fill the frame with the code',
'需要相机权限才能扫码。请在系统设置里允许 OpenChamber 使用相机。':
'Camera permission is required to scan. Allow OpenChamber to use the '
'camera in system settings.',
'无法打开相机:{0}': 'Could not open the camera: {0}',
'这不是 OpenChamber 配对二维码': 'This is not an OpenChamber pairing QR code',
'二维码解码出错,请重试': 'Could not decode the QR code; try again',
'这个相机不支持手电筒': 'This camera does not support the flashlight',
'重试': 'Retry',
'关闭': 'Close',
'手电筒': 'Flashlight',
'把配对二维码放进框内': 'Put the pairing QR code inside the frame',
'在 OpenChamber 网页端打开「连接设备」,选择二维码':
'In the OpenChamber web app, open “Connect a device” and choose the QR '
'code',
'{0} · 已扫描 {1} 帧 / 解码 {2} 次':
'{0} · {1} frames scanned / {2} decode attempts',
};
-167
View File
@@ -1,167 +0,0 @@
// English strings for one part of the app; merged into L10n's table. Keys are
// the Chinese text the code writes, including {0}, {1} placeholders for text
// that is built from parts.
const Map<String, String> enSessions = {
'选择一个会话': 'Choose a session',
'打开会话列表': 'Open the session list',
// ------------------------------------------------------------ knowledge
'这个会话没有关联目录': 'This session has no directory',
'搜索笔记、待办与计划': 'Search notes, todos, and plans',
'搜索笔记、待办、计划与记忆': 'Search notes, todos, plans, and memory',
'刷新': 'Refresh',
'笔记': 'Notes',
'待办': 'Todos',
'计划': 'Plans',
'记忆': 'Memory',
'重试': 'Retry',
'{0} 条笔记': '{0} notes',
'新建笔记': 'New note',
'还没有笔记': 'No notes yet',
'没有匹配的笔记': 'No matching notes',
'编辑': 'Edit',
'取消置顶': 'Unpin',
'置顶': 'Pin',
'删除': 'Delete',
'{0}/{1} 已完成': '{0}/{1} done',
'新建待办': 'New todo',
'还没有待办': 'No todos yet',
'没有匹配的待办': 'No matching todos',
'{0} 份计划': '{0} plans',
'新建计划': 'New plan',
'还没有计划': 'No plans yet',
'没有匹配的计划': 'No matching plans',
'团队共享': 'Shared',
'个人': 'Personal',
'记忆功能未启用': 'Memory is not enabled',
'还没有记忆': 'No memories yet',
'没有匹配的记忆': 'No matching memories',
'全局记忆': 'Global memory',
'项目记忆': 'Project memory',
'{0}({1})': '{0} ({1})',
'记忆由 agent 在会话中记录;你可以在这里修改或删除它。':
'Memory is recorded by the agent during sessions; you can edit or delete it here.',
'读取失败,请刷新': 'Could not load, refresh to retry',
'暂无': 'None',
'编辑笔记': 'Edit note',
'记点什么,供之后的会话参考': 'Write something for later sessions to read',
'保存': 'Save',
'要做什么': 'What needs doing',
'保存中…': 'Saving…',
'标题': 'Title',
'计划正文(Markdown)': 'Plan body (Markdown)',
'创建': 'Create',
'编辑记忆': 'Edit memory',
'事实': 'Fact',
'偏好': 'Preference',
'参考': 'Reference',
'内容': 'Content',
'取消': 'Cancel',
// ------------------------------------------------------------- sessions
'会话': 'Sessions',
'搜索': 'Search',
'新会话': 'New session',
'搜索会话': 'Search sessions',
'全部功能': 'All features',
'设置': 'Settings',
'暂无会话': 'No sessions',
'没有匹配的会话': 'No matching sessions',
'聊天': 'Chat',
'未命名项目': 'Untitled project',
'新建聊天': 'New chat',
'在此项目新会话': 'New session in this project',
'今天': 'Today',
'昨天': 'Yesterday',
'本周早些时候': 'Earlier this week',
'更早': 'Earlier',
'已置顶': 'Pinned',
'草稿': 'Draft',
'草稿 · {0}': 'Draft · {0}',
'丢弃草稿': 'Discard draft',
'归档': 'Archive',
'取消归档': 'Unarchive',
'收起子代理': 'Collapse subagents',
'展开子代理': 'Expand subagents',
'(无标题会话)': '(Untitled session)',
'子代理 · {0}': 'Subagent · {0}',
'已复制会话 ID': 'Session ID copied',
'重命名': 'Rename',
'复制会话 ID': 'Copy session ID',
'载入更多': 'Load more',
'隐藏已归档': 'Hide archived',
'显示已归档': 'Show archived',
'显示已归档 ({0})': 'Show archived ({0})',
'没有已归档的会话': 'No archived sessions',
'{0} 个子代理': '{0} subagents',
'“{0}”及其子会话将被删除,且无法恢复。':
'“{0}” and its subagent sessions will be deleted permanently.',
'服务器': 'Servers',
'经由 Relay · {0}': 'via Relay · {0}',
'{0}\n经由 {1}': '{0}\nvia {1}',
'已连接': 'Connected',
'添加服务器': 'Add server',
'配对链接': 'Pairing link',
'直连地址或 OpenChamber Relay': 'Direct address or OpenChamber Relay',
'断开当前连接': 'Disconnect',
'删除会话?': 'Delete session?',
// ---------------------------------------------------------------- files
'文件': 'Files',
'文件较大({0}),请下载后查看': 'File is large ({0}), download it to view',
'已保存': 'Saved',
'保存失败:{0}': 'Could not save: {0}',
'新建文件夹': 'New folder',
'新建文件': 'New file',
'名称': 'Name',
'例如 docs': 'e.g. docs',
'例如 notes.md': 'e.g. notes.md',
'名称里不能有斜杠': 'Names cannot contain slashes',
'项目知识': 'Project knowledge',
'终端': 'Terminal',
'关闭侧栏': 'Close sidebar',
'搜索当前目录…': 'Search this directory…',
'搜索子目录': 'Search subdirectories',
'正在搜索子目录…({0})': 'Searching subdirectories… ({0})',
'返回': 'Back',
'上一级': 'Up one level',
'预览': 'Preview',
'下载': 'Download',
'新建': 'New',
'更多': 'More',
'显示被 git 忽略的文件': 'Show git-ignored files',
'目录为空': 'Directory is empty',
'没有匹配的文件': 'No matching files',
'子目录结果': 'Subdirectory results',
'子目录里没有匹配的文件': 'No matching files in subdirectories',
'这个文件无法预览': 'This file cannot be previewed',
'正在下载': 'Downloading',
'{0} / {1}({2}%)': '{0} / {1} ({2}%)',
'已下载 {0}': 'Downloaded {0}',
'正在取消…': 'Canceling…',
'关闭': 'Close',
// ------------------------------------------------------------- terminal
'未启动': 'Not started',
'正在创建…': 'Creating…',
'正在连接…': 'Connecting…',
'连接中断,正在重连…': 'Connection lost, reconnecting…',
'运行中': 'Running',
'已退出': 'Exited',
'连接失败': 'Connection failed',
'切换终端': 'Switch terminal',
'新建终端': 'New terminal',
'键盘': 'Keyboard',
'重新启动': 'Restart',
'清屏': 'Clear screen',
'关闭此终端': 'Close this terminal',
// ---------------------------------------------------------- new session
'选择失败:{0}': 'Could not attach: {0}',
'我们今天要做什么?': 'What are we building today?',
'选择项目': 'Choose project',
'规划、构建或提问': 'Plan, build, or ask',
'添加附件': 'Add attachment',
'不关联项目,保存在 OpenChamber 的聊天目录':
'Not tied to a project, saved in OpenChamber\'s chat directory',
'没有可用的项目': 'No projects available',
};
-4
View File
@@ -1,4 +0,0 @@
// English strings for one part of the app; merged into L10n's table. Keys are
// the Chinese text the code writes, including {0}, {1} placeholders for text
// that is built from parts.
const Map<String, String> enSettings = {};
-249
View File
@@ -1,249 +0,0 @@
// English strings for one part of the app; merged into L10n's table. Keys are
// the Chinese text the code writes, including {0}, {1} placeholders for text
// that is built from parts.
const Map<String, String> enTools = {
// settings index
'设置': 'Settings',
'常规': 'General',
'语言': 'Language',
'跟随系统、中文或 English': 'Follow the system, Chinese or English',
'通用': 'Agent tools',
'智能体工具与记忆': 'Agent tools and memory',
'聊天': 'Chat',
'追问处理行为': 'Follow-up behavior',
'外观': 'Appearance',
'仅当前设备生效,不同步到服务器':
'Applies to this device only; not synced to the server',
'主题': 'Theme',
'主题模式与主题色': 'Theme mode and color',
'宠物': 'Pet',
'导入、启用与大小': 'Import, enable and size',
'帮助与关于': 'Help & about',
'关于': 'About',
'版本、服务端与开源许可': 'Version, server and open-source licenses',
// general: agent tools
'在聊天中': 'In chat',
'图表和原型': 'Charts and prototypes',
'让智能体在聊天中展示图表、表格、示意图和界面草图(与你的文件隔离),并请你在其中选择一个选项。':
'Let the agent show charts, tables, diagrams and UI sketches in chat (isolated from your files) and ask you to pick one of them.',
'图像': 'Images',
'让智能体用你选择的模型生成和编辑图像,费用由该模型的提供商收取。':
'Let the agent generate and edit images with the model you choose; the model\'s provider charges for it.',
'图像模型': 'Image model',
'你的提供商中没有图像模型': 'Your provider has no image models',
'不指定': 'None',
'密钥': 'Secrets',
'允许智能体在聊天中的私密卡片上向你索取 API 密钥、令牌或密码。值不会进入对话。':
'Let the agent ask you for API keys, tokens or passwords on a private card in chat. Values never enter the conversation.',
'通知': 'Notifications',
'工作完成或卡住时,智能体会通知你。':
'The agent notifies you when work finishes or gets stuck.',
'智能体知道的内容': 'What the agent knows',
'记忆': 'Memory',
'跨会话记住关于你和每个项目的事实。':
'Remember facts about you and each project across sessions.',
'项目知识': 'Project knowledge',
'让智能体读取并更新项目的笔记、待办和计划。':
'Let the agent read and update the project\'s notes, todos and plans.',
'用量限额': 'Usage limits',
'让智能体查看各提供商的限额及重置时间。':
'Let the agent check each provider\'s limits and reset times.',
'未选择': 'Not selected',
'默认': 'Default',
'默认模型': 'Default model',
'整理记忆': 'Tidy memory',
'整理记忆使用的模型': 'Model for tidying memory',
'知道了': 'Got it',
'每天一次,在没有会话运行时,智能体会在后台整理记忆:合并重复条目,删除已过时或项目文档中已有的内容。':
'Once a day, when no session is running, the agent tidies memory in the background: merging duplicates and removing entries that are obsolete or already in the project docs.',
'保存失败:{0}': 'Couldn\'t save: {0}',
'保存失败': 'Couldn\'t save',
'未知错误': 'Unknown error',
// language
'中文': 'Chinese',
'当前:{0}': 'Current: {0}',
'界面文字与系统自带的日期、时间选择器会一起切换。':
'The UI text switches together with the system\'s date and time pickers.',
// chat behavior
'运行中按发送时,消息默认怎么处理。与网页端设置同步。':
'What happens by default when you press send while a run is in progress. Synced with the web client\'s setting.',
'转向': 'Steer',
'排队': 'Queue',
'转向:在下一步加入当前回合,工作继续。':
'Steer: joins the current turn at the next step and work continues.',
'排队:等当前回合结束后再发送。':
'Queue: sends after the current turn ends.',
// theme
'跟随系统': 'Follow system',
'浅色': 'Light',
'深色': 'Dark',
'主题模式': 'Theme mode',
'主题色': 'Accent color',
'主题色 {0}': 'Accent color {0}',
'主题只保存在本机,不随服务器同步。':
'The theme is stored on this device only and does not sync with the server.',
// pet
'默认不提供宠物;宠物包只存放在本机。':
'No pet is included; pet packs stay on this device.',
'尚未导入宠物': 'No pet imported',
'导入一个宠物包(.zip)后,它会站在输入框上方。':
'Import a pet pack (.zip) and it will stand above the input box.',
'导入宠物包': 'Import pet pack',
'选择宠物包(.zip)': 'Select a pet pack (.zip)',
'已导入 {0}': 'Imported {0}',
'导入失败:{0}': 'Import failed: {0}',
'启用宠物': 'Enable pet',
'站在输入框上方,默认关闭': 'Stands above the input box; off by default',
'大小': 'Size',
'小': 'Small',
'中': 'Medium',
'大': 'Large',
'更换宠物包': 'Change pet pack',
'移除': 'Remove',
'移除宠物?': 'Remove pet?',
'本机保存的宠物包会被删除。':
'The pet pack stored on this device will be deleted.',
'取消': 'Cancel',
// about
'读取中…': 'Loading…',
'未连接': 'Not connected',
'未获取到': 'Not available',
'重新获取服务端版本': 'Fetch the server version again',
'手机客户端': 'Mobile client',
'应用': 'App',
'版本': 'Version',
'未知': 'Unknown',
'开源许可': 'Open-source licenses',
'本应用使用的第三方组件与它们的许可证':
'Third-party components used by this app and their licenses',
'服务端': 'Server',
'版本取自当前连接的服务器': 'Version comes from the currently connected server',
'下面列出随本应用打包的第三方组件;点开可阅读完整许可证。':
'Third-party components bundled with this app are listed below; tap one to read its full license.',
'该组件没有附带许可证文本。': 'This component has no license text.',
// features
'全部功能': 'All features',
'服务器与智能体的工具都收在这里。':
'Tools for servers and agents are collected here.',
'计划任务': 'Scheduled tasks',
'按时间向会话发送提示词': 'Send prompts to sessions on a schedule',
// scheduled task editor
'新建计划任务': 'New scheduled task',
'编辑计划任务': 'Edit scheduled task',
'保存中…': 'Saving…',
'保存': 'Save',
'运行位置:{0}': 'Runs in: {0}',
'任务名称': 'Task name',
'每日同步': 'Daily sync',
'提示词': 'Prompt',
'总结未完成任务并给出下一步建议':
'Summarize unfinished tasks and suggest next steps',
'计划类型': 'Schedule type',
'星期': 'Weekdays',
'日期': 'Date',
'时间': 'Time',
'Cron 表达式': 'Cron expression',
'每 5 分钟': 'Every 5 minutes',
'每小时': 'Every hour',
'每天 9 点': 'Daily at 9',
'每周一 9 点': 'Mondays at 9',
'每月 1 日': '1st of each month',
'时间点': 'Times',
'移除时间': 'Remove time',
'添加时间': 'Add time',
'时间按服务器所在时区。': 'Times follow the server\'s time zone.',
'选择模型': 'Select model',
'默认智能体': 'Default agent',
'模型': 'Model',
'智能体': 'Agent',
'使用默认模型与智能体': 'Use default model and agent',
'关闭后可固定这次运行使用的模型和智能体。':
'Turn off to pin the model and agent this run uses.',
'已启用': 'Enabled',
'暂停的任务不会按计划运行,但可以手动运行。':
'Paused tasks don\'t run on schedule but can still be run manually.',
'任务名称为必填项': 'Task name is required',
'任务名称不能超过 80 个字符': 'Task name can\'t exceed 80 characters',
'提示词为必填项': 'Prompt is required',
'提示词不能超过 20000 个字符': 'Prompt can\'t exceed 20,000 characters',
'时间格式必须是 HH:mm': 'Time must be in HH:mm format',
'请至少选择一个星期': 'Select at least one weekday',
'Cron 表达式为必填项': 'Cron expression is required',
'请选择模型,或改回使用默认模型':
'Select a model, or switch back to the default model',
// scheduled tasks list
'未连接服务器': 'Not connected to a server',
'服务器不支持计划任务': 'The server doesn\'t support scheduled tasks',
'加载计划任务失败:{0}': 'Couldn\'t load scheduled tasks: {0}',
'计划任务已保存': 'Scheduled task saved',
'保存任务失败': 'Couldn\'t save task',
'保存任务失败:{0}': 'Couldn\'t save task: {0}',
'更新任务失败': 'Couldn\'t update task',
'任务已启动': 'Task started',
'任务已在队列中等待': 'Task is already waiting in the queue',
'运行任务失败': 'Couldn\'t run task',
'运行任务失败:{0}': 'Couldn\'t run task: {0}',
'删除计划任务?': 'Delete scheduled task?',
'“{0}”及其计划会被删除。': '“{0}” and its schedule will be deleted.',
'计划任务已删除': 'Scheduled task deleted',
'删除任务失败': 'Couldn\'t delete task',
'刷新': 'Refresh',
'新建任务': 'New task',
'下次:{0}': 'Next: {0}',
'已暂停': 'Paused',
'上次运行 {0} · {1}': 'Last run {0} · {1}',
'从未运行': 'Never run',
'更多': 'More',
'立即运行': 'Run now',
'编辑': 'Edit',
'删除': 'Delete',
'运行位置': 'Runs in',
'重试': 'Retry',
'暂无计划任务。': 'No scheduled tasks yet.',
'发送到现有会话': 'Sends to an existing session',
// scheduled task schedule text and status
'周日': 'Sun',
'周一': 'Mon',
'周二': 'Tue',
'周三': 'Wed',
'周四': 'Thu',
'周五': 'Fri',
'周六': 'Sat',
'每天': 'Daily',
'每周': 'Weekly',
'一次性': 'Once',
'每天 {0}': 'Daily {0}',
'每周 {0} {1}': 'Weekly {0} {1}',
'未选': 'no days',
'一次性 {0} {1}': 'Once {0} {1}',
'未选日期': 'no date',
'Cron:{0}': 'Cron: {0}',
'、': ', ',
'成功': 'Success',
'错误': 'Error',
'运行中': 'Running',
'已排队': 'Queued',
'已跳过': 'Skipped',
'已取消': 'Cancelled',
'空闲': 'Idle',
'不到 1 分钟后': 'In less than a minute',
'刚刚': 'Just now',
'{0} 分钟后': 'In {0} min',
'{0} 分钟前': '{0} min ago',
'{0} 小时 {1} 分钟': '{0} hr {1} min',
'{0} 小时': '{0} hr',
'{0} 天 {1} 小时': '{0} days {1} hr',
'{0} 天': '{0} days',
'{0}后': 'In {0}',
'{0}前': '{0} ago',
};
+550
View File
@@ -0,0 +1,550 @@
// Chinese text for every string the code writes in English. Keys are the
// English source, including {0}, {1} placeholders; a missing key falls back
// to the English itself, so an unsupported language simply reads English.
const Map<String, String> chineseStrings = {
'(No summary)': '(摘要为空)',
'(Untitled session)': '(无标题会话)',
', ': '、',
'1st of each month': '每月 1 日',
'A step failed · {0} tool calls': '有步骤失败 · {0} 次工具调用',
'About': '关于',
'Accent color': '主题色',
'Accent color {0}': '主题色 {0}',
'Add attachment': '添加附件',
'Add server': '添加服务器',
'Add time': '添加时间',
'Agent': '智能体',
'Agent tools': '通用',
'Agent tools and memory': '智能体工具与记忆',
'All features': '全部功能',
'Allow once': '允许一次',
'Always allow': '总是允许',
'Animation {0} has no sprite sheet': '动画 {0} 没有精灵图',
'App': '应用',
'Appearance': '外观',
'Applies to this device only; not synced to the server': '仅当前设备生效,不同步到服务器',
'Archive': '归档',
'Attachment': '附件',
'Attachments cannot be larger than 10 MB': '附件不能超过 10MB',
'Back': '返回',
'Back to parent session': '返回父会话',
'Background': '后台',
'Background output': '后台输出',
'Build directly': '直接构建',
'Camera permission is required to scan. Allow OpenChamber to use the camera in system settings.': '需要相机权限才能扫码。请在系统设置里允许 OpenChamber 使用相机。',
'Attachments': '附件',
'Cancel': '取消',
'Canceling…': '正在取消…',
'Cancelled': '已取消',
'Cannot display image': '图片无法显示',
'Cannot open the subagent session': '无法打开子代理会话',
'Cannot preview: {0}': '无法预览:{0}',
'Cannot send prompts to a subagent session.': '无法向子智能体会话发送提示。',
'Change pet pack': '更换宠物包',
'Charts and prototypes': '图表和原型',
'Chat': '聊天',
'Chinese': '中文',
'Choose a session': '选择一个会话',
'Choose one': '请选择',
'Choose project': '选择项目',
'Clear screen': '清屏',
'Close': '关闭',
'Close sidebar': '关闭侧栏',
'Close this terminal': '关闭此终端',
'Collapse subagents': '收起子代理',
'Compact': '压缩',
'Compacting conversation': '正在压缩对话',
'Compaction failed: {0}': '压缩失败:{0}',
'Connect': '连接',
'Connect through Relay': '通过 Relay 连接',
'Connect to your OpenChamber server': '连接你的 OpenChamber 服务器',
'Connect to {0}': '连接 {0}',
'Connected': '已连接',
'Connecting…': '正在连接…',
'Connection closed: check whether the proxy works': '连接被断开:检查代理是否可用',
'Connection failed': '连接失败',
'Connection lost, reconnecting…': '连接中断,正在重连…',
'Connection refused: server or proxy not running, or wrong port': '连接被拒绝:服务器或代理未启动,或端口不对',
'Connection timed out: check the server and proxy address': '连接超时:检查服务器与代理地址',
'Content': '内容',
'Context limit': '上下文上限',
'Context usage': '上下文占用',
'Conversation compacted': '对话已压缩',
'Copied': '已复制',
'Copy': '复制',
'Copy answer': '复制回答',
'Copy message': '复制消息',
'Copy session ID': '复制会话 ID',
'Could not attach: {0}': '选择失败:{0}',
'Could not connect to the relay: {0}': '无法连接 Relay:{0}',
'Could not create the chat directory: {0}': '无法创建聊天目录:{0}',
'Could not decode the QR code; try again': '二维码解码出错,请重试',
'Could not get a WebSocket token ({0})': '无法获取 WebSocket 令牌({0})',
'Could not load image: {0}': '图片加载失败:{0}',
'Could not load, refresh to retry': '读取失败,请刷新',
'Could not open the camera: {0}': '无法打开相机:{0}',
'Could not open the subagent session: {0}': '无法打开子代理会话:{0}',
'Could not read output: {0}': '读取输出失败:{0}',
'Could not resolve address: check the server or proxy hostname': '无法解析地址:检查服务器或代理主机名',
'Could not resolve the proxy host': '无法解析代理主机',
'Could not stop: {0}': '停止失败:{0}',
'Couldn\'t delete task': '删除任务失败',
'Couldn\'t load scheduled tasks: {0}': '加载计划任务失败:{0}',
'Couldn\'t run task': '运行任务失败',
'Couldn\'t run task: {0}': '运行任务失败:{0}',
'Couldn\'t save': '保存失败',
'Couldn\'t save task': '保存任务失败',
'Couldn\'t save task: {0}': '保存任务失败:{0}',
'Couldn\'t save: {0}': '保存失败:{0}',
'Couldn\'t update task': '更新任务失败',
'Create': '创建',
'Creating…': '正在创建…',
'Cron expression': 'Cron 表达式',
'Cron expression is required': 'Cron 表达式为必填项',
'Cron: {0}': 'Cron:{0}',
'Current: {0}': '当前:{0}',
'Daily': '每天',
'Daily at 9': '每天 9 点',
'Daily sync': '每日同步',
'Daily {0}': '每天 {0}',
'Dark': '深色',
'Date': '日期',
'Decryption failed: {0}': '解密失败:{0}',
'Default': '默认',
'Default agent': '默认智能体',
'Default model': '默认模型',
'Delete': '删除',
'Delete scheduled task?': '删除计划任务?',
'Delete server?': '删除服务器?',
'Delete session?': '删除会话?',
'Delivery': '发送方式',
'Deny': '拒绝',
'Direct address or OpenChamber Relay': '直连地址或 OpenChamber Relay',
'Directory is empty': '目录为空',
'Discard draft': '丢弃草稿',
'Disconnect': '断开当前连接',
'Done': '完成',
'Done · {0} tool calls': '已完成 · {0} 次工具调用',
'Download': '下载',
'Download cancelled': '下载已取消',
'Downloaded {0}': '已下载 {0}',
'Downloading': '正在下载',
'Draft': '草稿',
'Draft · {0}': '草稿 · {0}',
'e.g. docs': '例如 docs',
'e.g. My computer': '如 我的电脑',
'e.g. notes.md': '例如 notes.md',
'Earlier': '更早',
'Earlier this week': '本周早些时候',
'Edit': '编辑',
'Edit memory': '编辑记忆',
'Edit note': '编辑笔记',
'Edit scheduled task': '编辑计划任务',
'Enable pet': '启用宠物',
'Enabled': '已启用',
'End-to-end encrypted; the server and device token stay the same': '端到端加密;服务器与设备令牌保持不变',
'Ended': '已结束',
'Error': '错误',
'Every 5 minutes': '每 5 分钟',
'Every hour': '每小时',
'Exit code {0}': '退出码 {0}',
'Exited': '已退出',
'Expand subagents': '展开子代理',
'Extra high': '极高',
'Extracted size exceeds 60 MB': '解压后超过 60MB',
'Fact': '事实',
'Favorites': '收藏',
'Feedback': '反馈',
'Fetch': '抓取',
'Fetch the server version again': '重新获取服务端版本',
'File is empty': '文件为空',
'File is large ({0}), download it to view': '文件较大({0}),请下载后查看',
'File {0}': '文件 {0}',
'Files': '文件',
'Flashlight': '手电筒',
'Follow system': '跟随系统',
'Follow the system, Chinese or English': '跟随系统、中文或 English',
'Follow-up behavior': '追问处理行为',
'Fork from here': '从这里分叉',
'Fri': '周五',
'General': '常规',
'Generate image': '生成图片',
'Generating summary…': '正在生成摘要…',
'Generating; you can still type…': '生成中,仍可输入…',
'Global memory': '全局记忆',
'Goal': '目标',
'Got it': '知道了',
'Help & about': '帮助与关于',
'Hide archived': '隐藏已归档',
'Hide details': '收起详情',
'Hide summary': '隐藏摘要',
'High': '高',
'http://… or socks5://…': 'http://… 或 socks5://…',
'Idle': '空闲',
'Image': '图片',
'Image model': '图像模型',
'Images': '图像',
'Import a pet pack (.zip) and it will stand above the input box.': '导入一个宠物包(.zip)后,它会站在输入框上方。',
'Import failed: {0}': '导入失败:{0}',
'Import pet pack': '导入宠物包',
'Import, enable and size': '导入、启用与大小',
'Imported {0}': '已导入 {0}',
'In chat': '在聊天中',
'In less than a minute': '不到 1 分钟后',
'In the OpenChamber web app, open “Connect a device” and choose the QR code': '在 OpenChamber 网页端打开「连接设备」,选择二维码',
'In the OpenChamber web app, open “Connect a device”, then paste the link or scan the QR code. The link carries a one-time key and either a direct address or a private Relay.': '在 OpenChamber 网页端打开「连接设备」,粘贴链接或直接扫描二维码。链接里带一次性密钥,以及直连地址或私有 Relay。',
'In {0}': '{0}后',
'In {0} min': '{0} 分钟后',
'Init': '初始化',
'Invalid data URL': '无效的 data URL',
'Invalid proxy address: {0}': '代理地址无效:{0}',
'Invalid response headers': '响应头无效',
'Join at the next step; work continues': '在下一步加入,工作继续',
'Joining this turn…': '正在转入当前回合…',
'Jump to latest': '回到最新',
'Just now': '刚刚',
'Key exchange failed: {0}': '密钥协商失败:{0}',
'Keyboard': '键盘',
'Language': '语言',
'Large': '大',
'Large output, loading…': '输出较大,正在载入…',
'Last run {0} · {1}': '上次运行 {0} · {1}',
'Let the agent ask you for API keys, tokens or passwords on a private card in chat. Values never enter the conversation.': '允许智能体在聊天中的私密卡片上向你索取 API 密钥、令牌或密码。值不会进入对话。',
'Let the agent check each provider\'s limits and reset times.': '让智能体查看各提供商的限额及重置时间。',
'Let the agent generate and edit images with the model you choose; the model\'s provider charges for it.': '让智能体用你选择的模型生成和编辑图像,费用由该模型的提供商收取。',
'Let the agent read and update the project\'s notes, todos and plans.': '让智能体读取并更新项目的笔记、待办和计划。',
'Let the agent show charts, tables, diagrams and UI sketches in chat (isolated from your files) and ask you to pick one of them.': '让智能体在聊天中展示图表、表格、示意图和界面草图(与你的文件隔离),并请你在其中选择一个选项。',
'Light': '浅色',
'List': '列出',
'Load earlier messages': '载入更早的消息',
'Load more': '载入更多',
'Loading models…': '正在载入模型…',
'Loading…': '读取中…',
'Low': '低',
'Medium': '中',
'Memory': '记忆',
'Memory is not enabled': '记忆功能未启用',
'Memory is recorded by the agent during sessions; you can edit or delete it here.': '记忆由 agent 在会话中记录;你可以在这里修改或删除它。',
'Minimal': '极低',
'Missing sprite sheet {0}': '缺少精灵图 {0}',
'Mobile client': '手机客户端',
'Mode': '模式',
'Model': '模型',
'Model for tidying memory': '整理记忆使用的模型',
'Mon': '周一',
'Mondays at 9': '每周一 9 点',
'More': '更多',
'Name': '名称',
'Names cannot contain slashes': '名称里不能有斜杠',
'Network error: {0}': '网络错误:{0}',
'Network unreachable': '网络不可达',
'Never run': '从未运行',
'New': '新建',
'New chat': '新建聊天',
'New extension': '新建扩展',
'New file': '新建文件',
'New folder': '新建文件夹',
'New note': '新建笔记',
'New plan': '新建计划',
'New scheduled task': '新建计划任务',
'New session': '新会话',
'New session in this project': '在此项目新会话',
'New task': '新建任务',
'New terminal': '新建终端',
'New todo': '新建待办',
'Next: {0}': '下次:{0}',
'No archived sessions': '没有已归档的会话',
'No camera available': '没有可用的相机',
'No camera frames received; close and try again': '没有收到相机画面,请关闭后重试',
'No commands available': '没有可用的指令',
'No content': '无内容',
'no date': '未选日期',
'no days': '未选',
'No matching files': '没有匹配的文件',
'No matching files in subdirectories': '子目录里没有匹配的文件',
'No matching memories': '没有匹配的记忆',
'No matching notes': '没有匹配的笔记',
'No matching plans': '没有匹配的计划',
'No matching sessions': '没有匹配的会话',
'No matching todos': '没有匹配的待办',
'No memories yet': '还没有记忆',
'No notes yet': '还没有笔记',
'No output': '无输出',
'No pet imported': '尚未导入宠物',
'No pet is included; pet packs stay on this device.': '默认不提供宠物;宠物包只存放在本机。',
'No plans yet': '还没有计划',
'No projects available': '没有可用的项目',
'No QR code yet; move closer or fill the frame with the code': '还没识别到二维码,试着靠近一点或让二维码占满取景框',
'No results': '没有结果',
'No scheduled tasks yet.': '暂无计划任务。',
'No sessions': '暂无会话',
'No todos yet': '还没有待办',
'None': '无',
'Not a valid zip file': '不是有效的 zip 文件',
'Not available': '未获取到',
'Not connected': '未连接',
'Not connected to a server': '未连接服务器',
'Not selected': '未选择',
'Not sent': '未发送',
'Not started': '未启动',
'Not tied to a project, saved in OpenChamber\'s chat directory': '不关联项目,保存在 OpenChamber 的聊天目录',
'Notes': '笔记',
'Nothing to copy': '没有可复制的文字',
'Notifications': '通知',
'Once': '一次性',
'Once a day, when no session is running, the agent tidies memory in the background: merging duplicates and removing entries that are obsolete or already in the project docs.': '每天一次,在没有会话运行时,智能体会在后台整理记忆:合并重复条目,删除已过时或项目文档中已有的内容。',
'Once {0} {1}': '一次性 {0} {1}',
'Open the session list': '打开会话列表',
'Open-source licenses': '开源许可',
'OpenCode could not send the message: {0}': 'OpenCode 发送消息失败:{0}',
'OpenCode could not send the message; retrying: {0}': 'OpenCode 发送消息失败,正在重试:{0}',
'Other': '其它',
'Other…': '其他…',
'Output copied': '已复制输出',
'pack.json is missing animations or states': 'pack.json 缺少动画或状态',
'pack.json is not a valid pet pack': 'pack.json 不是有效的宠物包',
'Pair and connect': '配对并连接',
'Pairing expired, please pair again': '配对已失效,请重新配对',
'Pairing failed': '配对失败',
'Pairing link': '配对链接',
'Pairing link is invalid or expired': '配对链接无效或已过期',
'Password': '需要密码',
'Password (if required)': '密码(如果需要)',
'Password or saved credentials required': '需要密码或已保存的凭据',
'Paste': '粘贴',
'Patch': '补丁',
'Paused': '已暂停',
'Paused tasks don\'t run on schedule but can still be run manually.': '暂停的任务不会按计划运行,但可以手动运行。',
'Permission': '权限',
'Permission requested: {0}': '请求权限: {0}',
'Personal': '个人',
'Pet': '宠物',
'Pet pack cannot exceed 40 MB': '宠物包不能超过 40MB',
'Pin': '置顶',
'Pinned': '已置顶',
'Plan body (Markdown)': '计划正文(Markdown)',
'Plan first without changing files': '先规划,不改动文件',
'Plan, build, or ask': '规划、构建或提问',
'Plans': '计划',
'Preference': '偏好',
'Preview': '预览',
'Project knowledge': '项目知识',
'Project memory': '项目记忆',
'Prompt': '提示词',
'Prompt can\'t exceed 20,000 characters': '提示词不能超过 20000 个字符',
'Prompt is required': '提示词为必填项',
'Proxy (optional)': '代理(可选)',
'Put the pairing QR code inside the frame': '把配对二维码放进框内',
'Queue': '排队',
'Queue instead': '改为排队',
'Queue: sends after the current turn ends.': '排队:等当前回合结束后再发送。',
'Queued': '已排队',
'Queued; sends after this turn': '已排队,本轮结束后发送',
'Read': '读取',
'Reading output…': '读取输出…',
'Received a plaintext frame after the handshake': '握手后收到明文帧',
'Recent': '最近',
'Reference': '参考',
'Refresh': '刷新',
'Relay connection closed': 'Relay 连接已关闭',
'Relay connection closed ({0} {1})': 'Relay 连接已关闭({0} {1})',
'Relay connection error: {0}': 'Relay 连接出错:{0}',
'Relay handshake timed out': 'Relay 握手超时',
'Relay server': 'Relay 服务器',
'Remember facts about you and each project across sessions.': '跨会话记住关于你和每个项目的事实。',
'Remove': '移除',
'Remove from favorites': '取消收藏',
'Remove pet?': '移除宠物?',
'Remove time': '移除时间',
'Rename': '重命名',
'Replying': '正在回复',
'Required: {0}': '请填写:{0}',
'Reserved output': '输出预留',
'Reserved output assumes at most 32K tokens, matching the official client.': '输出预留按最多 32K tokens 计算,与官方客户端一致。',
'Restart': '重新启动',
'Retry': '重试',
'Review': '审查',
'Run': '运行',
'Run now': '立即运行',
'Running': '运行中',
'Running {0} commands': '正在执行 {0} 条命令',
'Running · {0} tool calls': '执行中 · {0} 次工具调用',
'Runs in': '运行位置',
'Runs in: {0}': '运行位置:{0}',
'Sat': '周六',
'Save': '保存',
'Saved': '已保存',
'Saving…': '保存中…',
'Scan QR code': '扫码',
'Schedule type': '计划类型',
'Scheduled task deleted': '计划任务已删除',
'Scheduled task saved': '计划任务已保存',
'Scheduled tasks': '计划任务',
'Search': '搜索',
'Search notes, todos, and plans': '搜索笔记、待办与计划',
'Search notes, todos, plans, and memory': '搜索笔记、待办、计划与记忆',
'Search sessions': '搜索会话',
'Search subdirectories': '搜索子目录',
'Search this directory…': '搜索当前目录…',
'Searching subdirectories… ({0})': '正在搜索子目录…({0})',
'Secrets': '密钥',
'Select a model, or switch back to the default model': '请选择模型,或改回使用默认模型',
'Select a pet pack (.zip)': '选择宠物包(.zip)',
'Select at least one weekday': '请至少选择一个星期',
'Select model': '选择模型',
'Self-signed certificate fingerprint (optional)': '自签证书指纹(可选)',
'Send': '发送',
'Send a message…': '发消息…',
'Send after this turn ends': '等本轮结束后发送',
'Send prompts to sessions on a schedule': '按时间向会话发送提示词',
'Sends to an existing session': '发送到现有会话',
'Server': '服务端',
'Server address': '服务器地址',
'Server did not provide a chat directory': '服务器没有提供聊天目录',
'Server did not return a device token': '服务器没有返回设备令牌',
'Server password; leave empty if the server has none': '服务器密码;服务器未设置可留空',
'Servers': '服务器',
'Session ID copied': '已复制会话 ID',
'Sessions': '会话',
'Settings': '设置',
'System': '跟随系统',
'SHA-256 hex': 'SHA-256 十六进制',
'Shared': '团队共享',
'Show archived': '显示已归档',
'Show archived ({0})': '显示已归档 ({0})',
'Show details': '显示详情',
'Show git-ignored files': '显示被 git 忽略的文件',
'Show summary': '显示摘要',
'Showing the first {0} of {1} lines': '仅显示前 {0} 行,共 {1} 行',
'Signed in but no token was returned': '登录成功但没有返回令牌',
'Size': '大小',
'Skill': '技能',
'Skipped': '已跳过',
'Small': '小',
'Stands above the input box; off by default': '站在输入框上方,默认关闭',
'Steer': '转向',
'Steer instead': '转为转向',
'Steer into this turn': '转向当前回合',
'Steer: joins the current turn at the next step and work continues.': '转向:在下一步加入当前回合,工作继续。',
'Stop': '停止',
'Stop this task?': '停止这个任务?',
'Stopping…': '停止中…',
'Subagent': '子代理',
'Subagent · {0}': '子代理 · {0}',
'Subdirectory results': '子目录结果',
'Success': '成功',
'Summarize unfinished tasks and suggest next steps': '总结未完成任务并给出下一步建议',
'Sun': '周日',
'Switch terminal': '切换终端',
'Task': '任务',
'Task is already waiting in the queue': '任务已在队列中等待',
'Task name': '任务名称',
'Task name can\'t exceed 80 characters': '任务名称不能超过 80 个字符',
'Task name is required': '任务名称为必填项',
'Task started': '任务已启动',
'Terminal': '终端',
'Terminal 1': '终端 1',
'Terminal connection failed': '终端连接失败',
'Terminal {0}': '终端 {0}',
'The agent notifies you when work finishes or gets stuck.': '工作完成或卡住时,智能体会通知你。',
'The archive has no pack.json': '压缩包里没有 pack.json',
'The model failed to authenticate. Sign in again on the server or check the API key.': '模型的认证失败,请在服务端重新登录或检查 API Key。',
'The pet pack stored on this device will be deleted.': '本机保存的宠物包会被删除。',
'The server doesn\'t support scheduled tasks': '服务器不支持计划任务',
'The theme is stored on this device only and does not sync with the server.': '主题只保存在本机,不随服务器同步。',
'The UI text switches together with the system\'s date and time pickers.': '界面文字与系统自带的日期、时间选择器会一起切换。',
'Theme': '主题',
'Theme mode': '主题模式',
'Theme mode and color': '主题模式与主题色',
'Thinking': '思考',
'Thinking effort': '思考强度',
'Thinking…': '正在思考…',
'Third-party components bundled with this app are listed below; tap one to read its full license.': '下面列出随本应用打包的第三方组件;点开可阅读完整许可证。',
'Third-party components used by this app and their licenses': '本应用使用的第三方组件与它们的许可证',
'This camera does not support the flashlight': '这个相机不支持手电筒',
'This component has no license text.': '该组件没有附带许可证文本。',
'This directory has no commands or skills yet': '这个目录还没有注册指令或技能',
'This file cannot be previewed': '这个文件无法预览',
'This is not an OpenChamber pairing QR code': '这不是 OpenChamber 配对二维码',
'This message and everything after it will be removed from the session and cannot be recovered.': '这条消息及其之后的内容会从会话中删除,且无法恢复。',
'This session has no directory': '这个会话没有关联目录',
'This session is managed by a Lead; take it over to continue.': '此会话由 Lead 管理,接管后才能继续。',
'This turn was stopped.': '本轮已停止。',
'Thought process': '思考过程',
'Thu': '周四',
'Tidy memory': '整理记忆',
'Time': '时间',
'Time must be in HH:mm format': '时间格式必须是 HH:mm',
'Times': '时间点',
'Times follow the server\'s time zone.': '时间按服务器所在时区。',
'Title': '标题',
'Today': '今天',
'Todos': '待办',
'Tokens used': '已用 tokens',
'Tool': '工具',
'Tools for servers and agents are collected here.': '服务器与智能体的工具都收在这里。',
'Transfer interrupted': '传输被中断',
'Trust self-signed certificates': '信任自签名证书',
'Tue': '周二',
'Turn cost': '本轮费用',
'Turn off to pin the model and agent this run uses.': '关闭后可固定这次运行使用的模型和智能体。',
'Unarchive': '取消归档',
'Unknown': '未知',
'Unknown error': '未知错误',
'Unpin': '取消置顶',
'Unsupported data URL': '不支持的 data URL',
'Unsupported proxy protocol: {0} (supported: http, https, socks5, socks5h)': '不支持的代理协议:{0}(支持 http、https、socks5、socks5h)',
'Untitled project': '未命名项目',
'Up one level': '上一级',
'Usage': '占用',
'Usage limits': '用量限额',
'Use AI to compact the session history and reduce context size': '使用 AI 压缩会话历史以减少上下文大小',
'Use default model and agent': '使用默认模型与智能体',
'Version': '版本',
'Version comes from the currently connected server': '版本取自当前连接的服务器',
'Version, server and open-source licenses': '版本、服务端与开源许可',
'Via Relay · {0}': '经由 Relay · {0}',
'Via {0}': '经由 {0}',
'View all': '查看全部',
'Waiting for output…': '等待输出…',
'WebSocket substream interrupted': 'WebSocket 子流被中断',
'Wed': '周三',
'Weekdays': '星期',
'Weekly': '每周',
'Weekly {0} {1}': '每周 {0} {1}',
'What are we building today?': '我们今天要做什么?',
'What happens by default when you press send while a run is in progress. Synced with the web client\'s setting.': '运行中按发送时,消息默认怎么处理。与网页端设置同步。',
'What needs doing': '要做什么',
'What the agent knows': '智能体知道的内容',
'Withdraw': '撤回',
'Withdraw message?': '撤回消息?',
'Withdraw this and later messages': '撤回此消息及之后',
'Write': '写入',
'Write something for later sessions to read': '记点什么,供之后的会话参考',
'Wrong password, try again': '密码错误,请重试',
'Yesterday': '昨天',
'You stopped this command.': '用户停止了这条命令。',
'Your provider has no image models': '你的提供商中没有图像模型',
'{0}\nvia {1}': '{0}\n经由 {1}',
'{0} ({1})': '{0}({1})',
'{0} / {1} ({2}%)': '{0} / {1}({2}%)',
'{0} ago': '{0}前',
'{0} context': '{0} 上下文',
'{0} days': '{0} 天',
'{0} days {1} hr': '{0} 天 {1} 小时',
'{0} hr': '{0} 小时',
'{0} hr {1} min': '{0} 小时 {1} 分钟',
'{0} in progress': '正在{0}',
'{0} min ago': '{0} 分钟前',
'{0} notes': '{0} 条笔记',
'{0} plans': '{0} 份计划',
'{0} subagents': '{0} 个子代理',
'{0} · {1} frames scanned / {2} decode attempts': '{0} · 已扫描 {1} 帧 / 解码 {2} 次',
'{0}/{1} done': '{0}/{1} 已完成',
'{0}m{1}s': '{0}分{1}秒',
'{0}s': '{0}秒',
'“{0}” and its schedule will be deleted.': '“{0}”及其计划会被删除。',
'“{0}” and its subagent sessions will be deleted permanently.': '“{0}”及其子会话将被删除,且无法恢复。',
'“{0}” will be removed from the list, and its device token will be deleted.': '“{0}”将从列表移除,设备令牌也会删除。',
'📎 {0} attachments': '📎 {0} 个附件',
};
+8 -8
View File
@@ -94,15 +94,15 @@ String formatTokenCount(int tokens) {
/// The Chinese label for an effort variant; unknown ids keep their own name. /// The Chinese label for an effort variant; unknown ids keep their own name.
String effortLabel(String? variant) { String effortLabel(String? variant) {
if (variant == null || variant.isEmpty) return tr('默认'); if (variant == null || variant.isEmpty) return tr('Default');
return switch (variant.toLowerCase()) { return switch (variant.toLowerCase()) {
'default' => tr('默认'), 'default' => tr('Default'),
'none' => tr('无'), 'none' => tr('None'),
'minimal' => tr('极低'), 'minimal' => tr('Minimal'),
'low' => tr('低'), 'low' => tr('Low'),
'medium' || 'mid' => tr('中'), 'medium' || 'mid' => tr('Medium'),
'high' => tr('高'), 'high' => tr('High'),
'xhigh' || 'max' => tr('极高'), 'xhigh' || 'max' => tr('Extra high'),
_ => variant, _ => variant,
}; };
} }
+9 -9
View File
@@ -111,16 +111,16 @@ class PetLibrary extends ChangeNotifier {
/// Unpacks and activates a pet package. [root] is for tests; the app uses /// Unpacks and activates a pet package. [root] is for tests; the app uses
/// the documents directory. /// the documents directory.
Future<PetPack> importZip(List<int> bytes, {Directory? root}) async { Future<PetPack> importZip(List<int> bytes, {Directory? root}) async {
if (bytes.isEmpty) throw PetImportException(tr('文件为空')); if (bytes.isEmpty) throw PetImportException(tr('File is empty'));
if (bytes.length > 40 * 1024 * 1024) { if (bytes.length > 40 * 1024 * 1024) {
throw PetImportException(tr('宠物包不能超过 40MB')); throw PetImportException(tr('Pet pack cannot exceed 40 MB'));
} }
final Archive archive; final Archive archive;
try { try {
archive = ZipDecoder().decodeBytes(bytes, verify: true); archive = ZipDecoder().decodeBytes(bytes, verify: true);
} catch (_) { } catch (_) {
throw PetImportException(tr('不是有效的 zip 文件')); throw PetImportException(tr('Not a valid zip file'));
} }
ArchiveFile? manifest; ArchiveFile? manifest;
@@ -134,7 +134,7 @@ class PetLibrary extends ChangeNotifier {
} }
} }
if (manifest == null) { if (manifest == null) {
throw PetImportException(tr('压缩包里没有 pack.json')); throw PetImportException(tr('The archive has no pack.json'));
} }
final manifestName = manifest.name.replaceAll('\\', '/'); final manifestName = manifest.name.replaceAll('\\', '/');
@@ -149,10 +149,10 @@ class PetLibrary extends ChangeNotifier {
if (json is! Map<String, dynamic>) throw const FormatException(); if (json is! Map<String, dynamic>) throw const FormatException();
parsed = PetPack.fromJson(json); parsed = PetPack.fromJson(json);
} catch (_) { } catch (_) {
throw PetImportException(tr('pack.json 不是有效的宠物包')); throw PetImportException(tr('pack.json is not a valid pet pack'));
} }
if (!parsed.isValid) { if (!parsed.isValid) {
throw PetImportException(tr('pack.json 缺少动画或状态')); throw PetImportException(tr('pack.json is missing animations or states'));
} }
final id = _safeId(parsed.id.isNotEmpty ? parsed.id : parsed.name); final id = _safeId(parsed.id.isNotEmpty ? parsed.id : parsed.name);
@@ -175,7 +175,7 @@ class PetLibrary extends ChangeNotifier {
final content = _content(file); final content = _content(file);
extracted += content.length; extracted += content.length;
if (extracted > 60 * 1024 * 1024) { if (extracted > 60 * 1024 * 1024) {
throw PetImportException(tr('解压后超过 60MB')); throw PetImportException(tr('Extracted size exceeds 60 MB'));
} }
final target = File('${staging.path}/$rel'); final target = File('${staging.path}/$rel');
await target.parent.create(recursive: true); await target.parent.create(recursive: true);
@@ -184,11 +184,11 @@ class PetLibrary extends ChangeNotifier {
for (final animation in parsed.animations.values) { for (final animation in parsed.animations.values) {
if (animation.sheet.isEmpty) { if (animation.sheet.isEmpty) {
throw PetImportException(trArgs('动画 {0} 没有精灵图', [animation.name])); throw PetImportException(trArgs('Animation {0} has no sprite sheet', [animation.name]));
} }
final sheet = File('${staging.path}/${animation.sheet}'); final sheet = File('${staging.path}/${animation.sheet}');
if (!await sheet.exists()) { if (!await sheet.exists()) {
throw PetImportException(trArgs('缺少精灵图 {0}', [animation.sheet])); throw PetImportException(trArgs('Missing sprite sheet {0}', [animation.sheet]));
} }
} }
+142 -131
View File
@@ -203,7 +203,7 @@ class _ChatScreenState extends State<ChatScreen> {
/// What a finished command's output reads as: the report, or that the user /// What a finished command's output reads as: the report, or that the user
/// stopped it (the report itself is a `Shell.NotFoundError` then). /// stopped it (the report itself is a `Shell.NotFoundError` then).
String _completionText(String shellId, ShellCompletionNote completion) => String _completionText(String shellId, ShellCompletionNote completion) =>
shellWasStopped(chat.msgs, shellId) ? tr('用户停止了这条命令。') : completion.output; shellWasStopped(chat.msgs, shellId) ? tr('You stopped this command.') : completion.output;
Future<void> _stopShell(ShellTask task) async { Future<void> _stopShell(ShellTask task) async {
final shells = _shells; final shells = _shells;
@@ -213,7 +213,7 @@ class _ChatScreenState extends State<ChatScreen> {
} on ApiError catch (e) { } on ApiError catch (e) {
if (!mounted) return; if (!mounted) return;
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: AppText(trArgs('停止失败:{0}', [e.message])))); .showSnackBar(SnackBar(content: AppText(trArgs('Could not stop: {0}', [e.message]))));
} }
} }
@@ -258,8 +258,8 @@ class _ChatScreenState extends State<ChatScreen> {
Expanded( Expanded(
child: AppText( child: AppText(
operator operator
? '此会话由 Lead 管理,接管后才能继续。' ? 'This session is managed by a Lead; take it over to continue.'
: '无法向子智能体会话发送提示。', : 'Cannot send prompts to a subagent session.',
style: TextStyle( style: TextStyle(
fontSize: 12.5, color: scheme.onSurfaceVariant), fontSize: 12.5, color: scheme.onSurfaceVariant),
), ),
@@ -290,14 +290,14 @@ class _ChatScreenState extends State<ChatScreen> {
leading: parent != null leading: parent != null
? IconButton( ? IconButton(
icon: const Icon(Icons.arrow_back), icon: const Icon(Icons.arrow_back),
tooltip: tr('返回父会话'), tooltip: tr('Back to parent session'),
onPressed: () => widget.app.openChat(parent), onPressed: () => widget.app.openChat(parent),
) )
: widget.onOpenSessions == null : widget.onOpenSessions == null
? null ? null
: IconButton( : IconButton(
icon: const Icon(Icons.menu), icon: const Icon(Icons.menu),
tooltip: tr('会话'), tooltip: tr('Sessions'),
onPressed: widget.onOpenSessions, onPressed: widget.onOpenSessions,
), ),
title: Row( title: Row(
@@ -308,7 +308,7 @@ class _ChatScreenState extends State<ChatScreen> {
const SizedBox(width: 6), const SizedBox(width: 6),
], ],
Expanded( Expanded(
child: AppText(_title(), child: Text(_title(),
maxLines: 1, overflow: TextOverflow.ellipsis), maxLines: 1, overflow: TextOverflow.ellipsis),
), ),
], ],
@@ -316,7 +316,7 @@ class _ChatScreenState extends State<ChatScreen> {
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Icons.view_sidebar_outlined), icon: const Icon(Icons.view_sidebar_outlined),
tooltip: tr('文件'), tooltip: tr('Files'),
onPressed: () => showFilesPanel(context, widget.app, chat.dir), onPressed: () => showFilesPanel(context, widget.app, chat.dir),
), ),
], ],
@@ -330,10 +330,10 @@ class _ChatScreenState extends State<ChatScreen> {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: AppText(chat.error!, child: Text(chat.error!,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.onErrorContainer, fontSize: 13))), color: theme.colorScheme.onErrorContainer, fontSize: 13))),
TextButton(onPressed: chat.load, child: const AppText('重试')), TextButton(onPressed: chat.load, child: const AppText('Retry')),
], ],
), ),
), ),
@@ -372,11 +372,11 @@ class _ChatScreenState extends State<ChatScreen> {
} }
final rows = _rows(); final rows = _rows();
final olderSlot = chat.hasMore || chat.loadingOlder ? 1 : 0; final olderSlot = chat.hasMore || chat.loadingOlder ? 1 : 0;
// Long-press selects the conversation's text: the rendered Markdown used // Only the conversation itself is selectable: each message bubble, the
// to be plain text, so only the few SelectableText widgets could be // answer text, an opened tool call's details and the turn's model line.
// selected. The selection toolbar follows the UI language. // Status lines and folded tool rows stay plain, so a long-press there does
return SelectionArea( // not start a selection.
child: ListView.builder( return ListView.builder(
controller: _scroll, controller: _scroll,
reverse: true, reverse: true,
itemCount: rows.length + olderSlot, itemCount: rows.length + olderSlot,
@@ -397,11 +397,10 @@ class _ChatScreenState extends State<ChatScreen> {
return Center( return Center(
child: TextButton( child: TextButton(
onPressed: _loadOlder, onPressed: _loadOlder,
child: const AppText('载入更早的消息'), child: const AppText('Load earlier messages'),
), ),
); );
}, },
),
); );
} }
@@ -599,7 +598,7 @@ class _ChatScreenState extends State<ChatScreen> {
case 'thinking': case 'thinking':
return const Padding( return const Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
child: AppText('正在思考…', style: TextStyle(color: Colors.grey, fontSize: 13)), child: AppText('Thinking…', style: TextStyle(color: Colors.grey, fontSize: 13)),
); );
case 'text': case 'text':
return _textRow(r.msgId, r.part); return _textRow(r.msgId, r.part);
@@ -618,7 +617,7 @@ class _ChatScreenState extends State<ChatScreen> {
case 'shell': case 'shell':
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: AppText(chat.byId[r.msgId]?.text ?? '', child: Text(chat.byId[r.msgId]?.text ?? '',
style: const TextStyle(color: Colors.grey, fontSize: 13)), style: const TextStyle(color: Colors.grey, fontSize: 13)),
); );
default: default:
@@ -634,7 +633,7 @@ class _ChatScreenState extends State<ChatScreen> {
return session.title; return session.title;
} }
} }
return widget.session.title.isEmpty ? '会话' : widget.session.title; return widget.session.title.isEmpty ? 'Sessions' : widget.session.title;
} }
/// A prompt in the server's inbox: dimmer than a sent message, with the /// A prompt in the server's inbox: dimmer than a sent message, with the
@@ -663,12 +662,14 @@ class _ChatScreenState extends State<ChatScreen> {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
if (item.text.isNotEmpty) if (item.text.isNotEmpty)
AppText(item.text, SelectionArea(
child: Text(item.text,
style: TextStyle(color: scheme.onPrimary)), style: TextStyle(color: scheme.onPrimary)),
),
if (item.files.isNotEmpty) if (item.files.isNotEmpty)
Padding( Padding(
padding: const EdgeInsets.only(top: 4), padding: const EdgeInsets.only(top: 4),
child: AppText(trArgs('📎 {0} 个附件', [item.files.length]), child: AppText(trArgs('📎 {0} attachments', [item.files.length]),
style: TextStyle( style: TextStyle(
color: scheme.onPrimary, fontSize: 12.5)), color: scheme.onPrimary, fontSize: 12.5)),
), ),
@@ -686,17 +687,17 @@ class _ChatScreenState extends State<ChatScreen> {
const SizedBox(width: 3), const SizedBox(width: 3),
AppText( AppText(
!chat.running !chat.running
? '未发送' ? 'Not sent'
: steering : steering
? '正在转入当前回合…' ? 'Joining this turn…'
: '已排队,本轮结束后发送', : 'Queued; sends after this turn',
style: TextStyle(fontSize: 12, color: theme.hintColor), style: TextStyle(fontSize: 12, color: theme.hintColor),
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
TextButton( TextButton(
onPressed: () => chat.changeInboxDelivery( onPressed: () => chat.changeInboxDelivery(
item.id, steering ? 'queue' : 'steer'), item.id, steering ? 'queue' : 'steer'),
child: AppText(steering ? '改为排队' : '转为转向', child: AppText(steering ? 'Queue instead' : 'Steer instead',
style: const TextStyle(fontSize: 12.5)), style: const TextStyle(fontSize: 12.5)),
), ),
TextButton( TextButton(
@@ -708,7 +709,7 @@ class _ChatScreenState extends State<ChatScreen> {
offset: _draftCtrl.text.length); offset: _draftCtrl.text.length);
_inputFocus.requestFocus(); _inputFocus.requestFocus();
}, },
child: const AppText('撤回', child: const AppText('Withdraw',
style: TextStyle(fontSize: 12.5)), style: TextStyle(fontSize: 12.5)),
), ),
], ],
@@ -743,7 +744,10 @@ class _ChatScreenState extends State<ChatScreen> {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
if (m.text.isNotEmpty) if (m.text.isNotEmpty)
AppText(m.text, style: TextStyle(color: theme.colorScheme.onPrimary)), SelectionArea(
child: Text(m.text,
style: TextStyle(color: theme.colorScheme.onPrimary)),
),
for (final i in attachedImages) for (final i in attachedImages)
Padding( Padding(
padding: const EdgeInsets.only(top: 6), padding: const EdgeInsets.only(top: 6),
@@ -776,7 +780,7 @@ class _ChatScreenState extends State<ChatScreen> {
color: theme.colorScheme.onPrimary.withValues(alpha: 0.14), color: theme.colorScheme.onPrimary.withValues(alpha: 0.14),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
child: AppText('📎 ${f.name.isEmpty ? tr('附件') : f.name}', child: AppText('📎 ${f.name.isEmpty ? tr('Attachments') : f.name}',
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@@ -798,7 +802,7 @@ class _ChatScreenState extends State<ChatScreen> {
_userImages[key] = bytes; _userImages[key] = bytes;
} catch (_) { } catch (_) {
return const SizedBox( return const SizedBox(
width: 200, height: 60, child: Center(child: AppText('图片无法显示'))); width: 200, height: 60, child: Center(child: AppText('Cannot display image')));
} }
} }
return Image.memory(bytes, width: 200, height: 150, fit: BoxFit.cover); return Image.memory(bytes, width: 200, height: 150, fit: BoxFit.cover);
@@ -806,7 +810,7 @@ class _ChatScreenState extends State<ChatScreen> {
void _previewAttachment(FileAttachment f) { void _previewAttachment(FileAttachment f) {
_showImageDialog( _showImageDialog(
f.name.isEmpty ? '图片' : f.name, f.name.isEmpty ? 'Image' : f.name,
source: 'data:${f.mime};base64,${f.data}', source: 'data:${f.mime};base64,${f.data}',
); );
} }
@@ -823,18 +827,18 @@ class _ChatScreenState extends State<ChatScreen> {
if (stamp.isNotEmpty) if (stamp.isNotEmpty)
Padding( Padding(
padding: const EdgeInsets.only(right: 8), padding: const EdgeInsets.only(right: 8),
child: AppText(stamp, style: const TextStyle(color: Colors.grey, fontSize: 12)), child: Text(stamp, style: const TextStyle(color: Colors.grey, fontSize: 12)),
), ),
TextButton( TextButton(
onPressed: () => _copyText(m.text), onPressed: () => _copyText(m.text),
child: const AppText('复制'), child: const AppText('Copy'),
), ),
PopupMenuButton<String>( PopupMenuButton<String>(
onSelected: (v) => _userAction(v, m), onSelected: (v) => _userAction(v, m),
itemBuilder: (_) => const [ itemBuilder: (_) => const [
PopupMenuItem(value: 'copy', child: AppText('复制消息')), PopupMenuItem(value: 'copy', child: AppText('Copy message')),
PopupMenuItem(value: 'revert', child: AppText('撤回此消息及之后')), PopupMenuItem(value: 'revert', child: AppText('Withdraw this and later messages')),
PopupMenuItem(value: 'fork', child: AppText('从这里分叉')), PopupMenuItem(value: 'fork', child: AppText('Fork from here')),
], ],
), ),
], ],
@@ -848,9 +852,9 @@ class _ChatScreenState extends State<ChatScreen> {
break; break;
case 'revert': case 'revert':
_confirm( _confirm(
title: '撤回消息?', title: 'Withdraw message?',
message: '这条消息及其之后的内容会从会话中删除,且无法恢复。', message: 'This message and everything after it will be removed from the session and cannot be recovered.',
confirm: '撤回', confirm: 'Withdraw',
onConfirm: () => chat.revert(m.id), onConfirm: () => chat.revert(m.id),
); );
break; break;
@@ -865,7 +869,7 @@ class _ChatScreenState extends State<ChatScreen> {
if (part < 0 || part >= m.content.length) return const SizedBox.shrink(); if (part < 0 || part >= m.content.length) return const SizedBox.shrink();
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
child: MarkdownView(m.content[part].text), child: SelectionArea(child: MarkdownView(m.content[part].text)),
); );
} }
@@ -939,12 +943,12 @@ class _ChatScreenState extends State<ChatScreen> {
final theme = Theme.of(context); final theme = Theme.of(context);
final tools = steps.where((s) => s.part.type == 'tool').length; final tools = steps.where((s) => s.part.type == 'tool').length;
final label = tools == 0 final label = tools == 0
? (running ? '思考中…' : '思考过程') ? (running ? 'Thinking…' : 'Thought process')
: failed : failed
? trArgs('有步骤失败 · {0} 次工具调用', [tools]) ? trArgs('A step failed · {0} tool calls', [tools])
: running : running
? trArgs('执行中 · {0} 次工具调用', [tools]) ? trArgs('Running · {0} tool calls', [tools])
: trArgs('已完成 · {0} 次工具调用', [tools]); : trArgs('Done · {0} tool calls', [tools]);
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () => _toggleGroup(id, start, collapsed), onTap: () => _toggleGroup(id, start, collapsed),
@@ -963,7 +967,7 @@ class _ChatScreenState extends State<ChatScreen> {
color: failed ? theme.colorScheme.error : theme.hintColor), color: failed ? theme.colorScheme.error : theme.hintColor),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded( Expanded(
child: AppText(label, child: Text(label,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 13, color: theme.hintColor)), style: TextStyle(fontSize: 13, color: theme.hintColor)),
@@ -1054,7 +1058,7 @@ class _ChatScreenState extends State<ChatScreen> {
: theme.colorScheme.onSurfaceVariant), : theme.colorScheme.onSurfaceVariant),
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
AppText(label, Text(label,
style: TextStyle( style: TextStyle(
fontSize: 13.5, color: theme.colorScheme.onSurface)), fontSize: 13.5, color: theme.colorScheme.onSurface)),
if (summary.isEmpty) if (summary.isEmpty)
@@ -1064,7 +1068,7 @@ class _ChatScreenState extends State<ChatScreen> {
AppText('·', style: TextStyle(fontSize: 13, color: theme.hintColor)), AppText('·', style: TextStyle(fontSize: 13, color: theme.hintColor)),
const SizedBox(width: 6), const SizedBox(width: 6),
Expanded( Expanded(
child: AppText(summary, child: Text(summary,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@@ -1093,7 +1097,7 @@ class _ChatScreenState extends State<ChatScreen> {
.withValues(alpha: 0.12), .withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
child: AppText('后台', child: AppText('Background',
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 11,
color: theme.colorScheme.primary)), color: theme.colorScheme.primary)),
@@ -1122,7 +1126,7 @@ class _ChatScreenState extends State<ChatScreen> {
const AppText('🖼', style: TextStyle(fontSize: 12)), const AppText('🖼', style: TextStyle(fontSize: 12)),
const SizedBox(width: 6), const SizedBox(width: 6),
Flexible( Flexible(
child: AppText(ref.label, child: Text(ref.label,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@@ -1136,7 +1140,12 @@ class _ChatScreenState extends State<ChatScreen> {
_Reveal( _Reveal(
open: open, open: open,
onGrow: _grow, onGrow: _grow,
child: _stepDetails(p, reasoning, diffFiles, shellId, m.created), // An opened call shows its command, arguments and output; those
// are conversation text like the answer is.
child: SelectionArea(
child:
_stepDetails(p, reasoning, diffFiles, shellId, m.created),
),
), ),
], ],
), ),
@@ -1181,7 +1190,7 @@ class _ChatScreenState extends State<ChatScreen> {
final ok = await widget.app.openSubagent(id); final ok = await widget.app.openSubagent(id);
if (ok || !mounted) return; if (ok || !mounted) return;
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: AppText(widget.app.lastError ?? '无法打开子代理会话')), SnackBar(content: AppText(widget.app.lastError ?? 'Cannot open the subagent session')),
); );
widget.app.clearLastError(); widget.app.clearLastError();
} }
@@ -1294,23 +1303,23 @@ class _ChatScreenState extends State<ChatScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (command.isNotEmpty) if (command.isNotEmpty)
SelectableText(command, Text(command,
style: mono.copyWith(color: theme.colorScheme.onSurface)), style: mono.copyWith(color: theme.colorScheme.onSurface)),
if (command.isNotEmpty) const SizedBox(height: 6), if (command.isNotEmpty) const SizedBox(height: 6),
for (final e in extras) for (final e in extras)
Padding( Padding(
padding: const EdgeInsets.only(bottom: 2), padding: const EdgeInsets.only(bottom: 2),
child: AppText('${e.key}: ${e.value}', child: Text('${e.key}: ${e.value}',
style: mono.copyWith( style: mono.copyWith(
fontSize: 11.5, color: theme.hintColor)), fontSize: 11.5, color: theme.hintColor)),
), ),
if (extras.isNotEmpty) const SizedBox(height: 4), if (extras.isNotEmpty) const SizedBox(height: 4),
SelectableText( Text(
output.isNotEmpty output.isNotEmpty
? output ? output
: shelled : shelled
? tr('输出较大,正在载入…') ? tr('Large output, loading…')
: (shell ? tr('无输出') : tr('无内容')), : (shell ? tr('No output') : tr('No content')),
style: mono.copyWith( style: mono.copyWith(
color: p.state?.error != null color: p.state?.error != null
? theme.colorScheme.error ? theme.colorScheme.error
@@ -1405,41 +1414,41 @@ class _ChatScreenState extends State<ChatScreen> {
} }
static String _stepLabel(ContentPart p) { static String _stepLabel(ContentPart p) {
if (p.type == 'reasoning') return tr('思考'); if (p.type == 'reasoning') return tr('Thinking');
switch (p.name ?? '') { switch (p.name ?? '') {
case 'bash': case 'bash':
case 'shell': case 'shell':
case 'execute': case 'execute':
return tr('运行'); return tr('Run');
case 'read': case 'read':
return tr('读取'); return tr('Read');
case 'write': case 'write':
return tr('写入'); return tr('Write');
case 'edit': case 'edit':
return tr('编辑'); return tr('Edit');
case 'patch': case 'patch':
case 'apply_patch': case 'apply_patch':
return tr('补丁'); return tr('Patch');
case 'grep': case 'grep':
case 'glob': case 'glob':
case 'find': case 'find':
return tr('搜索'); return tr('Search');
case 'list': case 'list':
return tr('列出'); return tr('List');
case 'webfetch': case 'webfetch':
case 'web_fetch': case 'web_fetch':
return tr('抓取'); return tr('Fetch');
case 'todowrite': case 'todowrite':
return tr('任务'); return tr('Task');
case 'task': case 'task':
case 'subagent': case 'subagent':
return tr('子代理'); return tr('Subagent');
case 'skill': case 'skill':
return tr('技能'); return tr('Skill');
case 'openchamber_image': case 'openchamber_image':
return tr('生成图片'); return tr('Generate image');
default: default:
return p.name == null || p.name!.isEmpty ? tr('工具') : p.name!; return p.name == null || p.name!.isEmpty ? tr('Tool') : p.name!;
} }
} }
@@ -1505,17 +1514,19 @@ class _ChatScreenState extends State<ChatScreen> {
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: AppText(parts.join(' · '), child: SelectionArea(
child: Text(parts.join(' · '),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Colors.grey, fontSize: 13)), style: const TextStyle(color: Colors.grey, fontSize: 13)),
), ),
), ),
),
PopupMenuButton<String>( PopupMenuButton<String>(
onSelected: (v) => _footerAction(v, m), onSelected: (v) => _footerAction(v, m),
itemBuilder: (_) => const [ itemBuilder: (_) => const [
PopupMenuItem(value: 'copy', child: AppText('复制回答')), PopupMenuItem(value: 'copy', child: AppText('Copy answer')),
PopupMenuItem(value: 'fork', child: AppText('从这里分叉')), PopupMenuItem(value: 'fork', child: AppText('Fork from here')),
], ],
), ),
], ],
@@ -1548,27 +1559,27 @@ class _ChatScreenState extends State<ChatScreen> {
final e = m.error; final e = m.error;
final detail = (e != null && e.message.isNotEmpty) final detail = (e != null && e.message.isNotEmpty)
? e.message ? e.message
: (e != null && e.type.isNotEmpty ? e.type : tr('未知错误')); : (e != null && e.type.isNotEmpty ? e.type : tr('Unknown error'));
final type = (e?.type ?? '').toLowerCase(); final type = (e?.type ?? '').toLowerCase();
final plain = detail.trim().toLowerCase().replaceFirst(RegExp(r'\.$'), ''); final plain = detail.trim().toLowerCase().replaceFirst(RegExp(r'\.$'), '');
if (m.type == 'compaction') { if (m.type == 'compaction') {
return (text: trArgs('压缩失败:{0}', [detail]), body: e?.body); return (text: trArgs('Compaction failed: {0}', [detail]), body: e?.body);
} }
if (type == 'sessionretry') { if (type == 'sessionretry') {
return (text: trArgs('OpenCode 发送消息失败,正在重试:{0}', [detail]), body: e?.body); return (text: trArgs('OpenCode could not send the message; retrying: {0}', [detail]), body: e?.body);
} }
if (_isAuthError(detail)) { if (_isAuthError(detail)) {
return ( return (
text: tr('模型的认证失败,请在服务端重新登录或检查 API Key。'), text: tr('The model failed to authenticate. Sign in again on the server or check the API key.'),
body: e?.body body: e?.body
); );
} }
if (type == 'messageabortederror' || if (type == 'messageabortederror' ||
plain == 'aborted' || plain == 'aborted' ||
plain == 'step interrupted') { plain == 'step interrupted') {
return (text: tr('本轮已停止。'), body: null); return (text: tr('This turn was stopped.'), body: null);
} }
return (text: trArgs('OpenCode 发送消息失败:{0}', [detail]), body: e?.body); return (text: trArgs('OpenCode could not send the message: {0}', [detail]), body: e?.body);
} }
static String _prettyBody(String raw) { static String _prettyBody(String raw) {
@@ -1589,7 +1600,7 @@ class _ChatScreenState extends State<ChatScreen> {
final running = m.status == 'running'; final running = m.status == 'running';
final summary = m.summary.trim(); final summary = m.summary.trim();
final open = chat.expanded.contains('compaction/$id'); final open = chat.expanded.contains('compaction/$id');
final label = running ? '正在压缩对话' : '对话已压缩'; final label = running ? 'Compacting conversation' : 'Conversation compacted';
final header = GestureDetector( final header = GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () => setState(() { onTap: () => setState(() {
@@ -1615,7 +1626,7 @@ class _ChatScreenState extends State<ChatScreen> {
style: TextStyle(fontSize: 13, color: theme.hintColor)), style: TextStyle(fontSize: 13, color: theme.hintColor)),
), ),
if (summary.isNotEmpty) if (summary.isNotEmpty)
AppText(open ? '隐藏摘要' : '显示摘要', AppText(open ? 'Hide summary' : 'Show summary',
style: TextStyle(fontSize: 12, color: scheme.primary)), style: TextStyle(fontSize: 12, color: scheme.primary)),
const SizedBox(width: 4), const SizedBox(width: 4),
AnimatedRotation( AnimatedRotation(
@@ -1644,7 +1655,7 @@ class _ChatScreenState extends State<ChatScreen> {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
child: summary.isEmpty child: summary.isEmpty
? AppText(running ? '正在生成摘要…' : '(摘要为空)', ? AppText(running ? 'Generating summary…' : '(No summary)',
style: TextStyle(fontSize: 13, color: theme.hintColor)) style: TextStyle(fontSize: 13, color: theme.hintColor))
: MarkdownView(summary, fontSize: 14), : MarkdownView(summary, fontSize: 14),
), ),
@@ -1702,7 +1713,7 @@ class _ChatScreenState extends State<ChatScreen> {
onPressed: () => setState(() { onPressed: () => setState(() {
open ? chat.expanded.remove(key) : chat.expanded.add(key); open ? chat.expanded.remove(key) : chat.expanded.add(key);
}), }),
child: AppText(open ? '收起详情' : '显示详情', child: AppText(open ? 'Hide details' : 'Show details',
style: const TextStyle(fontSize: 12.5)), style: const TextStyle(fontSize: 12.5)),
), ),
), ),
@@ -1739,7 +1750,7 @@ class _ChatScreenState extends State<ChatScreen> {
/// last turn, then idle. /// last turn, then idle.
String _petState() { String _petState() {
if (chat.running) { if (chat.running) {
return _activity().title == '思考中' ? 'thinking' : 'working'; return _activity().title == 'Thinking' ? 'thinking' : 'working';
} }
for (var i = chat.msgs.length - 1; i >= 0; i--) { for (var i = chat.msgs.length - 1; i >= 0; i--) {
final m = chat.msgs[i]; final m = chat.msgs[i];
@@ -1760,7 +1771,7 @@ class _ChatScreenState extends State<ChatScreen> {
final st = part.state?.status ?? ''; final st = part.state?.status ?? '';
if (part.type == 'tool' && if (part.type == 'tool' &&
(st == 'running' || st == 'streaming' || st == 'pending')) { (st == 'running' || st == 'streaming' || st == 'pending')) {
return (title: trArgs('正在{0}', [_stepLabel(part)]), detail: _stepSummary(part)); return (title: trArgs('{0} in progress', [_stepLabel(part)]), detail: _stepSummary(part));
} }
} }
if (m.completed == 0) { if (m.completed == 0) {
@@ -1769,12 +1780,12 @@ class _ChatScreenState extends State<ChatScreen> {
m.content.any((p) => p.type == 'text' && p.text.trim().isNotEmpty); m.content.any((p) => p.type == 'text' && p.text.trim().isNotEmpty);
final reasoning = m.content final reasoning = m.content
.any((p) => p.type == 'reasoning' && p.text.trim().isNotEmpty); .any((p) => p.type == 'reasoning' && p.text.trim().isNotEmpty);
if (text) return (title: '正在回复', detail: ''); if (text) return (title: 'Replying', detail: '');
if (reasoning) return (title: '思考中', detail: ''); if (reasoning) return (title: 'Thinking', detail: '');
} }
break; break;
} }
return (title: '思考中', detail: ''); return (title: 'Thinking', detail: '');
} }
/// The running turn started with the newest user message. /// The running turn started with the newest user message.
@@ -1882,7 +1893,7 @@ class _ChatScreenState extends State<ChatScreen> {
if (start <= 0) return ''; if (start <= 0) return '';
final secs = ((m.completed - start) / 1000).round(); final secs = ((m.completed - start) / 1000).round();
if (secs <= 0) return ''; if (secs <= 0) return '';
if (secs < 60) return trArgs('{0} 秒', [secs]); if (secs < 60) return trArgs('{0}s', [secs]);
return '${secs ~/ 60}:${(secs % 60).toString().padLeft(2, '0')}'; return '${secs ~/ 60}:${(secs % 60).toString().padLeft(2, '0')}';
} }
@@ -1899,12 +1910,12 @@ class _ChatScreenState extends State<ChatScreen> {
Future<void> _copyText(String text) async { Future<void> _copyText(String text) async {
if (text.trim().isEmpty) { if (text.trim().isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: AppText('没有可复制的文字'))); ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: AppText('Nothing to copy')));
return; return;
} }
await Clipboard.setData(ClipboardData(text: text)); await Clipboard.setData(ClipboardData(text: text));
if (mounted) { if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: AppText('已复制'))); ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: AppText('Copied')));
} }
} }
@@ -2002,7 +2013,7 @@ class _ChatScreenState extends State<ChatScreen> {
ComposerBox( ComposerBox(
controller: _draftCtrl, controller: _draftCtrl,
focusNode: _inputFocus, focusNode: _inputFocus,
hint: chat.running ? tr('生成中,仍可输入…') : tr('发消息…'), hint: chat.running ? tr('Generating; you can still type…') : tr('Send a message…'),
maxLines: 5, maxLines: 5,
keyboardInset: keyboardInset, keyboardInset: keyboardInset,
// While the palette is up, the keyboard's action key picks the // While the palette is up, the keyboard's action key picks the
@@ -2039,7 +2050,7 @@ class _ChatScreenState extends State<ChatScreen> {
}, },
leading: _roundKey( leading: _roundKey(
icon: Icons.attach_file, icon: Icons.attach_file,
label: tr('添加附件'), label: tr('Add attachment'),
onTap: _pickFiles, onTap: _pickFiles,
busy: _attaching, busy: _attaching,
), ),
@@ -2080,7 +2091,7 @@ class _ChatScreenState extends State<ChatScreen> {
// something to send the key sends again, as dsh-Go's does. // something to send the key sends again, as dsh-Go's does.
trailing: _roundKey( trailing: _roundKey(
icon: showStop ? Icons.stop_rounded : Icons.arrow_upward_rounded, icon: showStop ? Icons.stop_rounded : Icons.arrow_upward_rounded,
label: showStop ? tr('停止') : tr('发送'), label: showStop ? tr('Stop') : tr('Send'),
filled: true, filled: true,
enabled: showStop || canSend, enabled: showStop || canSend,
onTap: showStop ? chat.stop : _send, onTap: showStop ? chat.stop : _send,
@@ -2188,13 +2199,13 @@ class _ChatScreenState extends State<ChatScreen> {
children: [ children: [
const Padding( const Padding(
padding: EdgeInsets.fromLTRB(20, 4, 20, 8), padding: EdgeInsets.fromLTRB(20, 4, 20, 8),
child: AppText('发送方式', child: AppText('Delivery',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700)), style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700)),
), ),
ListTile( ListTile(
leading: const Icon(Icons.alt_route), leading: const Icon(Icons.alt_route),
title: const AppText('转向当前回合'), title: const AppText('Steer into this turn'),
subtitle: const AppText('在下一步加入,工作继续'), subtitle: const AppText('Join at the next step; work continues'),
trailing: fallback == 'steer' trailing: fallback == 'steer'
? Icon(Icons.check, size: 20, color: scheme.primary) ? Icon(Icons.check, size: 20, color: scheme.primary)
: null, : null,
@@ -2202,8 +2213,8 @@ class _ChatScreenState extends State<ChatScreen> {
), ),
ListTile( ListTile(
leading: const Icon(Icons.schedule), leading: const Icon(Icons.schedule),
title: const AppText('排队'), title: const AppText('Queue'),
subtitle: const AppText('等本轮结束后发送'), subtitle: const AppText('Send after this turn ends'),
trailing: fallback == 'queue' trailing: fallback == 'queue'
? Icon(Icons.check, size: 20, color: scheme.primary) ? Icon(Icons.check, size: 20, color: scheme.primary)
: null, : null,
@@ -2263,7 +2274,7 @@ class _ChatScreenState extends State<ChatScreen> {
} catch (e) { } catch (e) {
if (mounted) { if (mounted) {
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: AppText(trArgs('选择失败:{0}', ['$e'])))); .showSnackBar(SnackBar(content: AppText(trArgs('Could not attach: {0}', ['$e']))));
} }
} finally { } finally {
if (mounted) setState(() => _attaching = false); if (mounted) setState(() => _attaching = false);
@@ -2296,22 +2307,22 @@ class _ChatScreenState extends State<ChatScreen> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText(trArgs('请求权限: {0}', [p.action]), AppText(trArgs('Permission requested: {0}', [p.action]),
style: const TextStyle(fontWeight: FontWeight.w600)), style: const TextStyle(fontWeight: FontWeight.w600)),
AppText(p.resources.join(tr('、')), Text(p.resources.join(', '),
style: const TextStyle(color: Colors.grey, fontSize: 13)), style: const TextStyle(color: Colors.grey, fontSize: 13)),
const SizedBox(height: 6), const SizedBox(height: 6),
Row( Row(
children: [ children: [
TextButton( TextButton(
onPressed: () => chat.replyPermission(p.id, 'once'), onPressed: () => chat.replyPermission(p.id, 'once'),
child: const AppText('允许一次')), child: const AppText('Allow once')),
TextButton( TextButton(
onPressed: () => chat.replyPermission(p.id, 'always'), onPressed: () => chat.replyPermission(p.id, 'always'),
child: const AppText('总是允许')), child: const AppText('Always allow')),
TextButton( TextButton(
onPressed: () => chat.replyPermission(p.id, 'reject'), onPressed: () => chat.replyPermission(p.id, 'reject'),
child: const AppText('拒绝')), child: const AppText('Deny')),
], ],
), ),
], ],
@@ -2331,7 +2342,7 @@ class _ChatScreenState extends State<ChatScreen> {
title: AppText(title), title: AppText(title),
content: AppText(message), content: AppText(message),
actions: [ actions: [
TextButton(onPressed: () => Navigator.pop(context), child: const AppText('取消')), TextButton(onPressed: () => Navigator.pop(context), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
@@ -2373,18 +2384,18 @@ class _ChatScreenState extends State<ChatScreen> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const AppText('上下文占用', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)), const AppText('Context usage', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
const SizedBox(height: 12), const SizedBox(height: 12),
_usageRow('模型', widget.app.modelName(chat.selectedModel ?? _lastModel())), _usageRow('Model', widget.app.modelName(chat.selectedModel ?? _lastModel())),
_usageRow('已用 tokens', _fmtTokens(r.$1)), _usageRow('Tokens used', _fmtTokens(r.$1)),
if (r.$5) ...[ if (r.$5) ...[
_usageRow('上下文上限', _fmtTokens(r.$2)), _usageRow('Context limit', _fmtTokens(r.$2)),
_usageRow('输出预留', _fmtTokens(r.$3)), _usageRow('Reserved output', _fmtTokens(r.$3)),
_usageRow('占用', '${r.$4.toStringAsFixed(1)}%'), _usageRow('Usage', '${r.$4.toStringAsFixed(1)}%'),
], ],
if (chat.turnCost > 0) _usageRow('本轮费用', '\$${chat.turnCost.toStringAsFixed(4)}'), if (chat.turnCost > 0) _usageRow('Turn cost', '\$${chat.turnCost.toStringAsFixed(4)}'),
const SizedBox(height: 8), const SizedBox(height: 8),
const AppText('输出预留按最多 32K tokens 计算,与官方客户端一致。', const AppText('Reserved output assumes at most 32K tokens, matching the official client.',
style: TextStyle(color: Colors.grey, fontSize: 12)), style: TextStyle(color: Colors.grey, fontSize: 12)),
], ],
), ),
@@ -2404,7 +2415,7 @@ class _ChatScreenState extends State<ChatScreen> {
child: Row( child: Row(
children: [ children: [
Expanded(child: AppText(label, style: const TextStyle(color: Colors.grey))), Expanded(child: AppText(label, style: const TextStyle(color: Colors.grey))),
AppText(value), Text(value),
], ],
), ),
); );
@@ -2560,7 +2571,7 @@ List<_ImageRef> toolImages(ContentPart p, String dir) {
} }
if (labels.contains(label)) return; if (labels.contains(label)) return;
} }
if (label.isEmpty) label = '图片'; if (label.isEmpty) label = 'Image';
seen.add(source); seen.add(source);
labels.add(label); labels.add(label);
out.add(_ImageRef(source, label)); out.add(_ImageRef(source, label));
@@ -2615,9 +2626,9 @@ Future<Uint8List> _imageBytesFor(
Client client, String source, String directory) async { Client client, String source, String directory) async {
if (source.startsWith('data:')) { if (source.startsWith('data:')) {
final comma = source.indexOf(','); final comma = source.indexOf(',');
if (comma < 0) throw Exception(tr('无效的 data URL')); if (comma < 0) throw Exception(tr('Invalid data URL'));
final meta = source.substring(5, comma); final meta = source.substring(5, comma);
if (!meta.contains('base64')) throw Exception(tr('不支持的 data URL')); if (!meta.contains('base64')) throw Exception(tr('Unsupported data URL'));
return base64Decode(source.substring(comma + 1)); return base64Decode(source.substring(comma + 1));
} }
final cached = _imageBytes[source]; final cached = _imageBytes[source];
@@ -2685,7 +2696,7 @@ class _GeneratedImageState extends State<_GeneratedImage> {
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded( Expanded(
child: AppText( child: AppText(
trArgs('图片加载失败:{0}', [pathLeaf(widget.source)]), trArgs('Could not load image: {0}', [pathLeaf(widget.source)]),
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 12, color: theme.hintColor), style: TextStyle(fontSize: 12, color: theme.hintColor),
@@ -2798,7 +2809,7 @@ class _ImagePreviewDialogState extends State<_ImagePreviewDialog> {
} else { } else {
body = Padding( body = Padding(
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(24),
child: SelectableText(trArgs('无法预览:{0}', ['$_error']), child: SelectableText(trArgs('Cannot preview: {0}', ['$_error']),
style: TextStyle(color: theme.colorScheme.error)), style: TextStyle(color: theme.colorScheme.error)),
); );
} }
@@ -2815,12 +2826,12 @@ class _ImagePreviewDialogState extends State<_ImagePreviewDialog> {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: AppText(widget.title, child: Text(widget.title,
maxLines: 2, overflow: TextOverflow.ellipsis), maxLines: 2, overflow: TextOverflow.ellipsis),
), ),
IconButton( IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
tooltip: tr('关闭'), tooltip: tr('Close'),
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
), ),
], ],
@@ -2923,7 +2934,7 @@ class _FormDockState extends State<_FormDock> {
if (empty) missing.add(f.label); if (empty) missing.add(f.label);
} }
if (missing.isNotEmpty) { if (missing.isNotEmpty) {
setState(() => _error = trArgs('请填写:{0}', [missing.join(tr('、'))])); setState(() => _error = trArgs('Required: {0}', [missing.join(tr(', '))]));
return; return;
} }
final answer = <String, Object?>{}; final answer = <String, Object?>{};
@@ -2966,7 +2977,7 @@ class _FormDockState extends State<_FormDock> {
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded( Expanded(
child: AppText( child: AppText(
widget.form.title.isEmpty ? '请选择' : widget.form.title, widget.form.title.isEmpty ? 'Choose one' : widget.form.title,
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontWeight: FontWeight.w600), fontSize: 14, fontWeight: FontWeight.w600),
), ),
@@ -2979,7 +2990,7 @@ class _FormDockState extends State<_FormDock> {
onPressed: _sending onPressed: _sending
? null ? null
: () => widget.chat.cancelForm(widget.form), : () => widget.chat.cancelForm(widget.form),
child: const AppText('取消', style: TextStyle(fontSize: 12.5)), child: const AppText('Cancel', style: TextStyle(fontSize: 12.5)),
), ),
], ],
), ),
@@ -3011,7 +3022,7 @@ class _FormDockState extends State<_FormDock> {
width: 16, width: 16,
height: 16, height: 16,
child: CircularProgressIndicator(strokeWidth: 2)) child: CircularProgressIndicator(strokeWidth: 2))
: const AppText('发送'), : const AppText('Send'),
), ),
], ],
), ),
@@ -3026,7 +3037,7 @@ class _FormDockState extends State<_FormDock> {
final title = Row( final title = Row(
children: [ children: [
Flexible( Flexible(
child: AppText(f.label, child: Text(f.label,
style: style:
const TextStyle(fontSize: 13, fontWeight: FontWeight.w600)), const TextStyle(fontSize: 13, fontWeight: FontWeight.w600)),
), ),
@@ -3038,7 +3049,7 @@ class _FormDockState extends State<_FormDock> {
? const SizedBox.shrink() ? const SizedBox.shrink()
: Padding( : Padding(
padding: const EdgeInsets.only(top: 2, bottom: 2), padding: const EdgeInsets.only(top: 2, bottom: 2),
child: AppText(f.description!, child: Text(f.description!,
style: TextStyle(fontSize: 12, color: theme.hintColor)), style: TextStyle(fontSize: 12, color: theme.hintColor)),
); );
switch (f.type) { switch (f.type) {
@@ -3053,7 +3064,7 @@ class _FormDockState extends State<_FormDock> {
if (f.url != null && f.url!.isNotEmpty) if (f.url != null && f.url!.isNotEmpty)
Padding( Padding(
padding: const EdgeInsets.only(top: 2), padding: const EdgeInsets.only(top: 2),
child: AppText(f.url!, child: Text(f.url!,
style: TextStyle( style: TextStyle(
fontSize: 12, color: scheme.primary), fontSize: 12, color: scheme.primary),
maxLines: 2, maxLines: 2,
@@ -3136,7 +3147,7 @@ class _FormDockState extends State<_FormDock> {
style: const TextStyle(fontSize: 13), style: const TextStyle(fontSize: 13),
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
hintText: tr('其他…'), hintText: tr('Other…'),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8)), borderRadius: BorderRadius.circular(8)),
), ),
@@ -3210,7 +3221,7 @@ class _FormDockState extends State<_FormDock> {
default: default:
return Padding( return Padding(
padding: const EdgeInsets.only(top: 8), padding: const EdgeInsets.only(top: 8),
child: AppText(trArgs('{0}({1})', [f.label, f.type]), child: AppText(trArgs('{0} ({1})', [f.label, f.type]),
style: const TextStyle(fontSize: 13)), style: const TextStyle(fontSize: 13)),
); );
} }
+4 -4
View File
@@ -14,11 +14,11 @@ class FeaturesScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar(title: const AppText('全部功能')), appBar: AppBar(title: const AppText('All features')),
body: ListView( body: ListView(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 32), padding: const EdgeInsets.fromLTRB(16, 12, 16, 32),
children: [ children: [
AppText('服务器与智能体的工具都收在这里。', AppText('Tools for servers and agents are collected here.',
style: TextStyle(fontSize: 12.5, color: theme.hintColor)), style: TextStyle(fontSize: 12.5, color: theme.hintColor)),
const SizedBox(height: 14), const SizedBox(height: 14),
GridView.count( GridView.count(
@@ -31,8 +31,8 @@ class FeaturesScreen extends StatelessWidget {
children: [ children: [
_FeatureTile( _FeatureTile(
icon: Icons.schedule, icon: Icons.schedule,
title: '计划任务', title: 'Scheduled tasks',
caption: '按时间向会话发送提示词', caption: 'Send prompts to sessions on a schedule',
onTap: () => Navigator.of(context).push(MaterialPageRoute( onTap: () => Navigator.of(context).push(MaterialPageRoute(
builder: (_) => ScheduledTasksScreen(app: app), builder: (_) => ScheduledTasksScreen(app: app),
)), )),
+49 -49
View File
@@ -21,7 +21,7 @@ Future<void> showFilesPanel(
return showGeneralDialog<void>( return showGeneralDialog<void>(
context: context, context: context,
barrierDismissible: true, barrierDismissible: true,
barrierLabel: tr('文件'), barrierLabel: tr('Files'),
barrierColor: Colors.black54, barrierColor: Colors.black54,
transitionDuration: const Duration(milliseconds: 220), transitionDuration: const Duration(milliseconds: 220),
pageBuilder: (context, _, __) { pageBuilder: (context, _, __) {
@@ -245,7 +245,7 @@ class _FilesPanelState extends State<FilesPanel> {
setState(() { setState(() {
_previewLoading = false; _previewLoading = false;
_previewError = trArgs( _previewError = trArgs(
'文件较大({0}),请下载后查看', [_fmtSize(stat.size)]); 'File is large ({0}), download it to view', [_fmtSize(stat.size)]);
}); });
return; return;
} }
@@ -285,7 +285,7 @@ class _FilesPanelState extends State<FilesPanel> {
_previewText = _editor.text; _previewText = _editor.text;
_previewBinary = false; _previewBinary = false;
}); });
_toast('已保存'); _toast('Saved');
} catch (e) { } catch (e) {
if (!mounted) return; if (!mounted) return;
setState(() => _saving = false); setState(() => _saving = false);
@@ -316,9 +316,9 @@ class _FilesPanelState extends State<FilesPanel> {
fileName: _previewName, fileName: _previewName,
bytes: bytes, bytes: bytes,
); );
if (uri != null) _toast('已保存'); if (uri != null) _toast('Saved');
} catch (e) { } catch (e) {
_toast(trArgs('保存失败:{0}', [e])); _toast(trArgs('Couldn\'t save: {0}', [e]));
} }
} }
@@ -327,7 +327,7 @@ class _FilesPanelState extends State<FilesPanel> {
Future<void> _newEntry({required bool directory}) async { Future<void> _newEntry({required bool directory}) async {
final client = _client; final client = _client;
if (client == null || _path.isEmpty) return; if (client == null || _path.isEmpty) return;
final name = await _askName(directory ? '新建文件夹' : '新建文件'); final name = await _askName(directory ? 'New folder' : 'New file');
if (name == null) return; if (name == null) return;
final target = '$_path/$name'; final target = '$_path/$name';
try { try {
@@ -356,18 +356,18 @@ class _FilesPanelState extends State<FilesPanel> {
controller: controller, controller: controller,
autofocus: true, autofocus: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: tr('名称'), labelText: tr('Name'),
hintText: title == '新建文件夹' ? tr('例如 docs') : tr('例如 notes.md'), hintText: title == 'New folder' ? tr('e.g. docs') : tr('e.g. notes.md'),
), ),
onSubmitted: (v) => Navigator.of(context).pop(v), onSubmitted: (v) => Navigator.of(context).pop(v),
), ),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: const AppText('取消')), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () => Navigator.of(context).pop(controller.text), onPressed: () => Navigator.of(context).pop(controller.text),
child: const AppText('创建')), child: const AppText('Create')),
], ],
), ),
); );
@@ -375,7 +375,7 @@ class _FilesPanelState extends State<FilesPanel> {
final trimmed = name?.trim() ?? ''; final trimmed = name?.trim() ?? '';
if (trimmed.isEmpty) return null; if (trimmed.isEmpty) return null;
if (trimmed.contains('/') || trimmed.contains('\\')) { if (trimmed.contains('/') || trimmed.contains('\\')) {
_toast(tr('名称里不能有斜杠')); _toast(tr('Names cannot contain slashes'));
return null; return null;
} }
return trimmed; return trimmed;
@@ -413,7 +413,7 @@ class _FilesPanelState extends State<FilesPanel> {
/// The tab row is the panel's title now; the only global action left is /// The tab row is the panel's title now; the only global action left is
/// closing the panel. Everything else belongs to the tab's own header. /// closing the panel. Everything else belongs to the tab's own header.
Widget _tabs(ThemeData theme) { Widget _tabs(ThemeData theme) {
const labels = ['文件', '项目知识', '终端']; const labels = ['Files', 'Project knowledge', 'Terminal'];
return Padding( return Padding(
padding: const EdgeInsets.fromLTRB(12, 6, 2, 6), padding: const EdgeInsets.fromLTRB(12, 6, 2, 6),
child: Row( child: Row(
@@ -435,7 +435,7 @@ class _FilesPanelState extends State<FilesPanel> {
), ),
IconButton( IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
tooltip: tr('关闭侧栏'), tooltip: tr('Close sidebar'),
onPressed: () => Navigator.of(context).maybePop(), onPressed: () => Navigator.of(context).maybePop(),
), ),
], ],
@@ -445,7 +445,7 @@ class _FilesPanelState extends State<FilesPanel> {
Widget _body(ThemeData theme) { Widget _body(ThemeData theme) {
if (_root.isEmpty) { if (_root.isEmpty) {
return const Center(child: AppText('这个会话没有关联目录')); return const Center(child: AppText('This session has no directory'));
} }
switch (_tab) { switch (_tab) {
case 1: case 1:
@@ -487,12 +487,12 @@ class _FilesPanelState extends State<FilesPanel> {
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
prefixIcon: const Icon(Icons.search, size: 20), prefixIcon: const Icon(Icons.search, size: 20),
hintText: tr('搜索当前目录…'), hintText: tr('Search this directory…'),
suffixIcon: _query.trim().isEmpty suffixIcon: _query.trim().isEmpty
? null ? null
: IconButton( : IconButton(
icon: const Icon(Icons.travel_explore, size: 20), icon: const Icon(Icons.travel_explore, size: 20),
tooltip: tr('搜索子目录'), tooltip: tr('Search subdirectories'),
onPressed: _searching ? null : _deepSearch, onPressed: _searching ? null : _deepSearch,
), ),
border: OutlineInputBorder( border: OutlineInputBorder(
@@ -515,7 +515,7 @@ class _FilesPanelState extends State<FilesPanel> {
height: 14, height: 14,
child: CircularProgressIndicator(strokeWidth: 2)), child: CircularProgressIndicator(strokeWidth: 2)),
const SizedBox(width: 8), const SizedBox(width: 8),
AppText(trArgs('正在搜索子目录…({0})', [_deepResults.length]), AppText(trArgs('Searching subdirectories… ({0})', [_deepResults.length]),
style: TextStyle(fontSize: 12, color: theme.hintColor)), style: TextStyle(fontSize: 12, color: theme.hintColor)),
], ],
), ),
@@ -537,7 +537,7 @@ class _FilesPanelState extends State<FilesPanel> {
IconButton( IconButton(
icon: Icon(preview ? Icons.arrow_back : Icons.arrow_upward, icon: Icon(preview ? Icons.arrow_back : Icons.arrow_upward,
size: 20), size: 20),
tooltip: preview ? tr('返回') : tr('上一级'), tooltip: preview ? tr('Back') : tr('Up one level'),
onPressed: preview onPressed: preview
? () => setState(() => _previewPath = null) ? () => setState(() => _previewPath = null)
: (_path == _root ? null : _up), : (_path == _root ? null : _up),
@@ -548,12 +548,12 @@ class _FilesPanelState extends State<FilesPanel> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
AppText(_previewName, Text(_previewName,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
fontSize: 13.5, fontWeight: FontWeight.w600)), fontSize: 13.5, fontWeight: FontWeight.w600)),
AppText(_previewPath!, Text(_previewPath!,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@@ -581,7 +581,7 @@ class _FilesPanelState extends State<FilesPanel> {
icon: Icon(_editing icon: Icon(_editing
? Icons.visibility_outlined ? Icons.visibility_outlined
: Icons.edit_outlined), : Icons.edit_outlined),
tooltip: _editing ? tr('预览') : tr('编辑'), tooltip: _editing ? tr('Preview') : tr('Edit'),
onPressed: onPressed:
_saving ? null : () => setState(() => _editing = !_editing), _saving ? null : () => setState(() => _editing = !_editing),
), ),
@@ -593,27 +593,27 @@ class _FilesPanelState extends State<FilesPanel> {
height: 18, height: 18,
child: CircularProgressIndicator(strokeWidth: 2)) child: CircularProgressIndicator(strokeWidth: 2))
: const Icon(Icons.check), : const Icon(Icons.check),
tooltip: tr('保存'), tooltip: tr('Save'),
onPressed: _saving ? null : _save, onPressed: _saving ? null : _save,
), ),
IconButton( IconButton(
icon: const Icon(Icons.download_outlined), icon: const Icon(Icons.download_outlined),
tooltip: tr('下载'), tooltip: tr('Download'),
onPressed: _download, onPressed: _download,
), ),
] else if (_root.isNotEmpty) ...[ ] else if (_root.isNotEmpty) ...[
PopupMenuButton<bool>( PopupMenuButton<bool>(
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
tooltip: tr('新建'), tooltip: tr('New'),
onSelected: (directory) => _newEntry(directory: directory), onSelected: (directory) => _newEntry(directory: directory),
itemBuilder: (_) => const [ itemBuilder: (_) => const [
PopupMenuItem(value: false, child: AppText('新建文件')), PopupMenuItem(value: false, child: AppText('New file')),
PopupMenuItem(value: true, child: AppText('新建文件夹')), PopupMenuItem(value: true, child: AppText('New folder')),
], ],
), ),
PopupMenuButton<String>( PopupMenuButton<String>(
icon: const Icon(Icons.more_horiz), icon: const Icon(Icons.more_horiz),
tooltip: tr('更多'), tooltip: tr('More'),
onSelected: (value) { onSelected: (value) {
if (value == 'ignored') { if (value == 'ignored') {
setState(() => _showIgnored = !_showIgnored); setState(() => _showIgnored = !_showIgnored);
@@ -626,7 +626,7 @@ class _FilesPanelState extends State<FilesPanel> {
CheckedPopupMenuItem( CheckedPopupMenuItem(
value: 'ignored', value: 'ignored',
checked: _showIgnored, checked: _showIgnored,
child: const AppText('显示被 git 忽略的文件'), child: const AppText('Show git-ignored files'),
), ),
const PopupMenuItem( const PopupMenuItem(
value: 'refresh', value: 'refresh',
@@ -634,7 +634,7 @@ class _FilesPanelState extends State<FilesPanel> {
children: [ children: [
Icon(Icons.refresh, size: 18), Icon(Icons.refresh, size: 18),
SizedBox(width: 10), SizedBox(width: 10),
AppText('刷新'), AppText('Refresh'),
], ],
), ),
), ),
@@ -653,7 +653,7 @@ class _FilesPanelState extends State<FilesPanel> {
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4),
child: AppText( child: Text(
text, text,
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
@@ -674,9 +674,9 @@ class _FilesPanelState extends State<FilesPanel> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
AppText(_error!, textAlign: TextAlign.center), Text(_error!, textAlign: TextAlign.center),
const SizedBox(height: 8), const SizedBox(height: 8),
TextButton(onPressed: () => _load(), child: const AppText('重试')), TextButton(onPressed: () => _load(), child: const AppText('Retry')),
], ],
), ),
), ),
@@ -690,7 +690,7 @@ class _FilesPanelState extends State<FilesPanel> {
.toList(); .toList();
if (filtered.isEmpty && _deepResults.isEmpty) { if (filtered.isEmpty && _deepResults.isEmpty) {
return Center( return Center(
child: AppText(_query.trim().isEmpty ? '目录为空' : '没有匹配的文件', child: AppText(_query.trim().isEmpty ? 'Directory is empty' : 'No matching files',
style: TextStyle(color: theme.hintColor)), style: TextStyle(color: theme.hintColor)),
); );
} }
@@ -701,7 +701,7 @@ class _FilesPanelState extends State<FilesPanel> {
if (_query.trim().isNotEmpty && _deepResults.isNotEmpty) ...[ if (_query.trim().isNotEmpty && _deepResults.isNotEmpty) ...[
Padding( Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
child: AppText('子目录结果', child: AppText('Subdirectory results',
style: TextStyle(fontSize: 12, color: theme.hintColor)), style: TextStyle(fontSize: 12, color: theme.hintColor)),
), ),
for (final e in _deepResults) _tile(theme, e, showPath: true), for (final e in _deepResults) _tile(theme, e, showPath: true),
@@ -713,7 +713,7 @@ class _FilesPanelState extends State<FilesPanel> {
filtered.isNotEmpty) filtered.isNotEmpty)
Padding( Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: AppText('子目录里没有匹配的文件', child: AppText('No matching files in subdirectories',
style: TextStyle(fontSize: 12, color: theme.hintColor)), style: TextStyle(fontSize: 12, color: theme.hintColor)),
), ),
], ],
@@ -730,10 +730,10 @@ class _FilesPanelState extends State<FilesPanel> {
color: entry.isDirectory color: entry.isDirectory
? theme.colorScheme.primary ? theme.colorScheme.primary
: theme.colorScheme.onSurfaceVariant), : theme.colorScheme.onSurfaceVariant),
title: AppText(entry.name, title: Text(entry.name,
maxLines: 1, overflow: TextOverflow.ellipsis, style: const TextStyle(fontSize: 14)), maxLines: 1, overflow: TextOverflow.ellipsis, style: const TextStyle(fontSize: 14)),
subtitle: showPath subtitle: showPath
? AppText(_relative(entry.path), ? Text(_relative(entry.path),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 11, color: theme.hintColor)) style: TextStyle(fontSize: 11, color: theme.hintColor))
@@ -770,10 +770,10 @@ class _FilesPanelState extends State<FilesPanel> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
AppText(_previewError!, textAlign: TextAlign.center), Text(_previewError!, textAlign: TextAlign.center),
const SizedBox(height: 8), const SizedBox(height: 8),
if (_previewBytes != null || _previewError != null) if (_previewBytes != null || _previewError != null)
TextButton(onPressed: _download, child: const AppText('下载')), TextButton(onPressed: _download, child: const AppText('Download')),
], ],
), ),
), ),
@@ -795,16 +795,16 @@ class _FilesPanelState extends State<FilesPanel> {
Icon(Icons.insert_drive_file_outlined, Icon(Icons.insert_drive_file_outlined,
size: 40, color: theme.hintColor), size: 40, color: theme.hintColor),
const SizedBox(height: 10), const SizedBox(height: 10),
AppText('这个文件无法预览', AppText('This file cannot be previewed',
style: TextStyle(color: theme.hintColor)), style: TextStyle(color: theme.hintColor)),
const SizedBox(height: 6), const SizedBox(height: 6),
AppText(_fmtSize(_previewBytes?.length ?? 0), Text(_fmtSize(_previewBytes?.length ?? 0),
style: TextStyle(fontSize: 12, color: theme.hintColor)), style: TextStyle(fontSize: 12, color: theme.hintColor)),
const SizedBox(height: 8), const SizedBox(height: 8),
OutlinedButton.icon( OutlinedButton.icon(
onPressed: _download, onPressed: _download,
icon: const Icon(Icons.download_outlined, size: 18), icon: const Icon(Icons.download_outlined, size: 18),
label: const AppText('下载'), label: const AppText('Download'),
), ),
], ],
), ),
@@ -1002,12 +1002,12 @@ class _DownloadDialogState extends State<_DownloadDialog> {
? (_received / total).clamp(0.0, 1.0) ? (_received / total).clamp(0.0, 1.0)
: null; : null;
return AlertDialog( return AlertDialog(
title: const AppText('正在下载'), title: const AppText('Downloading'),
content: Column( content: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText(widget.name, Text(widget.name,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 13)), style: const TextStyle(fontSize: 13)),
@@ -1017,16 +1017,16 @@ class _DownloadDialogState extends State<_DownloadDialog> {
const SizedBox(height: 8), const SizedBox(height: 8),
AppText( AppText(
total != null total != null
? trArgs('{0} / {1}({2}%)', [ ? trArgs('{0} / {1} ({2}%)', [
_size(_received), _size(_received),
_size(total), _size(total),
(fraction! * 100).toStringAsFixed(0), (fraction! * 100).toStringAsFixed(0),
]) ])
: trArgs('已下载 {0}', [_size(_received)]), : trArgs('Downloaded {0}', [_size(_received)]),
style: TextStyle(fontSize: 12, color: theme.hintColor), style: TextStyle(fontSize: 12, color: theme.hintColor),
), ),
] else ] else
AppText(_error!, Text(_error!,
style: style:
TextStyle(fontSize: 12.5, color: theme.colorScheme.error)), TextStyle(fontSize: 12.5, color: theme.colorScheme.error)),
], ],
@@ -1040,12 +1040,12 @@ class _DownloadDialogState extends State<_DownloadDialog> {
setState(() => _cancelling = true); setState(() => _cancelling = true);
_cancel.cancel(); _cancel.cancel();
}, },
child: AppText(_cancelling ? '正在取消…' : '取消'), child: AppText(_cancelling ? 'Canceling…' : 'Cancel'),
) )
else else
TextButton( TextButton(
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: const AppText('关闭'), child: const AppText('Close'),
), ),
], ],
); );
+2 -2
View File
@@ -127,13 +127,13 @@ class _HomeScreenState extends State<HomeScreen> {
children: [ children: [
Icon(Icons.forum_outlined, size: 40, color: scheme.onSurfaceVariant), Icon(Icons.forum_outlined, size: 40, color: scheme.onSurfaceVariant),
const SizedBox(height: 12), const SizedBox(height: 12),
AppText('选择一个会话', AppText('Choose a session',
style: TextStyle(fontSize: 16, color: scheme.onSurfaceVariant)), style: TextStyle(fontSize: 16, color: scheme.onSurfaceVariant)),
if (!wide) ...[ if (!wide) ...[
const SizedBox(height: 12), const SizedBox(height: 12),
FilledButton( FilledButton(
onPressed: () => _scaffold.currentState?.openDrawer(), onPressed: () => _scaffold.currentState?.openDrawer(),
child: const AppText('打开会话列表'), child: const AppText('Open the session list'),
), ),
], ],
], ],
+68 -68
View File
@@ -49,7 +49,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
if (client == null || _projectId.isEmpty) { if (client == null || _projectId.isEmpty) {
setState(() { setState(() {
_loading = false; _loading = false;
_error = tr('这个会话没有关联目录'); _error = tr('This session has no directory');
}); });
return; return;
} }
@@ -91,7 +91,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
void _fail(Object error) { void _fail(Object error) {
if (!mounted) return; if (!mounted) return;
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: AppText('$error'))); .showSnackBar(SnackBar(content: Text('$error')));
} }
bool _matches(Iterable<String> fields) { bool _matches(Iterable<String> fields) {
@@ -117,8 +117,8 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
hintText: _memory == null hintText: _memory == null
? tr('搜索笔记、待办与计划') ? tr('Search notes, todos, and plans')
: tr('搜索笔记、待办、计划与记忆'), : tr('Search notes, todos, plans, and memory'),
prefixIcon: const Icon(Icons.search, size: 18), prefixIcon: const Icon(Icons.search, size: 18),
suffixIcon: _query.isEmpty suffixIcon: _query.isEmpty
? null ? null
@@ -135,7 +135,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
), ),
), ),
IconButton( IconButton(
tooltip: tr('刷新'), tooltip: tr('Refresh'),
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
icon: const Icon(Icons.refresh, size: 20), icon: const Icon(Icons.refresh, size: 20),
onPressed: _load, onPressed: _load,
@@ -152,11 +152,11 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
List<(String, String, int)> get _sectionsList { List<(String, String, int)> get _sectionsList {
final context = _context; final context = _context;
return [ return [
('notes', tr('笔记'), context?.notes.length ?? 0), ('notes', tr('Notes'), context?.notes.length ?? 0),
('todos', tr('待办'), context?.todos.length ?? 0), ('todos', tr('Todos'), context?.todos.length ?? 0),
('plans', tr('计划'), context?.plans.length ?? 0), ('plans', tr('Plans'), context?.plans.length ?? 0),
if (_memory != null) if (_memory != null)
('memory', tr('记忆'), ('memory', tr('Memory'),
(_memory!.global.length + _memory!.project.length)), (_memory!.global.length + _memory!.project.length)),
]; ];
} }
@@ -190,11 +190,11 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
AppText(_error!, Text(_error!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(color: theme.colorScheme.error, fontSize: 13)), style: TextStyle(color: theme.colorScheme.error, fontSize: 13)),
const SizedBox(height: 8), const SizedBox(height: 8),
FilledButton(onPressed: _load, child: const AppText('重试')), FilledButton(onPressed: _load, child: const AppText('Retry')),
], ],
), ),
), ),
@@ -224,12 +224,12 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
}); });
return Column( return Column(
children: [ children: [
_sectionHeader(theme, trArgs('{0} 条笔记', [notes.length]), _sectionHeader(theme, trArgs('{0} notes', [notes.length]),
'新建笔记', _addNote), 'New note', _addNote),
Expanded( Expanded(
child: notes.isEmpty child: notes.isEmpty
? _empty(theme, Icons.sticky_note_2_outlined, ? _empty(theme, Icons.sticky_note_2_outlined,
_query.isEmpty ? '还没有笔记' : '没有匹配的笔记') _query.isEmpty ? 'No notes yet' : 'No matching notes')
: ListView.builder( : ListView.builder(
padding: const EdgeInsets.fromLTRB(12, 0, 12, 12), padding: const EdgeInsets.fromLTRB(12, 0, 12, 12),
itemCount: notes.length, itemCount: notes.length,
@@ -259,7 +259,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( Text(
note.body.trim(), note.body.trim(),
maxLines: 5, maxLines: 5,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -274,7 +274,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
child: Icon(Icons.push_pin, child: Icon(Icons.push_pin,
size: 12, color: scheme.primary), size: 12, color: scheme.primary),
), ),
AppText( Text(
_stamp(note.updatedAt), _stamp(note.updatedAt),
style: style:
TextStyle(fontSize: 11, color: theme.hintColor), TextStyle(fontSize: 11, color: theme.hintColor),
@@ -309,10 +309,10 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
} }
}, },
itemBuilder: (_) => [ itemBuilder: (_) => [
const PopupMenuItem(value: 'edit', child: AppText('编辑')), const PopupMenuItem(value: 'edit', child: AppText('Edit')),
PopupMenuItem( PopupMenuItem(
value: 'pin', child: AppText(note.pinned ? '取消置顶' : '置顶')), value: 'pin', child: AppText(note.pinned ? 'Unpin' : 'Pin')),
const PopupMenuItem(value: 'delete', child: AppText('删除')), const PopupMenuItem(value: 'delete', child: AppText('Delete')),
], ],
), ),
], ],
@@ -331,12 +331,12 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
final done = todos.where((todo) => todo.completed).length; final done = todos.where((todo) => todo.completed).length;
return Column( return Column(
children: [ children: [
_sectionHeader(theme, trArgs('{0}/{1} 已完成', [done, todos.length]), _sectionHeader(theme, trArgs('{0}/{1} done', [done, todos.length]),
'新建待办', _addTodo), 'New todo', _addTodo),
Expanded( Expanded(
child: todos.isEmpty child: todos.isEmpty
? _empty(theme, Icons.checklist, ? _empty(theme, Icons.checklist,
_query.isEmpty ? '还没有待办' : '没有匹配的待办') _query.isEmpty ? 'No todos yet' : 'No matching todos')
: ListView.builder( : ListView.builder(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 12), padding: const EdgeInsets.fromLTRB(8, 0, 8, 12),
itemCount: todos.length, itemCount: todos.length,
@@ -373,7 +373,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
} }
}, },
itemBuilder: (_) => const [ itemBuilder: (_) => const [
PopupMenuItem(value: 'delete', child: AppText('删除')), PopupMenuItem(value: 'delete', child: AppText('Delete')),
], ],
), ),
); );
@@ -407,12 +407,12 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
}); });
return Column( return Column(
children: [ children: [
_sectionHeader(theme, trArgs('{0} 份计划', [plans.length]), _sectionHeader(theme, trArgs('{0} plans', [plans.length]),
'新建计划', _newPlan), 'New plan', _newPlan),
Expanded( Expanded(
child: plans.isEmpty child: plans.isEmpty
? _empty(theme, Icons.description_outlined, ? _empty(theme, Icons.description_outlined,
_query.isEmpty ? '还没有计划' : '没有匹配的计划') _query.isEmpty ? 'No plans yet' : 'No matching plans')
: ListView.builder( : ListView.builder(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 12), padding: const EdgeInsets.fromLTRB(8, 0, 8, 12),
itemCount: plans.length, itemCount: plans.length,
@@ -438,7 +438,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
child: Icon(Icons.push_pin, size: 13, color: scheme.primary), child: Icon(Icons.push_pin, size: 13, color: scheme.primary),
), ),
Expanded( Expanded(
child: AppText(plan.title.isEmpty ? plan.file : plan.title, child: Text(plan.title.isEmpty ? plan.file : plan.title,
maxLines: 2, overflow: TextOverflow.ellipsis), maxLines: 2, overflow: TextOverflow.ellipsis),
), ),
], ],
@@ -461,7 +461,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
), ),
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
AppText('${plan.progressDone}/${plan.progressTotal}', Text('${plan.progressDone}/${plan.progressTotal}',
style: style:
TextStyle(fontSize: 11, color: theme.hintColor)), TextStyle(fontSize: 11, color: theme.hintColor)),
], ],
@@ -469,7 +469,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
], ],
const SizedBox(height: 2), const SizedBox(height: 2),
AppText( AppText(
plan.source == 'shared' ? '团队共享' : '个人', plan.source == 'shared' ? 'Shared' : 'Personal',
style: TextStyle(fontSize: 11, color: theme.hintColor), style: TextStyle(fontSize: 11, color: theme.hintColor),
), ),
], ],
@@ -497,8 +497,8 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
}, },
itemBuilder: (_) => [ itemBuilder: (_) => [
PopupMenuItem( PopupMenuItem(
value: 'pin', child: AppText(plan.pinned ? '取消置顶' : '置顶')), value: 'pin', child: AppText(plan.pinned ? 'Unpin' : 'Pin')),
const PopupMenuItem(value: 'delete', child: AppText('删除')), const PopupMenuItem(value: 'delete', child: AppText('Delete')),
], ],
), ),
onTap: () => _viewPlan(plan), onTap: () => _viewPlan(plan),
@@ -511,7 +511,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
Widget _memoryBody(ThemeData theme) { Widget _memoryBody(ThemeData theme) {
final snapshot = _memory; final snapshot = _memory;
if (snapshot == null) { if (snapshot == null) {
return _empty(theme, Icons.psychology_outlined, '记忆功能未启用'); return _empty(theme, Icons.psychology_outlined, 'Memory is not enabled');
} }
final global = snapshot.global final global = snapshot.global
.where((m) => _matches([m.title, m.body])) .where((m) => _matches([m.title, m.body]))
@@ -523,20 +523,20 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
return _empty( return _empty(
theme, theme,
Icons.psychology_outlined, Icons.psychology_outlined,
_query.isEmpty ? '还没有记忆' : '没有匹配的记忆'); _query.isEmpty ? 'No memories yet' : 'No matching memories');
} }
return ListView( return ListView(
padding: const EdgeInsets.fromLTRB(12, 0, 12, 12), padding: const EdgeInsets.fromLTRB(12, 0, 12, 12),
children: [ children: [
_memoryGroup(theme, tr('全局记忆'), global, 'global', _memoryGroup(theme, tr('Global memory'), global, 'global',
failed: snapshot.globalFailed), failed: snapshot.globalFailed),
const SizedBox(height: 8), const SizedBox(height: 8),
_memoryGroup(theme, tr('项目记忆'), project, 'project', _memoryGroup(theme, tr('Project memory'), project, 'project',
failed: snapshot.projectFailed), failed: snapshot.projectFailed),
Padding( Padding(
padding: const EdgeInsets.only(top: 6), padding: const EdgeInsets.only(top: 6),
child: AppText( child: AppText(
'记忆由 agent 在会话中记录;你可以在这里修改或删除它。', 'Memory is recorded by the agent during sessions; you can edit or delete it here.',
style: TextStyle(fontSize: 11.5, color: theme.hintColor), style: TextStyle(fontSize: 11.5, color: theme.hintColor),
), ),
), ),
@@ -552,20 +552,20 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.only(bottom: 4), padding: const EdgeInsets.only(bottom: 4),
child: AppText(trArgs('{0}({1})', [title, entries.length]), child: AppText(trArgs('{0} ({1})', [title, entries.length]),
style: TextStyle(fontSize: 12, color: theme.hintColor)), style: TextStyle(fontSize: 12, color: theme.hintColor)),
), ),
if (failed) if (failed)
Padding( Padding(
padding: const EdgeInsets.only(bottom: 4), padding: const EdgeInsets.only(bottom: 4),
child: AppText('读取失败,请刷新', child: AppText('Could not load, refresh to retry',
style: TextStyle( style: TextStyle(
fontSize: 12, color: theme.colorScheme.error)), fontSize: 12, color: theme.colorScheme.error)),
) )
else if (entries.isEmpty) else if (entries.isEmpty)
Padding( Padding(
padding: const EdgeInsets.only(bottom: 4), padding: const EdgeInsets.only(bottom: 4),
child: AppText('暂无', style: TextStyle(fontSize: 12, color: theme.hintColor)), child: AppText('None', style: TextStyle(fontSize: 12, color: theme.hintColor)),
), ),
for (final entry in entries) _memoryCard(theme, entry, scope), for (final entry in entries) _memoryCard(theme, entry, scope),
], ],
@@ -591,7 +591,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
Row( Row(
children: [ children: [
Flexible( Flexible(
child: AppText(entry.title, child: Text(entry.title,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
@@ -605,7 +605,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
color: scheme.surfaceContainerHighest, color: scheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
child: AppText(entry.typeLabel, child: Text(entry.typeLabel,
style: TextStyle( style: TextStyle(
fontSize: 10, color: theme.hintColor)), fontSize: 10, color: theme.hintColor)),
), ),
@@ -618,7 +618,7 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
], ],
), ),
const SizedBox(height: 3), const SizedBox(height: 3),
AppText(entry.body, Text(entry.body,
maxLines: 4, maxLines: 4,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12.5, height: 1.35)), style: const TextStyle(fontSize: 12.5, height: 1.35)),
@@ -635,8 +635,8 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
} }
}, },
itemBuilder: (_) => const [ itemBuilder: (_) => const [
PopupMenuItem(value: 'edit', child: AppText('编辑')), PopupMenuItem(value: 'edit', child: AppText('Edit')),
PopupMenuItem(value: 'delete', child: AppText('删除')), PopupMenuItem(value: 'delete', child: AppText('Delete')),
], ],
), ),
], ],
@@ -741,13 +741,13 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
final text = await showDialog<String>( final text = await showDialog<String>(
context: context, context: context,
builder: (_) => _TextPromptDialog( builder: (_) => _TextPromptDialog(
title: note == null ? '新建笔记' : '编辑笔记', title: note == null ? 'New note' : 'Edit note',
hint: tr('记点什么,供之后的会话参考'), hint: tr('Write something for later sessions to read'),
initial: note?.body ?? '', initial: note?.body ?? '',
maxLength: 3000, maxLength: 3000,
maxLines: 10, maxLines: 10,
minLines: 4, minLines: 4,
action: '保存', action: 'Save',
), ),
); );
if (text == null || text.isEmpty) return; if (text == null || text.isEmpty) return;
@@ -770,12 +770,12 @@ class _KnowledgePanelState extends State<KnowledgePanel> {
final text = await showDialog<String>( final text = await showDialog<String>(
context: context, context: context,
builder: (_) => _TextPromptDialog( builder: (_) => _TextPromptDialog(
title: '新建待办', title: 'New todo',
hint: tr('要做什么'), hint: tr('What needs doing'),
maxLength: 1000, maxLength: 1000,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
action: '保存', action: 'Save',
), ),
); );
if (text == null || text.isEmpty) return; if (text == null || text.isEmpty) return;
@@ -876,7 +876,7 @@ class _PlanPageState extends State<_PlanPage> {
} catch (error) { } catch (error) {
if (mounted) { if (mounted) {
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: AppText('$error'))); .showSnackBar(SnackBar(content: Text('$error')));
} }
} finally { } finally {
if (mounted) setState(() => _saving = false); if (mounted) setState(() => _saving = false);
@@ -887,18 +887,18 @@ class _PlanPageState extends State<_PlanPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: AppText(widget.title, maxLines: 1, overflow: TextOverflow.ellipsis), title: Text(widget.title, maxLines: 1, overflow: TextOverflow.ellipsis),
actions: [ actions: [
if (_editing) if (_editing)
TextButton( TextButton(
onPressed: _saving ? null : () => setState(() => _editing = false), onPressed: _saving ? null : () => setState(() => _editing = false),
child: const AppText('取消'), child: const AppText('Cancel'),
), ),
TextButton( TextButton(
onPressed: _saving onPressed: _saving
? null ? null
: (_editing ? _save : () => setState(() => _editing = true)), : (_editing ? _save : () => setState(() => _editing = true)),
child: AppText(_saving ? '保存中…' : (_editing ? '保存' : '编辑')), child: AppText(_saving ? 'Saving…' : (_editing ? 'Save' : 'Edit')),
), ),
], ],
), ),
@@ -983,7 +983,7 @@ class _TextPromptDialogState extends State<_TextPromptDialog> {
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
child: const AppText('取消')), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () => Navigator.pop(context, _controller.text.trim()), onPressed: () => Navigator.pop(context, _controller.text.trim()),
child: AppText(widget.action)), child: AppText(widget.action)),
@@ -1014,7 +1014,7 @@ class _NewPlanDialogState extends State<_NewPlanDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertDialog( return AlertDialog(
title: const AppText('新建计划'), title: const AppText('New plan'),
content: SizedBox( content: SizedBox(
width: double.maxFinite, width: double.maxFinite,
child: Column( child: Column(
@@ -1025,7 +1025,7 @@ class _NewPlanDialogState extends State<_NewPlanDialog> {
autofocus: true, autofocus: true,
maxLength: 160, maxLength: 160,
decoration: InputDecoration( decoration: InputDecoration(
labelText: tr('标题'), labelText: tr('Title'),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
), ),
), ),
@@ -1036,7 +1036,7 @@ class _NewPlanDialogState extends State<_NewPlanDialog> {
minLines: 6, minLines: 6,
decoration: InputDecoration( decoration: InputDecoration(
alignLabelWithHint: true, alignLabelWithHint: true,
labelText: tr('计划正文(Markdown)'), labelText: tr('Plan body (Markdown)'),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
), ),
), ),
@@ -1046,11 +1046,11 @@ class _NewPlanDialogState extends State<_NewPlanDialog> {
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
child: const AppText('取消')), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () => Navigator.pop( onPressed: () => Navigator.pop(
context, (_title.text.trim(), _body.text)), context, (_title.text.trim(), _body.text)),
child: const AppText('创建')), child: const AppText('Create')),
], ],
); );
} }
@@ -1082,7 +1082,7 @@ class _MemoryDialogState extends State<_MemoryDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertDialog( return AlertDialog(
title: const AppText('编辑记忆'), title: const AppText('Edit memory'),
content: SizedBox( content: SizedBox(
width: double.maxFinite, width: double.maxFinite,
child: Column( child: Column(
@@ -1093,7 +1093,7 @@ class _MemoryDialogState extends State<_MemoryDialog> {
autofocus: true, autofocus: true,
maxLength: 120, maxLength: 120,
decoration: InputDecoration( decoration: InputDecoration(
labelText: tr('标题'), labelText: tr('Title'),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
), ),
), ),
@@ -1105,9 +1105,9 @@ class _MemoryDialogState extends State<_MemoryDialog> {
tapTargetSize: MaterialTapTargetSize.shrinkWrap, tapTargetSize: MaterialTapTargetSize.shrinkWrap,
), ),
segments: const [ segments: const [
ButtonSegment(value: 'fact', label: AppText('事实')), ButtonSegment(value: 'fact', label: AppText('Fact')),
ButtonSegment(value: 'preference', label: AppText('偏好')), ButtonSegment(value: 'preference', label: AppText('Preference')),
ButtonSegment(value: 'reference', label: AppText('参考')), ButtonSegment(value: 'reference', label: AppText('Reference')),
], ],
selected: {_type}, selected: {_type},
onSelectionChanged: (value) => onSelectionChanged: (value) =>
@@ -1121,7 +1121,7 @@ class _MemoryDialogState extends State<_MemoryDialog> {
minLines: 4, minLines: 4,
decoration: InputDecoration( decoration: InputDecoration(
alignLabelWithHint: true, alignLabelWithHint: true,
labelText: tr('内容'), labelText: tr('Content'),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
), ),
), ),
@@ -1130,14 +1130,14 @@ class _MemoryDialogState extends State<_MemoryDialog> {
), ),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(context), child: const AppText('取消')), onPressed: () => Navigator.pop(context), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () { onPressed: () {
final title = _title.text.trim(); final title = _title.text.trim();
if (title.isEmpty) return; if (title.isEmpty) return;
Navigator.pop(context, (title, _body.text.trim(), _type)); Navigator.pop(context, (title, _body.text.trim(), _type));
}, },
child: const AppText('保存'), child: const AppText('Save'),
), ),
], ],
); );
+16 -16
View File
@@ -177,7 +177,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
} catch (e) { } catch (e) {
if (mounted) { if (mounted) {
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: AppText(trArgs('选择失败:{0}', [e])))); .showSnackBar(SnackBar(content: AppText(trArgs('Could not attach: {0}', [e]))));
} }
} finally { } finally {
if (mounted) setState(() => _attaching = false); if (mounted) setState(() => _attaching = false);
@@ -208,14 +208,14 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
? null ? null
: IconButton( : IconButton(
icon: const Icon(Icons.menu), icon: const Icon(Icons.menu),
tooltip: tr('会话'), tooltip: tr('Sessions'),
onPressed: widget.onOpenSessions, onPressed: widget.onOpenSessions,
), ),
title: const AppText('新会话'), title: const AppText('New session'),
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Icons.folder_open_outlined), icon: const Icon(Icons.folder_open_outlined),
tooltip: tr('文件'), tooltip: tr('Files'),
onPressed: () => showFilesPanel(context, app, draft.directory), onPressed: () => showFilesPanel(context, app, draft.directory),
), ),
], ],
@@ -230,7 +230,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(32), padding: const EdgeInsets.all(32),
child: AppText( child: AppText(
'我们今天要做什么?', 'What are we building today?',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 26, fontSize: 26,
@@ -253,7 +253,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
if (draft.error != null) if (draft.error != null)
Padding( Padding(
padding: const EdgeInsets.only(bottom: 6), padding: const EdgeInsets.only(bottom: 6),
child: AppText( child: Text(
draft.error!, draft.error!,
style: TextStyle( style: TextStyle(
fontSize: 12.5, color: scheme.error), fontSize: 12.5, color: scheme.error),
@@ -301,8 +301,8 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
const SizedBox(width: 5), const SizedBox(width: 5),
ConstrainedBox( ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 170), constraints: const BoxConstraints(maxWidth: 170),
child: AppText( child: Text(
label.isEmpty ? '选择项目' : label, label.isEmpty ? tr('Choose project') : label,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 12.5, color: theme.hintColor), style: TextStyle(fontSize: 12.5, color: theme.hintColor),
@@ -323,7 +323,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
Widget body = ComposerBox( Widget body = ComposerBox(
controller: _text, controller: _text,
focusNode: _inputFocus, focusNode: _inputFocus,
hint: tr('规划、构建或提问'), hint: tr('Plan, build, or ask'),
maxLines: 5, maxLines: 5,
keyboardInset: keyboardInset, keyboardInset: keyboardInset,
textInputAction: textInputAction:
@@ -355,7 +355,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
}, },
leading: _roundKey( leading: _roundKey(
icon: Icons.attach_file, icon: Icons.attach_file,
label: tr('添加附件'), label: tr('Add attachment'),
onTap: _pickFiles, onTap: _pickFiles,
busy: _attaching, busy: _attaching,
), ),
@@ -478,7 +478,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
children: [ children: [
const Padding( const Padding(
padding: EdgeInsets.fromLTRB(16, 14, 16, 6), padding: EdgeInsets.fromLTRB(16, 14, 16, 6),
child: AppText('选择项目', child: AppText('Choose project',
style: style:
TextStyle(fontSize: 17, fontWeight: FontWeight.w600)), TextStyle(fontSize: 17, fontWeight: FontWeight.w600)),
), ),
@@ -490,8 +490,8 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
dense: true, dense: true,
leading: ProjectIcon( leading: ProjectIcon(
app: widget.app, chat: true, size: 20), app: widget.app, chat: true, size: 20),
title: const AppText('聊天'), title: const AppText('Chat'),
subtitle: const AppText('不关联项目,保存在 OpenChamber 的聊天目录'), subtitle: const AppText('Not tied to a project, saved in OpenChamber\'s chat directory'),
trailing: draft.directory == AppState.chatTarget trailing: draft.directory == AppState.chatTarget
? Icon(Icons.check, ? Icon(Icons.check,
size: 18, size: 18,
@@ -509,9 +509,9 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
dense: true, dense: true,
leading: leading:
ProjectIcon(app: widget.app, project: project, size: 20), ProjectIcon(app: widget.app, project: project, size: 20),
title: AppText(project.label, title: Text(project.label,
maxLines: 1, overflow: TextOverflow.ellipsis), maxLines: 1, overflow: TextOverflow.ellipsis),
subtitle: AppText(project.canonical, subtitle: Text(project.canonical,
maxLines: 1, overflow: TextOverflow.ellipsis), maxLines: 1, overflow: TextOverflow.ellipsis),
trailing: project.canonical == draft.directory trailing: project.canonical == draft.directory
? Icon(Icons.check, ? Icon(Icons.check,
@@ -528,7 +528,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
if (projects.isEmpty) if (projects.isEmpty)
const Padding( const Padding(
padding: EdgeInsets.all(24), padding: EdgeInsets.all(24),
child: AppText('没有可用的项目', textAlign: TextAlign.center), child: AppText('No projects available', textAlign: TextAlign.center),
), ),
], ],
), ),
+18 -18
View File
@@ -93,7 +93,7 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
return; return;
} }
if (cameras.isEmpty) { if (cameras.isEmpty) {
if (mounted) setState(() => _error = tr('没有可用的相机')); if (mounted) setState(() => _error = tr('No camera available'));
return; return;
} }
CameraDescription pick = cameras.first; CameraDescription pick = cameras.first;
@@ -124,11 +124,11 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
await controller.startImageStream(_onFrame); await controller.startImageStream(_onFrame);
_watchdog = Timer(const Duration(seconds: 4), () { _watchdog = Timer(const Duration(seconds: 4), () {
if (!mounted || _frames > 0 || _error != null) return; if (!mounted || _frames > 0 || _error != null) return;
setState(() => _hint = tr('没有收到相机画面,请关闭后重试')); setState(() => _hint = tr('No camera frames received; close and try again'));
}); });
_slowHint = Timer(const Duration(seconds: 12), () { _slowHint = Timer(const Duration(seconds: 12), () {
if (!mounted || _found || _frames == 0) return; if (!mounted || _found || _frames == 0) return;
_showHint(tr('还没识别到二维码,试着靠近一点或让二维码占满取景框'), _showHint(tr('No QR code yet; move closer or fill the frame with the code'),
sticky: true); sticky: true);
}); });
return; return;
@@ -153,11 +153,11 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
if (error.code == 'CameraAccessDenied' || if (error.code == 'CameraAccessDenied' ||
error.code == 'CameraAccessDeniedWithoutPrompt' || error.code == 'CameraAccessDeniedWithoutPrompt' ||
error.code == 'CameraAccessRestricted') { error.code == 'CameraAccessRestricted') {
return tr('需要相机权限才能扫码。请在系统设置里允许 OpenChamber 使用相机。'); return tr('Camera permission is required to scan. Allow OpenChamber to use the camera in system settings.');
} }
return trArgs('无法打开相机:{0}', [error.description ?? error.code]); return trArgs('Could not open the camera: {0}', [error.description ?? error.code]);
} }
return trArgs('无法打开相机:{0}', [error]); return trArgs('Could not open the camera: {0}', [error]);
} }
void _onFrame(CameraImage image) { void _onFrame(CameraImage image) {
@@ -189,14 +189,14 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
if (text.trim().startsWith('openchamber://connect')) { if (text.trim().startsWith('openchamber://connect')) {
_accept(text.trim()); _accept(text.trim());
} else { } else {
_showHint(tr('这不是 OpenChamber 配对二维码')); _showHint(tr('This is not an OpenChamber pairing QR code'));
} }
}).catchError((Object error) { }).catchError((Object error) {
_decoding = false; _decoding = false;
_decodeErrors += 1; _decodeErrors += 1;
if (_decodeErrors == 1) { if (_decodeErrors == 1) {
debugPrint('qr: decode failed: $error'); debugPrint('qr: decode failed: $error');
if (mounted) _showHint(tr('二维码解码出错,请重试')); if (mounted) _showHint(tr('Could not decode the QR code; try again'));
} }
}); });
} }
@@ -249,7 +249,7 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
await controller.setFlashMode(_torch ? FlashMode.off : FlashMode.torch); await controller.setFlashMode(_torch ? FlashMode.off : FlashMode.torch);
if (mounted) setState(() => _torch = !_torch); if (mounted) setState(() => _torch = !_torch);
} catch (_) { } catch (_) {
if (mounted) _showHint(tr('这个相机不支持手电筒')); if (mounted) _showHint(tr('This camera does not support the flashlight'));
} }
} }
@@ -275,13 +275,13 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
const Icon(Icons.no_photography_outlined, const Icon(Icons.no_photography_outlined,
size: 36, color: Colors.white70), size: 36, color: Colors.white70),
const SizedBox(height: 12), const SizedBox(height: 12),
AppText(_error!, Text(_error!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white70)), style: const TextStyle(color: Colors.white70)),
const SizedBox(height: 16), const SizedBox(height: 16),
FilledButton.tonal( FilledButton.tonal(
onPressed: _start, onPressed: _start,
child: const AppText('重试'), child: const AppText('Retry'),
), ),
], ],
), ),
@@ -296,14 +296,14 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
Row( Row(
children: [ children: [
IconButton( IconButton(
tooltip: tr('关闭'), tooltip: tr('Close'),
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
color: Colors.white, color: Colors.white,
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
const Spacer(), const Spacer(),
IconButton( IconButton(
tooltip: tr('手电筒'), tooltip: tr('Flashlight'),
icon: Icon(_torch ? Icons.flash_on : Icons.flash_off), icon: Icon(_torch ? Icons.flash_on : Icons.flash_off),
color: Colors.white, color: Colors.white,
onPressed: _toggleTorch, onPressed: _toggleTorch,
@@ -315,22 +315,22 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
padding: const EdgeInsets.fromLTRB(24, 0, 24, 32), padding: const EdgeInsets.fromLTRB(24, 0, 24, 32),
child: Column( child: Column(
children: [ children: [
AppText( Text(
_hint ?? '把配对二维码放进框内', _hint ?? tr('Put the pairing QR code inside the frame'),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white, fontSize: 14), style: const TextStyle(color: Colors.white, fontSize: 14),
), ),
const SizedBox(height: 6), const SizedBox(height: 6),
const AppText( const AppText(
'在 OpenChamber 网页端打开「连接设备」,选择二维码', 'In the OpenChamber web app, open “Connect a device” and choose the QR code',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(color: Colors.white60, fontSize: 12), style: TextStyle(color: Colors.white60, fontSize: 12),
), ),
if (ready && _frames > 0) if (ready && _frames > 0)
Padding( Padding(
padding: const EdgeInsets.only(top: 8), padding: const EdgeInsets.only(top: 8),
child: AppText( child: Text(
trArgs('{0} · 已扫描 {1} 帧 / 解码 {2} 次', trArgs('{0} · {1} frames scanned / {2} decode attempts',
[_frameShape ?? '', _frames, _decodeAttempts]), [_frameShape ?? '', _frames, _decodeAttempts]),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: const TextStyle(
+43 -43
View File
@@ -60,7 +60,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
project.label, project.label,
project.canonical, project.canonical,
), ),
_TaskScope(Client.scheduledChatsScope, tr('聊天')), _TaskScope(Client.scheduledChatsScope, tr('Chat')),
]; ];
} }
@@ -84,7 +84,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
setState(() { setState(() {
_loading = false; _loading = false;
_tasks = const []; _tasks = const [];
_error = client == null ? '未连接服务器' : null; _error = client == null ? tr('Not connected to a server') : null;
}); });
return; return;
} }
@@ -105,15 +105,15 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
_loading = false; _loading = false;
_tasks = const []; _tasks = const [];
_error = e.status == 404 _error = e.status == 404
? '服务器不支持计划任务' ? 'The server doesn\'t support scheduled tasks'
: trArgs('加载计划任务失败:{0}', [e.message]); : trArgs('Couldn\'t load scheduled tasks: {0}', [e.message]);
}); });
} catch (e) { } catch (e) {
if (!mounted || _scope?.id != scope.id) return; if (!mounted || _scope?.id != scope.id) return;
setState(() { setState(() {
_loading = false; _loading = false;
_tasks = const []; _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 { Future<bool> _save(_TaskScope scope, ScheduledTask draft) async {
final client = app.client; final client = app.client;
if (client == null) { if (client == null) {
_say('未连接服务器'); _say(tr('Not connected to a server'));
return false; return false;
} }
try { try {
final tasks = await client.saveScheduledTask(scope.id, draft); final tasks = await client.saveScheduledTask(scope.id, draft);
if (!mounted) return true; if (!mounted) return true;
if (_scope?.id == scope.id) setState(() => _tasks = tasks); if (_scope?.id == scope.id) setState(() => _tasks = tasks);
_say('计划任务已保存'); _say('Scheduled task saved');
return true; return true;
} on ApiError catch (e) { } on ApiError catch (e) {
_say(e.message.isEmpty ? '保存任务失败' : e.message); _say(e.message.isEmpty ? 'Couldn\'t save task' : e.message);
return false; return false;
} catch (e) { } catch (e) {
_say(trArgs('保存任务失败:{0}', [e])); _say(trArgs('Couldn\'t save task: {0}', [e]));
return false; return false;
} }
} }
@@ -173,7 +173,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
if (!mounted) return; if (!mounted) return;
if (_scope?.id == scope.id) setState(() => _tasks = tasks); if (_scope?.id == scope.id) setState(() => _tasks = tasks);
} catch (e) { } 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(); await _load();
} finally { } finally {
if (mounted) setState(() => _busyId = ''); if (mounted) setState(() => _busyId = '');
@@ -187,12 +187,12 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
setState(() => _busyId = task.id); setState(() => _busyId = task.id);
try { try {
await client.runScheduledTask(scope.id, task.id); await client.runScheduledTask(scope.id, task.id);
_say('任务已启动'); _say('Task started');
await _load(); await _load();
} on ApiError catch (e) { } 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) { } catch (e) {
_say(trArgs('运行任务失败:{0}', [e])); _say(trArgs('Couldn\'t run task: {0}', [e]));
} finally { } finally {
if (mounted) setState(() => _busyId = ''); if (mounted) setState(() => _busyId = '');
} }
@@ -205,15 +205,15 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
final ok = await showDialog<bool>( final ok = await showDialog<bool>(
context: context, context: context,
builder: (dialog) => AlertDialog( builder: (dialog) => AlertDialog(
title: const AppText('删除计划任务?'), title: const AppText('Delete scheduled task?'),
content: AppText(trArgs('“{0}”及其计划会被删除。', [task.name])), content: AppText(trArgs('“{0}” and its schedule will be deleted.', [task.name])),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(dialog, false), onPressed: () => Navigator.pop(dialog, false),
child: const AppText('取消')), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () => Navigator.pop(dialog, true), 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); final tasks = await client.deleteScheduledTask(scope.id, task.id);
if (!mounted) return; if (!mounted) return;
if (_scope?.id == scope.id) setState(() => _tasks = tasks); if (_scope?.id == scope.id) setState(() => _tasks = tasks);
_say('计划任务已删除'); _say('Scheduled task deleted');
} catch (e) { } 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 { } finally {
if (mounted) setState(() => _busyId = ''); if (mounted) setState(() => _busyId = '');
} }
@@ -236,16 +236,16 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
final theme = Theme.of(context); final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const AppText('计划任务'), title: const AppText('Scheduled tasks'),
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Icons.refresh), icon: const Icon(Icons.refresh),
tooltip: tr('刷新'), tooltip: tr('Refresh'),
onPressed: _loading ? null : _load, onPressed: _loading ? null : _load,
), ),
IconButton( IconButton(
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
tooltip: tr('新建任务'), tooltip: tr('New task'),
onPressed: _scope == null ? null : () => _openEditor(), onPressed: _scope == null ? null : () => _openEditor(),
), ),
], ],
@@ -267,7 +267,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
children: [ children: [
Icon(Icons.folder_outlined, size: 18, color: theme.hintColor), Icon(Icons.folder_outlined, size: 18, color: theme.hintColor),
const SizedBox(width: 8), 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), const SizedBox(width: 10),
Expanded( Expanded(
child: DropdownButtonHideUnderline( child: DropdownButtonHideUnderline(
@@ -278,7 +278,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
for (final scope in _scopes) for (final scope in _scopes)
DropdownMenuItem( DropdownMenuItem(
value: scope.id, value: scope.id,
child: AppText(scope.label, child: Text(scope.label,
maxLines: 1, overflow: TextOverflow.ellipsis), maxLines: 1, overflow: TextOverflow.ellipsis),
), ),
], ],
@@ -309,9 +309,9 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
AppText(_error!, style: TextStyle(color: theme.hintColor)), Text(_error!, style: TextStyle(color: theme.hintColor)),
const SizedBox(height: 8), 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: [ children: [
Icon(Icons.event_note_outlined, size: 36, color: theme.hintColor), Icon(Icons.event_note_outlined, size: 36, color: theme.hintColor),
const SizedBox(height: 10), const SizedBox(height: 10),
AppText('暂无计划任务。', style: TextStyle(color: theme.hintColor)), AppText('No scheduled tasks yet.', style: TextStyle(color: theme.hintColor)),
const SizedBox(height: 8), const SizedBox(height: 8),
FilledButton.tonalIcon( FilledButton.tonalIcon(
onPressed: () => _openEditor(), onPressed: () => _openEditor(),
icon: const Icon(Icons.add, size: 18), 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, _ => theme.hintColor,
}; };
final next = task.nextRunAt > 0 && task.enabled final next = task.nextRunAt > 0 && task.enabled
? trArgs('下次:{0}', [scheduledRelativeTime(task.nextRunAt)]) ? trArgs('Next: {0}', [scheduledRelativeTime(task.nextRunAt)])
: (task.enabled ? '' : '已暂停'); : (task.enabled ? '' : 'Paused');
final last = task.lastRunAt > 0 final last = task.lastRunAt > 0
? trArgs('上次运行 {0} · {1}', [ ? trArgs('Last run {0} · {1}', [
scheduledClock(task.lastRunAt), scheduledClock(task.lastRunAt),
scheduledStatusLabel(task.lastStatus), scheduledStatusLabel(task.lastStatus),
]) ])
: '从未运行'; : 'Never run';
return Card( return Card(
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 2), margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 2),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
@@ -374,7 +374,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: AppText( child: Text(
task.name, task.name,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -396,7 +396,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
onChanged: (v) => _toggle(task, v), onChanged: (v) => _toggle(task, v),
), ),
PopupMenuButton<String>( PopupMenuButton<String>(
tooltip: tr('更多'), tooltip: tr('More'),
onSelected: (value) { onSelected: (value) {
switch (value) { switch (value) {
case 'run': case 'run':
@@ -408,23 +408,23 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
} }
}, },
itemBuilder: (_) => [ itemBuilder: (_) => [
const PopupMenuItem(value: 'run', child: AppText('立即运行')), const PopupMenuItem(value: 'run', child: AppText('Run now')),
const PopupMenuItem(value: 'edit', child: AppText('编辑')), const PopupMenuItem(value: 'edit', child: AppText('Edit')),
PopupMenuItem( PopupMenuItem(
value: 'delete', value: 'delete',
child: AppText('删除', child: AppText('Delete',
style: TextStyle(color: theme.colorScheme.error)), style: TextStyle(color: theme.colorScheme.error)),
), ),
], ],
), ),
], ],
), ),
AppText(scheduledScheduleText(task), Text(scheduledScheduleText(task),
style: TextStyle(fontSize: 13, color: theme.colorScheme.onSurfaceVariant)), style: TextStyle(fontSize: 13, color: theme.colorScheme.onSurfaceVariant)),
if (task.targetSessionId.isEmpty) if (task.targetSessionId.isEmpty)
const SizedBox.shrink() const SizedBox.shrink()
else 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), const SizedBox(height: 4),
Row( Row(
children: [ children: [
@@ -441,7 +441,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
const SizedBox(width: 6), const SizedBox(width: 6),
], ],
Expanded( Expanded(
child: AppText( child: Text(
last, last,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -449,7 +449,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
), ),
), ),
if (next.isNotEmpty) if (next.isNotEmpty)
AppText(next, Text(next,
style: style:
TextStyle(fontSize: 11.5, color: theme.hintColor)), TextStyle(fontSize: 11.5, color: theme.hintColor)),
], ],
@@ -457,7 +457,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
if (task.lastError.isNotEmpty) if (task.lastError.isNotEmpty)
Padding( Padding(
padding: const EdgeInsets.only(top: 4), padding: const EdgeInsets.only(top: 4),
child: AppText( child: Text(
task.lastError, task.lastError,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -466,7 +466,7 @@ class _ScheduledTasksScreenState extends State<ScheduledTasksScreen> {
), ),
), ),
const SizedBox(height: 2), const SizedBox(height: 2),
AppText( Text(
task.modelLabel, task.modelLabel,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
+39 -40
View File
@@ -75,7 +75,7 @@ class _ServersScreenState extends State<ServersScreen> {
style: theme.textTheme.headlineMedium style: theme.textTheme.headlineMedium
?.copyWith(fontWeight: FontWeight.bold)), ?.copyWith(fontWeight: FontWeight.bold)),
const SizedBox(height: 4), const SizedBox(height: 4),
AppText('连接你的 OpenChamber 服务器', AppText('Connect to your OpenChamber server',
style: theme.textTheme.bodyMedium style: theme.textTheme.bodyMedium
?.copyWith(color: theme.hintColor)), ?.copyWith(color: theme.hintColor)),
], ],
@@ -84,7 +84,7 @@ class _ServersScreenState extends State<ServersScreen> {
if (widget.app.error != null) if (widget.app.error != null)
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: AppText(widget.app.error!, child: Text(widget.app.error!,
style: TextStyle(color: theme.colorScheme.error, fontSize: 13)), style: TextStyle(color: theme.colorScheme.error, fontSize: 13)),
), ),
Expanded( Expanded(
@@ -99,7 +99,7 @@ class _ServersScreenState extends State<ServersScreen> {
child: OutlinedButton.icon( child: OutlinedButton.icon(
onPressed: () => _startEdit(null), onPressed: () => _startEdit(null),
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
label: const AppText('添加服务器'), label: const AppText('Add server'),
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
@@ -107,7 +107,7 @@ class _ServersScreenState extends State<ServersScreen> {
child: FilledButton.tonalIcon( child: FilledButton.tonalIcon(
onPressed: _pair, onPressed: _pair,
icon: const Icon(Icons.qr_code_2, size: 18), icon: const Icon(Icons.qr_code_2, size: 18),
label: const AppText('配对链接'), label: const AppText('Pairing link'),
), ),
), ),
], ],
@@ -127,14 +127,14 @@ class _ServersScreenState extends State<ServersScreen> {
return Card( return Card(
margin: const EdgeInsets.only(bottom: 10), margin: const EdgeInsets.only(bottom: 10),
child: ListTile( child: ListTile(
title: AppText(c.label, style: const TextStyle(fontWeight: FontWeight.w600)), title: Text(c.label, style: const TextStyle(fontWeight: FontWeight.w600)),
subtitle: Column( subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText(c.isRelay ? trArgs('经由 Relay · {0}', [c.serverId]) : c.url, Text(c.isRelay ? trArgs('Via Relay · {0}', [c.serverId]) : c.url,
maxLines: 1, overflow: TextOverflow.ellipsis), maxLines: 1, overflow: TextOverflow.ellipsis),
if (!c.isRelay && c.proxy.isNotEmpty) if (!c.isRelay && c.proxy.isNotEmpty)
AppText(trArgs('经由 {0}', [c.proxy]), AppText(trArgs('Via {0}', [c.proxy]),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 12, color: theme.hintColor)), style: TextStyle(fontSize: 12, color: theme.hintColor)),
@@ -144,9 +144,9 @@ class _ServersScreenState extends State<ServersScreen> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
if (connected) if (connected)
AppText('已连接', style: TextStyle(color: theme.colorScheme.primary)) AppText('Connected', style: TextStyle(color: theme.colorScheme.primary))
else else
TextButton(onPressed: () => _connect(c), child: const AppText('连接')), TextButton(onPressed: () => _connect(c), child: const AppText('Connect')),
PopupMenuButton<String>( PopupMenuButton<String>(
onSelected: (v) { onSelected: (v) {
if (v == 'edit') { if (v == 'edit') {
@@ -156,8 +156,8 @@ class _ServersScreenState extends State<ServersScreen> {
} }
}, },
itemBuilder: (_) => const [ itemBuilder: (_) => const [
PopupMenuItem(value: 'edit', child: AppText('编辑')), PopupMenuItem(value: 'edit', child: AppText('Edit')),
PopupMenuItem(value: 'delete', child: AppText('删除')), PopupMenuItem(value: 'delete', child: AppText('Delete')),
], ],
), ),
], ],
@@ -222,28 +222,28 @@ class _ServersScreenState extends State<ServersScreen> {
setState(() => _editing = false); setState(() => _editing = false);
}, },
), ),
title: AppText(_editNew ? '添加服务器' : trArgs('连接 {0}', [_edit!.label])), title: AppText(_editNew ? 'Add server' : trArgs('Connect to {0}', [_edit!.label])),
), ),
body: ListView( body: ListView(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
children: [ children: [
_labelText('名称'), _labelText('Name'),
TextField( TextField(
controller: TextEditingController(text: _label), controller: TextEditingController(text: _label),
onChanged: (v) => _label = v, onChanged: (v) => _label = v,
decoration: InputDecoration( decoration: InputDecoration(
hintText: tr('如 我的电脑'), border: const OutlineInputBorder()), hintText: tr('e.g. My computer'), border: const OutlineInputBorder()),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
if (_edit?.isRelay == true) ...[ if (_edit?.isRelay == true) ...[
const ListTile( const ListTile(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
leading: Icon(Icons.lock_outline, size: 20), leading: Icon(Icons.lock_outline, size: 20),
title: AppText('通过 Relay 连接'), title: AppText('Connect through Relay'),
subtitle: AppText('端到端加密;服务器与设备令牌保持不变'), subtitle: AppText('End-to-end encrypted; the server and device token stay the same'),
), ),
] else ...[ ] else ...[
_labelText('服务器地址'), _labelText('Server address'),
TextField( TextField(
controller: TextEditingController(text: _url), controller: TextEditingController(text: _url),
onChanged: (v) => _url = v, onChanged: (v) => _url = v,
@@ -252,47 +252,47 @@ class _ServersScreenState extends State<ServersScreen> {
hintText: 'http://192.168.1.10:3000', border: OutlineInputBorder()), hintText: 'http://192.168.1.10:3000', border: OutlineInputBorder()),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
_labelText('代理(可选)'), _labelText('Proxy (optional)'),
TextField( TextField(
controller: TextEditingController(text: _proxy), controller: TextEditingController(text: _proxy),
onChanged: (v) => _proxy = v, onChanged: (v) => _proxy = v,
keyboardType: TextInputType.url, keyboardType: TextInputType.url,
decoration: InputDecoration( decoration: InputDecoration(
hintText: tr('http://… 或 socks5://…'), hintText: tr('http://… or socks5://…'),
border: const OutlineInputBorder()), border: const OutlineInputBorder()),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
_labelText('自签证书指纹(可选)'), _labelText('Self-signed certificate fingerprint (optional)'),
TextField( TextField(
controller: TextEditingController(text: _fingerprint), controller: TextEditingController(text: _fingerprint),
onChanged: (v) => _fingerprint = v, onChanged: (v) => _fingerprint = v,
decoration: InputDecoration( decoration: InputDecoration(
hintText: tr('SHA-256 十六进制'), hintText: tr('SHA-256 hex'),
border: const OutlineInputBorder()), border: const OutlineInputBorder()),
), ),
SwitchListTile( SwitchListTile(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
title: const AppText('信任自签名证书'), title: const AppText('Trust self-signed certificates'),
value: _insecure, value: _insecure,
onChanged: (v) => setState(() => _insecure = v), onChanged: (v) => setState(() => _insecure = v),
), ),
// Shown for new servers too: a password-protected instance rejects // Shown for new servers too: a password-protected instance rejects
// the first attempt, and this is where the password goes. // the first attempt, and this is where the password goes.
_labelText('密码(如果需要)'), _labelText('Password (if required)'),
TextField( TextField(
controller: TextEditingController(text: _password), controller: TextEditingController(text: _password),
focusNode: _passwordFocus, focusNode: _passwordFocus,
onChanged: (v) => _password = v, onChanged: (v) => _password = v,
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
hintText: tr('服务器密码;服务器未设置可留空'), hintText: tr('Server password; leave empty if the server has none'),
border: const OutlineInputBorder()), border: const OutlineInputBorder()),
), ),
], ],
if (_formError != null) if (_formError != null)
Padding( Padding(
padding: const EdgeInsets.only(top: 8), padding: const EdgeInsets.only(top: 8),
child: AppText(_formError!, child: Text(_formError!,
style: TextStyle(color: theme.colorScheme.error)), style: TextStyle(color: theme.colorScheme.error)),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@@ -301,7 +301,7 @@ class _ServersScreenState extends State<ServersScreen> {
child: _connecting child: _connecting
? const SizedBox( ? const SizedBox(
height: 20, width: 20, child: CircularProgressIndicator(strokeWidth: 2)) height: 20, width: 20, child: CircularProgressIndicator(strokeWidth: 2))
: const AppText('连接'), : const AppText('Connect'),
), ),
], ],
), ),
@@ -354,7 +354,7 @@ class _ServersScreenState extends State<ServersScreen> {
/// The server asked for a password: put the caret where it is typed. /// The server asked for a password: put the caret where it is typed.
void _focusPasswordIfNeeded(String? message) { void _focusPasswordIfNeeded(String? message) {
// The message is already in the UI's language; look for the same word. // The message is already in the UI's language; look for the same word.
if (message == null || !message.contains(tr('需要密码'))) return; if (message == null || !message.contains(tr('Password'))) return;
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) _passwordFocus.requestFocus(); if (mounted) _passwordFocus.requestFocus();
}); });
@@ -370,16 +370,16 @@ class _ServersScreenState extends State<ServersScreen> {
showDialog( showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: const AppText('删除服务器?'), title: const AppText('Delete server?'),
content: AppText(trArgs('“{0}”将从列表移除,设备令牌也会删除。', [c.label])), content: AppText(trArgs('“{0}” will be removed from the list, and its device token will be deleted.', [c.label])),
actions: [ actions: [
TextButton(onPressed: () => Navigator.pop(context), child: const AppText('取消')), TextButton(onPressed: () => Navigator.pop(context), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
widget.app.removeConnection(c); widget.app.removeConnection(c);
}, },
child: const AppText('删除'), child: const AppText('Delete'),
), ),
], ],
), ),
@@ -458,7 +458,7 @@ class _PairingDialogState extends State<_PairingDialog> {
} }
setState(() { setState(() {
_busy = false; _busy = false;
_error = widget.app.lastError ?? tr('配对失败'); _error = widget.app.lastError ?? tr('Pairing failed');
}); });
widget.app.clearLastError(); widget.app.clearLastError();
} }
@@ -467,7 +467,7 @@ class _PairingDialogState extends State<_PairingDialog> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
return AlertDialog( return AlertDialog(
title: const AppText('配对链接'), title: const AppText('Pairing link'),
content: SizedBox( content: SizedBox(
width: 420, width: 420,
child: Column( child: Column(
@@ -475,8 +475,7 @@ class _PairingDialogState extends State<_PairingDialog> {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
AppText( AppText(
'在 OpenChamber 网页端打开「连接设备」,粘贴链接或直接扫描二维码。' 'In the OpenChamber web app, open “Connect a device”, then paste the link or scan the QR code. The link carries a one-time key and either a direct address or a private Relay.',
'链接里带一次性密钥,以及直连地址或私有 Relay。',
style: TextStyle(fontSize: 12.5, color: theme.hintColor), style: TextStyle(fontSize: 12.5, color: theme.hintColor),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
@@ -495,7 +494,7 @@ class _PairingDialogState extends State<_PairingDialog> {
if (_error != null) if (_error != null)
Padding( Padding(
padding: const EdgeInsets.only(top: 8), padding: const EdgeInsets.only(top: 8),
child: AppText(_error!, child: Text(_error!,
style: TextStyle(color: theme.colorScheme.error, fontSize: 12.5)), style: TextStyle(color: theme.colorScheme.error, fontSize: 12.5)),
), ),
Row( Row(
@@ -503,13 +502,13 @@ class _PairingDialogState extends State<_PairingDialog> {
TextButton.icon( TextButton.icon(
onPressed: _busy ? null : _scan, onPressed: _busy ? null : _scan,
icon: const Icon(Icons.qr_code_scanner, size: 18), icon: const Icon(Icons.qr_code_scanner, size: 18),
label: const AppText('扫码'), label: const AppText('Scan QR code'),
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
TextButton.icon( TextButton.icon(
onPressed: _busy ? null : _paste, onPressed: _busy ? null : _paste,
icon: const Icon(Icons.content_paste, size: 18), icon: const Icon(Icons.content_paste, size: 18),
label: const AppText('粘贴'), label: const AppText('Paste'),
), ),
], ],
), ),
@@ -519,14 +518,14 @@ class _PairingDialogState extends State<_PairingDialog> {
actions: [ actions: [
TextButton( TextButton(
onPressed: _busy ? null : () => Navigator.of(context).pop(), onPressed: _busy ? null : () => Navigator.of(context).pop(),
child: const AppText('取消'), child: const AppText('Cancel'),
), ),
FilledButton( FilledButton(
onPressed: _busy ? null : _connect, onPressed: _busy ? null : _connect,
child: _busy child: _busy
? const SizedBox( ? const SizedBox(
width: 18, height: 18, child: CircularProgressIndicator(strokeWidth: 2)) width: 18, height: 18, child: CircularProgressIndicator(strokeWidth: 2))
: const AppText('配对并连接'), : const AppText('Pair and connect'),
), ),
], ],
); );
+66 -66
View File
@@ -81,13 +81,13 @@ class _SessionListPaneState extends State<SessionListPane> {
children: [ children: [
const SizedBox(width: 12), const SizedBox(width: 12),
const Expanded( const Expanded(
child: AppText('会话', child: AppText('Sessions',
style: TextStyle( style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w600)), fontSize: 20, fontWeight: FontWeight.w600)),
), ),
IconButton( IconButton(
icon: Icon(_searchOpen ? Icons.close : Icons.search), icon: Icon(_searchOpen ? Icons.close : Icons.search),
tooltip: tr('搜索'), tooltip: tr('Search'),
onPressed: () { onPressed: () {
setState(() { setState(() {
_searchOpen = !_searchOpen; _searchOpen = !_searchOpen;
@@ -100,7 +100,7 @@ class _SessionListPaneState extends State<SessionListPane> {
), ),
IconButton( IconButton(
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
tooltip: tr('新会话'), tooltip: tr('New session'),
onPressed: () => _newSession(), onPressed: () => _newSession(),
), ),
], ],
@@ -114,7 +114,7 @@ class _SessionListPaneState extends State<SessionListPane> {
autofocus: true, autofocus: true,
onChanged: _onSearchChanged, onChanged: _onSearchChanged,
decoration: InputDecoration( decoration: InputDecoration(
hintText: tr('搜索会话'), hintText: tr('Search sessions'),
prefixIcon: const Icon(Icons.search), prefixIcon: const Icon(Icons.search),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
isDense: true, isDense: true,
@@ -127,13 +127,13 @@ class _SessionListPaneState extends State<SessionListPane> {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: AppText(_app.error!, child: Text(_app.error!,
style: TextStyle( style: TextStyle(
color: scheme.error, fontSize: 13)), color: scheme.error, fontSize: 13)),
), ),
TextButton( TextButton(
onPressed: _app.refreshSessions, onPressed: _app.refreshSessions,
child: const AppText('重试')), child: const AppText('Retry')),
], ],
), ),
), ),
@@ -189,12 +189,12 @@ class _SessionListPaneState extends State<SessionListPane> {
), ),
IconButton( IconButton(
icon: const Icon(Icons.widgets_outlined), icon: const Icon(Icons.widgets_outlined),
tooltip: tr('全部功能'), tooltip: tr('All features'),
onPressed: _openFeatures, onPressed: _openFeatures,
), ),
IconButton( IconButton(
icon: const Icon(Icons.settings_outlined), icon: const Icon(Icons.settings_outlined),
tooltip: tr('设置'), tooltip: tr('Settings'),
onPressed: _openSettings, onPressed: _openSettings,
), ),
], ],
@@ -242,10 +242,10 @@ class _SessionListPaneState extends State<SessionListPane> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
AppText(_searchCtrl.text.isEmpty ? '暂无会话' : '没有匹配的会话'), AppText(_searchCtrl.text.isEmpty ? 'No sessions' : 'No matching sessions'),
const SizedBox(height: 8), const SizedBox(height: 8),
FilledButton( FilledButton(
onPressed: () => _newSession(), child: const AppText('新会话')), onPressed: () => _newSession(), child: const AppText('New session')),
], ],
), ),
); );
@@ -284,7 +284,7 @@ class _SessionListPaneState extends State<SessionListPane> {
_SessionGroup( _SessionGroup(
key: entry.key, key: entry.key,
label: entry.key == AppState.chatTarget label: entry.key == AppState.chatTarget
? '聊天' ? tr('Chat')
: _app.projectLabelFor(entry.value.first.directory), : _app.projectLabelFor(entry.value.first.directory),
// The first session's own path: the server knows that spelling. // The first session's own path: the server knows that spelling.
path: entry.key == AppState.chatTarget path: entry.key == AppState.chatTarget
@@ -350,8 +350,8 @@ class _SessionListPaneState extends State<SessionListPane> {
), ),
], ],
), ),
title: AppText( title: Text(
group.label.isEmpty ? '未命名项目' : group.label, group.label.isEmpty ? tr('Untitled project') : group.label,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@@ -362,7 +362,7 @@ class _SessionListPaneState extends State<SessionListPane> {
), ),
subtitle: group.path.isEmpty subtitle: group.path.isEmpty
? null ? null
: AppText( : Text(
group.path, group.path,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -377,8 +377,8 @@ class _SessionListPaneState extends State<SessionListPane> {
icon: const Icon(Icons.add, size: 20), icon: const Icon(Icons.add, size: 20),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
tooltip: group.key == AppState.chatTarget tooltip: group.key == AppState.chatTarget
? tr('新建聊天') ? tr('New chat')
: tr('在此项目新会话'), : tr('New session in this project'),
onPressed: () => _newSession( onPressed: () => _newSession(
directory: group.key == AppState.chatTarget directory: group.key == AppState.chatTarget
? AppState.chatTarget ? AppState.chatTarget
@@ -413,10 +413,10 @@ class _SessionListPaneState extends State<SessionListPane> {
final yesterday = today.subtract(const Duration(days: 1)); final yesterday = today.subtract(const Duration(days: 1));
final weekAgo = today.subtract(const Duration(days: 7)); final weekAgo = today.subtract(const Duration(days: 7));
final buckets = <String, List<Session>>{ final buckets = <String, List<Session>>{
'今天': [], 'Today': [],
'昨天': [], 'Yesterday': [],
'本周早些时候': [], 'Earlier this week': [],
'更早': [], 'Earlier': [],
}; };
for (final session in sessions) { for (final session in sessions) {
final time = session.updated > 0 final time = session.updated > 0
@@ -424,12 +424,12 @@ class _SessionListPaneState extends State<SessionListPane> {
: DateTime.fromMillisecondsSinceEpoch(session.created); : DateTime.fromMillisecondsSinceEpoch(session.created);
final day = DateTime(time.year, time.month, time.day); final day = DateTime(time.year, time.month, time.day);
final key = day == today final key = day == today
? '今天' ? 'Today'
: day == yesterday : day == yesterday
? '昨天' ? 'Yesterday'
: day.isAfter(weekAgo) : day.isAfter(weekAgo)
? '本周早些时候' ? 'Earlier this week'
: '更早'; : 'Earlier';
buckets[key]!.add(session); buckets[key]!.add(session);
} }
return [ return [
@@ -459,7 +459,7 @@ class _SessionListPaneState extends State<SessionListPane> {
size: 13, color: Theme.of(context).hintColor), size: 13, color: Theme.of(context).hintColor),
const SizedBox(width: 5), const SizedBox(width: 5),
Expanded( Expanded(
child: AppText('已置顶', child: AppText('Pinned',
style: TextStyle( style: TextStyle(
fontSize: 12.5, fontSize: 12.5,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@@ -478,25 +478,25 @@ class _SessionListPaneState extends State<SessionListPane> {
Widget _draftRow(SessionDraft draft) { Widget _draftRow(SessionDraft draft) {
final theme = Theme.of(context); final theme = Theme.of(context);
final label = draft.firstLine.isEmpty ? tr('新会话') : draft.firstLine; final label = draft.firstLine.isEmpty ? tr('New session') : draft.firstLine;
final project = _app.projectLabelFor(draft.directory); final project = _app.projectLabelFor(draft.directory);
return ListTile( return ListTile(
selected: _app.draftOpen, selected: _app.draftOpen,
leading: Icon(Icons.edit_outlined, size: 18, color: theme.hintColor), leading: Icon(Icons.edit_outlined, size: 18, color: theme.hintColor),
title: AppText( title: Text(
label, label,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontStyle: FontStyle.italic), style: const TextStyle(fontStyle: FontStyle.italic),
), ),
subtitle: AppText( subtitle: AppText(
project.isEmpty ? '草稿' : trArgs('草稿 · {0}', [project]), project.isEmpty ? 'Draft' : trArgs('Draft · {0}', [project]),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
trailing: IconButton( trailing: IconButton(
icon: const Icon(Icons.close, size: 18), icon: const Icon(Icons.close, size: 18),
tooltip: tr('丢弃草稿'), tooltip: tr('Discard draft'),
onPressed: () => _app.discardDraft(), onPressed: () => _app.discardDraft(),
), ),
onTap: () { onTap: () {
@@ -569,21 +569,21 @@ class _SessionListPaneState extends State<SessionListPane> {
SlidableAction( SlidableAction(
onPressed: (_) => _app.togglePin(session), onPressed: (_) => _app.togglePin(session),
icon: Icons.push_pin_outlined, icon: Icons.push_pin_outlined,
label: session.isPinned ? tr('取消置顶') : tr('置顶'), label: session.isPinned ? tr('Unpin') : tr('Pin'),
backgroundColor: scheme.secondaryContainer, backgroundColor: scheme.secondaryContainer,
foregroundColor: scheme.onSecondaryContainer, foregroundColor: scheme.onSecondaryContainer,
), ),
SlidableAction( SlidableAction(
onPressed: (_) => _archive(session, archived), onPressed: (_) => _archive(session, archived),
icon: archived ? Icons.unarchive_outlined : Icons.archive_outlined, icon: archived ? Icons.unarchive_outlined : Icons.archive_outlined,
label: archived ? tr('取消归档') : tr('归档'), label: archived ? tr('Unarchive') : tr('Archive'),
backgroundColor: scheme.surfaceContainerHighest, backgroundColor: scheme.surfaceContainerHighest,
foregroundColor: scheme.onSurface, foregroundColor: scheme.onSurface,
), ),
SlidableAction( SlidableAction(
onPressed: (_) => _confirmDelete(session), onPressed: (_) => _confirmDelete(session),
icon: Icons.delete_outline, icon: Icons.delete_outline,
label: tr('删除'), label: tr('Delete'),
backgroundColor: scheme.errorContainer, backgroundColor: scheme.errorContainer,
foregroundColor: scheme.onErrorContainer, foregroundColor: scheme.onErrorContainer,
), ),
@@ -615,7 +615,7 @@ class _SessionListPaneState extends State<SessionListPane> {
? Icons.expand_more ? Icons.expand_more
: Icons.chevron_right, : Icons.chevron_right,
size: 18), size: 18),
tooltip: expanded ? tr('收起子代理') : tr('展开子代理'), tooltip: expanded ? tr('Collapse subagents') : tr('Expand subagents'),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
constraints: constraints:
@@ -629,8 +629,8 @@ class _SessionListPaneState extends State<SessionListPane> {
}), }),
), ),
), ),
title: AppText( title: Text(
session.title.isEmpty ? '(无标题会话)' : session.title, session.title.isEmpty ? tr('(Untitled session)') : session.title,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@@ -638,8 +638,8 @@ class _SessionListPaneState extends State<SessionListPane> {
fontWeight: selected ? FontWeight.w600 : FontWeight.w400, fontWeight: selected ? FontWeight.w600 : FontWeight.w400,
), ),
), ),
subtitle: AppText( subtitle: Text(
child ? trArgs('子代理 · {0}', [_subtitle(session)]) : _subtitle(session), child ? trArgs('Subagent · {0}', [_subtitle(session)]) : _subtitle(session),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis), overflow: TextOverflow.ellipsis),
trailing: Row( trailing: Row(
@@ -696,22 +696,22 @@ class _SessionListPaneState extends State<SessionListPane> {
case 'copy': case 'copy':
Clipboard.setData(ClipboardData(text: session.id)); Clipboard.setData(ClipboardData(text: session.id));
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: AppText('已复制会话 ID'))); const SnackBar(content: AppText('Session ID copied')));
break; break;
} }
}, },
itemBuilder: (_) => [ itemBuilder: (_) => [
if (!archived) ...[ if (!archived) ...[
const PopupMenuItem(value: 'rename', child: AppText('重命名')), const PopupMenuItem(value: 'rename', child: AppText('Rename')),
PopupMenuItem( PopupMenuItem(
value: 'pin', value: 'pin',
child: AppText(session.isPinned ? '取消置顶' : '置顶')), child: AppText(session.isPinned ? 'Unpin' : 'Pin')),
], ],
PopupMenuItem( PopupMenuItem(
value: 'archive', value: 'archive',
child: AppText(archived ? '取消归档' : '归档')), child: AppText(archived ? 'Unarchive' : 'Archive')),
const PopupMenuItem(value: 'delete', child: AppText('删除')), const PopupMenuItem(value: 'delete', child: AppText('Delete')),
const PopupMenuItem(value: 'copy', child: AppText('复制会话 ID')), const PopupMenuItem(value: 'copy', child: AppText('Copy session ID')),
], ],
), ),
); );
@@ -731,7 +731,7 @@ class _SessionListPaneState extends State<SessionListPane> {
width: 16, width: 16,
height: 16, height: 16,
child: CircularProgressIndicator(strokeWidth: 2)) child: CircularProgressIndicator(strokeWidth: 2))
: const AppText('载入更多'), : const AppText('Load more'),
), ),
TextButton.icon( TextButton.icon(
icon: Icon( icon: Icon(
@@ -741,10 +741,10 @@ class _SessionListPaneState extends State<SessionListPane> {
size: 16), size: 16),
label: AppText( label: AppText(
_showArchived _showArchived
? '隐藏已归档' ? 'Hide archived'
: archivedCount == null : archivedCount == null
? '显示已归档' ? 'Show archived'
: trArgs('显示已归档 ({0})', [archivedCount]), : trArgs('Show archived ({0})', [archivedCount]),
style: const TextStyle(fontSize: 12.5), style: const TextStyle(fontSize: 12.5),
), ),
onPressed: app.archivedLoading ? null : _toggleArchived, onPressed: app.archivedLoading ? null : _toggleArchived,
@@ -765,7 +765,7 @@ class _SessionListPaneState extends State<SessionListPane> {
app.archivedSessions.isEmpty) app.archivedSessions.isEmpty)
Padding( Padding(
padding: const EdgeInsets.only(bottom: 8), padding: const EdgeInsets.only(bottom: 8),
child: AppText('没有已归档的会话', child: AppText('No archived sessions',
style: TextStyle(fontSize: 12, color: scheme.outline)), style: TextStyle(fontSize: 12, color: scheme.outline)),
), ),
], ],
@@ -785,7 +785,7 @@ class _SessionListPaneState extends State<SessionListPane> {
final parts = <String>[]; final parts = <String>[];
if (s.agent.isNotEmpty) parts.add(s.agent); if (s.agent.isNotEmpty) parts.add(s.agent);
final children = _childrenOf(s).length; final children = _childrenOf(s).length;
if (children > 0) parts.add(trArgs('{0} 个子代理', [children])); if (children > 0) parts.add(trArgs('{0} subagents', [children]));
if (s.model != null) parts.add(_app.modelName(s.model)); if (s.model != null) parts.add(_app.modelName(s.model));
if (s.updated > 0) { if (s.updated > 0) {
final t = DateTime.fromMillisecondsSinceEpoch(s.updated); final t = DateTime.fromMillisecondsSinceEpoch(s.updated);
@@ -812,18 +812,18 @@ class _SessionListPaneState extends State<SessionListPane> {
showDialog( showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: const AppText('重命名'), title: const AppText('Rename'),
content: TextField(controller: ctrl, autofocus: true), content: TextField(controller: ctrl, autofocus: true),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
child: const AppText('取消')), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
_app.client?.updateSession(s.id, title: ctrl.text); _app.client?.updateSession(s.id, title: ctrl.text);
}, },
child: const AppText('保存'), child: const AppText('Save'),
), ),
], ],
), ),
@@ -834,12 +834,12 @@ class _SessionListPaneState extends State<SessionListPane> {
showDialog( showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: const AppText('删除会话?'), title: const AppText('Delete session?'),
content: AppText(trArgs('“{0}”及其子会话将被删除,且无法恢复。', [s.title])), content: AppText(trArgs('“{0}” and its subagent sessions will be deleted permanently.', [s.title])),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
child: const AppText('取消')), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
@@ -848,7 +848,7 @@ class _SessionListPaneState extends State<SessionListPane> {
_app.archivedSessions.removeWhere((x) => x.id == s.id); _app.archivedSessions.removeWhere((x) => x.id == s.id);
_app.touch(); _app.touch();
}, },
child: const AppText('删除'), child: const AppText('Delete'),
), ),
], ],
), ),
@@ -865,20 +865,20 @@ class _SessionListPaneState extends State<SessionListPane> {
children: [ children: [
const Padding( const Padding(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
child: AppText('服务器', child: AppText('Servers',
style: style:
TextStyle(fontSize: 18, fontWeight: FontWeight.bold)), TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
), ),
for (final c in app.connections) ...[ for (final c in app.connections) ...[
ListTile( ListTile(
title: AppText(c.label), title: Text(c.label),
subtitle: AppText(c.isRelay subtitle: Text(c.isRelay
? trArgs('经由 Relay · {0}', [c.serverId]) ? trArgs('Via Relay · {0}', [c.serverId])
: (c.proxy.isEmpty : (c.proxy.isEmpty
? c.url ? c.url
: trArgs('{0}\n经由 {1}', [c.url, c.proxy]))), : trArgs('{0}\nvia {1}', [c.url, c.proxy]))),
trailing: app.conn?.id == c.id trailing: app.conn?.id == c.id
? AppText('已连接', ? AppText('Connected',
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary)) color: Theme.of(context).colorScheme.primary))
: null, : null,
@@ -890,7 +890,7 @@ class _SessionListPaneState extends State<SessionListPane> {
], ],
ListTile( ListTile(
leading: const Icon(Icons.add), leading: const Icon(Icons.add),
title: const AppText('添加服务器'), title: const AppText('Add server'),
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);
Navigator.of(context).push(MaterialPageRoute( Navigator.of(context).push(MaterialPageRoute(
@@ -900,8 +900,8 @@ class _SessionListPaneState extends State<SessionListPane> {
), ),
ListTile( ListTile(
leading: const Icon(Icons.qr_code_2), leading: const Icon(Icons.qr_code_2),
title: const AppText('配对链接'), title: const AppText('Pairing link'),
subtitle: const AppText('直连地址或 OpenChamber Relay'), subtitle: const AppText('Direct address or OpenChamber Relay'),
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);
showPairingDialog(context, app); showPairingDialog(context, app);
@@ -910,7 +910,7 @@ class _SessionListPaneState extends State<SessionListPane> {
if (app.client != null) if (app.client != null)
ListTile( ListTile(
leading: const Icon(Icons.link_off), leading: const Icon(Icons.link_off),
title: const AppText('断开当前连接'), title: const AppText('Disconnect'),
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);
app.disconnect(); app.disconnect();
+110 -111
View File
@@ -21,52 +21,52 @@ class SettingsScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const AppText('设置')), appBar: AppBar(title: const AppText('Settings')),
body: ListView( body: ListView(
padding: const EdgeInsets.only(top: 4, bottom: 32), padding: const EdgeInsets.only(top: 4, bottom: 32),
children: [ children: [
const _SectionHeader('常规'), const _SectionHeader('General'),
_Section(children: [ _Section(children: [
_NavTile( _NavTile(
icon: Icons.translate, icon: Icons.translate,
title: '语言', title: 'Language',
subtitle: '跟随系统、中文或 English', subtitle: 'Follow the system, Chinese or English',
builder: (_) => const LanguageSettingsPage(), builder: (_) => const LanguageSettingsPage(),
), ),
_NavTile( _NavTile(
icon: Icons.tune, icon: Icons.tune,
title: '通用', title: 'Agent tools',
subtitle: '智能体工具与记忆', subtitle: 'Agent tools and memory',
builder: (_) => GeneralSettingsPage(app: app), builder: (_) => GeneralSettingsPage(app: app),
), ),
_NavTile( _NavTile(
icon: Icons.chat_bubble_outline, icon: Icons.chat_bubble_outline,
title: '聊天', title: 'Chat',
subtitle: '追问处理行为', subtitle: 'Follow-up behavior',
builder: (_) => ChatSettingsPage(app: app), builder: (_) => ChatSettingsPage(app: app),
), ),
]), ]),
const _SectionHeader('外观', note: '仅当前设备生效,不同步到服务器'), const _SectionHeader('Appearance', note: 'Applies to this device only; not synced to the server'),
_Section(children: [ _Section(children: [
_NavTile( _NavTile(
icon: Icons.palette_outlined, icon: Icons.palette_outlined,
title: '主题', title: 'Theme',
subtitle: '主题模式与主题色', subtitle: 'Theme mode and color',
builder: (_) => const ThemeSettingsPage(), builder: (_) => const ThemeSettingsPage(),
), ),
_NavTile( _NavTile(
icon: Icons.pets_outlined, icon: Icons.pets_outlined,
title: '宠物', title: 'Pet',
subtitle: '导入、启用与大小', subtitle: 'Import, enable and size',
builder: (_) => const PetSettingsPage(), builder: (_) => const PetSettingsPage(),
), ),
]), ]),
const _SectionHeader('帮助与关于'), const _SectionHeader('Help & about'),
_Section(children: [ _Section(children: [
_NavTile( _NavTile(
icon: Icons.info_outline, icon: Icons.info_outline,
title: '关于', title: 'About',
subtitle: '版本、服务端与开源许可', subtitle: 'Version, server and open-source licenses',
builder: (_) => AboutSettingsPage(app: app), builder: (_) => AboutSettingsPage(app: app),
), ),
]), ]),
@@ -123,7 +123,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: AppText( content: AppText(
trArgs('保存失败:{0}', [app.lastError ?? tr('未知错误')]))), trArgs('Couldn\'t save: {0}', [app.lastError ?? tr('Unknown error')]))),
); );
app.clearLastError(); app.clearLastError();
} }
@@ -133,32 +133,32 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar(title: const AppText('通用')), appBar: AppBar(title: const AppText('Agent tools')),
body: ListenableBuilder( body: ListenableBuilder(
listenable: app, listenable: app,
builder: (context, _) => ListView( builder: (context, _) => ListView(
padding: const EdgeInsets.only(top: 4, bottom: 32), padding: const EdgeInsets.only(top: 4, bottom: 32),
children: [ children: [
const _SectionHeader('在聊天中'), const _SectionHeader('In chat'),
_Section(children: [ _Section(children: [
_switch( _switch(
icon: Icons.bar_chart, icon: Icons.bar_chart,
title: '图表和原型', title: 'Charts and prototypes',
subtitle: '让智能体在聊天中展示图表、表格、示意图和界面草图(与你的文件隔离),并请你在其中选择一个选项。', subtitle: 'Let the agent show charts, tables, diagrams and UI sketches in chat (isolated from your files) and ask you to pick one of them.',
value: app.renderToolEnabled, value: app.renderToolEnabled,
key: 'agentRenderToolEnabled', key: 'agentRenderToolEnabled',
), ),
_switch( _switch(
icon: Icons.image_outlined, icon: Icons.image_outlined,
title: '图像', title: 'Images',
subtitle: '让智能体用你选择的模型生成和编辑图像,费用由该模型的提供商收取。', subtitle: 'Let the agent generate and edit images with the model you choose; the model\'s provider charges for it.',
value: app.imageToolEnabled, value: app.imageToolEnabled,
key: 'agentImageToolEnabled', key: 'agentImageToolEnabled',
), ),
if (app.imageToolEnabled) if (app.imageToolEnabled)
ListTile( ListTile(
contentPadding: const EdgeInsets.fromLTRB(52, 0, 16, 4), contentPadding: const EdgeInsets.fromLTRB(52, 0, 16, 4),
title: const AppText('图像模型'), title: const AppText('Image model'),
subtitle: AppText(_imageModelName(), subtitle: AppText(_imageModelName(),
maxLines: 1, overflow: TextOverflow.ellipsis), maxLines: 1, overflow: TextOverflow.ellipsis),
trailing: const Icon(Icons.chevron_right, size: 20), trailing: const Icon(Icons.chevron_right, size: 20),
@@ -166,26 +166,26 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
), ),
_switch( _switch(
icon: Icons.shield_outlined, icon: Icons.shield_outlined,
title: '密钥', title: 'Secrets',
subtitle: '允许智能体在聊天中的私密卡片上向你索取 API 密钥、令牌或密码。值不会进入对话。', subtitle: 'Let the agent ask you for API keys, tokens or passwords on a private card in chat. Values never enter the conversation.',
value: app.secretToolEnabled, value: app.secretToolEnabled,
key: 'agentSecretToolEnabled', key: 'agentSecretToolEnabled',
), ),
_switch( _switch(
icon: Icons.notifications_none, icon: Icons.notifications_none,
title: '通知', title: 'Notifications',
subtitle: '工作完成或卡住时,智能体会通知你。', subtitle: 'The agent notifies you when work finishes or gets stuck.',
value: app.notifyToolEnabled, value: app.notifyToolEnabled,
key: 'agentNotifyToolEnabled', key: 'agentNotifyToolEnabled',
), ),
]), ]),
const _SectionHeader('智能体知道的内容'), const _SectionHeader('What the agent knows'),
_Section(children: [ _Section(children: [
if (app.memoryToolsAvailable) ...[ if (app.memoryToolsAvailable) ...[
_switch( _switch(
icon: Icons.psychology_outlined, icon: Icons.psychology_outlined,
title: '记忆', title: 'Memory',
subtitle: '跨会话记住关于你和每个项目的事实。', subtitle: 'Remember facts about you and each project across sessions.',
value: app.memoryToolEnabled, value: app.memoryToolEnabled,
key: 'agentMemoryToolEnabled', key: 'agentMemoryToolEnabled',
), ),
@@ -193,15 +193,15 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
], ],
_switch( _switch(
icon: Icons.sticky_note_2_outlined, icon: Icons.sticky_note_2_outlined,
title: '项目知识', title: 'Project knowledge',
subtitle: '让智能体读取并更新项目的笔记、待办和计划。', subtitle: 'Let the agent read and update the project\'s notes, todos and plans.',
value: app.knowledgeToolEnabled, value: app.knowledgeToolEnabled,
key: 'agentKnowledgeToolEnabled', key: 'agentKnowledgeToolEnabled',
), ),
_switch( _switch(
icon: Icons.insert_chart_outlined, icon: Icons.insert_chart_outlined,
title: '用量限额', title: 'Usage limits',
subtitle: '让智能体查看各提供商的限额及重置时间。', subtitle: 'Let the agent check each provider\'s limits and reset times.',
value: app.usageToolEnabled, value: app.usageToolEnabled,
key: 'agentUsageToolEnabled', key: 'agentUsageToolEnabled',
), ),
@@ -230,7 +230,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
String _imageModelName() { String _imageModelName() {
final value = app.imageModel; final value = app.imageModel;
if (value.isEmpty) return '未选择'; if (value.isEmpty) return 'Not selected';
for (final m in _imageModels ?? const <ModelInfo>[]) { for (final m in _imageModels ?? const <ModelInfo>[]) {
if ('${m.providerId}/${m.id}' == value) return m.name; if ('${m.providerId}/${m.id}' == value) return m.name;
} }
@@ -242,7 +242,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
List<Widget> _dreaming(ThemeData theme) { List<Widget> _dreaming(ThemeData theme) {
final variants = _dreamingVariants(); final variants = _dreamingVariants();
final name = app.memoryDreamingModel.isEmpty final name = app.memoryDreamingModel.isEmpty
? '默认模型' ? 'Default model'
: (app.modelNames[app.memoryDreamingModel] ?? app.memoryDreamingModel); : (app.modelNames[app.memoryDreamingModel] ?? app.memoryDreamingModel);
return [ return [
InkWell( InkWell(
@@ -257,10 +257,10 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
onChanged: (v) => onChanged: (v) =>
_save('agentMemoryDreamingEnabled', v ?? false), _save('agentMemoryDreamingEnabled', v ?? false),
), ),
Expanded(child: AppText('整理记忆')), Expanded(child: AppText('Tidy memory')),
IconButton( IconButton(
icon: const Icon(Icons.info_outline, size: 18), icon: const Icon(Icons.info_outline, size: 18),
tooltip: tr('整理记忆'), tooltip: tr('Tidy memory'),
onPressed: _dreamingInfo, onPressed: _dreamingInfo,
), ),
], ],
@@ -279,7 +279,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
), ),
child: AppText(name, child: Text(name,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 13)), style: const TextStyle(fontSize: 13)),
@@ -295,9 +295,9 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
style: TextStyle( style: TextStyle(
fontSize: 13, color: theme.colorScheme.onSurface), fontSize: 13, color: theme.colorScheme.onSurface),
items: [ items: [
const DropdownMenuItem(value: '', child: AppText('默认')), const DropdownMenuItem(value: '', child: AppText('Default')),
for (final v in variants) for (final v in variants)
DropdownMenuItem(value: v, child: AppText(v)), DropdownMenuItem(value: v, child: Text(v)),
], ],
onChanged: (v) => _save('agentMemoryDreamingVariant', v ?? ''), onChanged: (v) => _save('agentMemoryDreamingVariant', v ?? ''),
), ),
@@ -321,12 +321,12 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
await showDialog<void>( await showDialog<void>(
context: context, context: context,
builder: (dialog) => AlertDialog( builder: (dialog) => AlertDialog(
title: const AppText('整理记忆'), title: const AppText('Tidy memory'),
content: const AppText( content: const AppText(
'每天一次,在没有会话运行时,智能体会在后台整理记忆:合并重复条目,删除已过时或项目文档中已有的内容。'), 'Once a day, when no session is running, the agent tidies memory in the background: merging duplicates and removing entries that are obsolete or already in the project docs.'),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(dialog), child: const AppText('知道了')), onPressed: () => Navigator.pop(dialog), child: const AppText('Got it')),
], ],
), ),
); );
@@ -337,14 +337,14 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
if (!mounted) return; if (!mounted) return;
if (models.isEmpty) { if (models.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: AppText('你的提供商中没有图像模型')), const SnackBar(content: AppText('Your provider has no image models')),
); );
return; return;
} }
final picked = await _chooseFromSheet( final picked = await _chooseFromSheet(
context: context, context: context,
title: '图像模型', title: 'Image model',
noneLabel: '不指定', noneLabel: 'None',
selected: app.imageModel, selected: app.imageModel,
options: [ options: [
for (final m in models) for (final m in models)
@@ -370,8 +370,8 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
if (!mounted) return; if (!mounted) return;
final picked = await _chooseFromSheet( final picked = await _chooseFromSheet(
context: context, context: context,
title: '整理记忆使用的模型', title: 'Model for tidying memory',
noneLabel: '默认模型', noneLabel: 'Default model',
selected: app.memoryDreamingModel, selected: app.memoryDreamingModel,
options: [ options: [
for (final m in app.modelList) for (final m in app.modelList)
@@ -451,14 +451,13 @@ class LanguageSettingsPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final l10n = L10n.instance; final l10n = L10n.instance;
return Scaffold( return Scaffold(
appBar: AppBar(title: const AppText('语言')), appBar: AppBar(title: const AppText('Language')),
body: ListenableBuilder( body: ListenableBuilder(
listenable: l10n, listenable: l10n,
builder: (context, _) { builder: (context, _) {
final english = l10n.isEnglish;
final systemName = l10n.locale.languageCode == 'zh' final systemName = l10n.locale.languageCode == 'zh'
? AppLanguage.zh.labelFor(english) ? l10n.languageLabel(AppLanguage.zh)
: AppLanguage.en.labelFor(english); : l10n.languageLabel(AppLanguage.en);
return ListView( return ListView(
padding: const EdgeInsets.only(top: 8, bottom: 32), padding: const EdgeInsets.only(top: 8, bottom: 32),
children: [ children: [
@@ -472,9 +471,9 @@ class LanguageSettingsPage extends StatelessWidget {
for (final choice in AppLanguage.values) for (final choice in AppLanguage.values)
RadioListTile<AppLanguage>( RadioListTile<AppLanguage>(
value: choice, value: choice,
title: AppText(choice.labelFor(english)), title: AppText(l10n.languageLabel(choice)),
subtitle: choice == AppLanguage.system subtitle: choice == AppLanguage.system
? AppText(trArgs('当前:{0}', [systemName])) ? AppText(trArgs('Current: {0}', [systemName]))
: null, : null,
), ),
], ],
@@ -483,7 +482,7 @@ class LanguageSettingsPage extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.fromLTRB(20, 12, 20, 0), padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),
child: AppText( child: AppText(
'界面文字与系统自带的日期、时间选择器会一起切换。', 'The UI text switches together with the system\'s date and time pickers.',
style: TextStyle( style: TextStyle(
fontSize: 12.5, fontSize: 12.5,
color: Theme.of(context).hintColor), color: Theme.of(context).hintColor),
@@ -519,7 +518,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar(title: const AppText('聊天')), appBar: AppBar(title: const AppText('Chat')),
body: ListenableBuilder( body: ListenableBuilder(
listenable: widget.app, listenable: widget.app,
builder: (context, _) { builder: (context, _) {
@@ -528,8 +527,8 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
padding: const EdgeInsets.only(top: 8, bottom: 32), padding: const EdgeInsets.only(top: 8, bottom: 32),
children: [ children: [
const ListTile( const ListTile(
title: AppText('追问处理行为'), title: AppText('Follow-up behavior'),
subtitle: AppText('运行中按发送时,消息默认怎么处理。与网页端设置同步。'), subtitle: AppText('What happens by default when you press send while a run is in progress. Synced with the web client\'s setting.'),
), ),
Padding( Padding(
padding: const EdgeInsets.fromLTRB(20, 0, 20, 6), padding: const EdgeInsets.fromLTRB(20, 0, 20, 6),
@@ -538,12 +537,12 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
runSpacing: 8, runSpacing: 8,
children: [ children: [
ChoiceChip( ChoiceChip(
label: const AppText('转向'), label: const AppText('Steer'),
selected: steer, selected: steer,
onSelected: (_) => _setFollowUp('steer'), onSelected: (_) => _setFollowUp('steer'),
), ),
ChoiceChip( ChoiceChip(
label: const AppText('排队'), label: const AppText('Queue'),
selected: !steer, selected: !steer,
onSelected: (_) => _setFollowUp('queue'), onSelected: (_) => _setFollowUp('queue'),
), ),
@@ -553,7 +552,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
Padding( Padding(
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8), padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
child: AppText( child: AppText(
steer ? '转向:在下一步加入当前回合,工作继续。' : '排队:等当前回合结束后再发送。', steer ? 'Steer: joins the current turn at the next step and work continues.' : 'Queue: sends after the current turn ends.',
style: TextStyle(fontSize: 12.5, color: theme.hintColor), style: TextStyle(fontSize: 12.5, color: theme.hintColor),
), ),
), ),
@@ -568,7 +567,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
final ok = await widget.app.setFollowUpBehavior(value); final ok = await widget.app.setFollowUpBehavior(value);
if (!ok && mounted) { if (!ok && mounted) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: AppText(widget.app.lastError ?? '保存失败')), SnackBar(content: AppText(widget.app.lastError ?? 'Couldn\'t save')),
); );
widget.app.clearLastError(); widget.app.clearLastError();
} }
@@ -581,16 +580,16 @@ class ThemeSettingsPage extends StatelessWidget {
const ThemeSettingsPage({super.key}); const ThemeSettingsPage({super.key});
static const _modes = [ static const _modes = [
(ThemeMode.system, '跟随系统'), (ThemeMode.system, 'Follow system'),
(ThemeMode.light, '浅色'), (ThemeMode.light, 'Light'),
(ThemeMode.dark, '深色'), (ThemeMode.dark, 'Dark'),
]; ];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final look = AppearancePrefs.instance; final look = AppearancePrefs.instance;
return Scaffold( return Scaffold(
appBar: AppBar(title: const AppText('主题')), appBar: AppBar(title: const AppText('Theme')),
body: ListenableBuilder( body: ListenableBuilder(
listenable: look, listenable: look,
builder: (context, _) { builder: (context, _) {
@@ -600,10 +599,10 @@ class ThemeSettingsPage extends StatelessWidget {
children: [ children: [
const Padding( const Padding(
padding: EdgeInsets.fromLTRB(20, 0, 20, 8), padding: EdgeInsets.fromLTRB(20, 0, 20, 8),
child: AppText('主题只保存在本机,不随服务器同步。', child: AppText('The theme is stored on this device only and does not sync with the server.',
style: TextStyle(fontSize: 12.5)), style: TextStyle(fontSize: 12.5)),
), ),
const _Label('主题模式'), const _Label('Theme mode'),
Padding( Padding(
padding: const EdgeInsets.fromLTRB(20, 0, 20, 12), padding: const EdgeInsets.fromLTRB(20, 0, 20, 12),
child: Wrap( child: Wrap(
@@ -619,7 +618,7 @@ class ThemeSettingsPage extends StatelessWidget {
], ],
), ),
), ),
const _Label('主题色'), const _Label('Accent color'),
Padding( Padding(
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8), padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
child: Wrap( child: Wrap(
@@ -644,7 +643,7 @@ class ThemeSettingsPage extends StatelessWidget {
return Semantics( return Semantics(
button: true, button: true,
selected: selected, selected: selected,
label: trArgs('主题色 {0}', [seed.toRadixString(16)]), label: trArgs('Accent color {0}', [seed.toRadixString(16)]),
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(22), borderRadius: BorderRadius.circular(22),
onTap: () => look.setSeedColor(seed), onTap: () => look.setSeedColor(seed),
@@ -690,7 +689,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar(title: const AppText('宠物')), appBar: AppBar(title: const AppText('Pet')),
body: ListenableBuilder( body: ListenableBuilder(
listenable: PetLibrary.instance, listenable: PetLibrary.instance,
builder: (context, _) { builder: (context, _) {
@@ -701,7 +700,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
children: [ children: [
const Padding( const Padding(
padding: EdgeInsets.fromLTRB(20, 0, 20, 8), padding: EdgeInsets.fromLTRB(20, 0, 20, 8),
child: AppText('默认不提供宠物;宠物包只存放在本机。', child: AppText('No pet is included; pet packs stay on this device.',
style: TextStyle(fontSize: 12.5)), style: TextStyle(fontSize: 12.5)),
), ),
if (pack == null) ..._empty(theme) else ..._loaded(theme, pack), if (pack == null) ..._empty(theme) else ..._loaded(theme, pack),
@@ -714,15 +713,15 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
List<Widget> _empty(ThemeData theme) => [ List<Widget> _empty(ThemeData theme) => [
const ListTile( const ListTile(
title: AppText('尚未导入宠物'), title: AppText('No pet imported'),
subtitle: AppText('导入一个宠物包(.zip)后,它会站在输入框上方。'), subtitle: AppText('Import a pet pack (.zip) and it will stand above the input box.'),
), ),
Padding( Padding(
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8), padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
child: FilledButton.tonalIcon( child: FilledButton.tonalIcon(
onPressed: _importPet, onPressed: _importPet,
icon: const Icon(Icons.file_upload_outlined, size: 18), icon: const Icon(Icons.file_upload_outlined, size: 18),
label: const AppText('导入宠物包'), label: const AppText('Import pet pack'),
), ),
), ),
]; ];
@@ -733,27 +732,27 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
[pack.author, pack.license].where((s) => s.trim().isNotEmpty).join(' · '); [pack.author, pack.license].where((s) => s.trim().isNotEmpty).join(' · ');
return [ return [
ListTile( ListTile(
title: AppText(pack.name.isEmpty ? pack.id : pack.name), title: Text(pack.name.isEmpty ? pack.id : pack.name),
subtitle: info.isEmpty subtitle: info.isEmpty
? null ? null
: AppText(info, maxLines: 2, overflow: TextOverflow.ellipsis), : Text(info, maxLines: 2, overflow: TextOverflow.ellipsis),
), ),
SwitchListTile( SwitchListTile(
title: const AppText('启用宠物'), title: const AppText('Enable pet'),
subtitle: const AppText('站在输入框上方,默认关闭'), subtitle: const AppText('Stands above the input box; off by default'),
value: library.enabled, value: library.enabled,
onChanged: (v) => library.setEnabled(v), onChanged: (v) => library.setEnabled(v),
), ),
const _Label('大小'), const _Label('Size'),
Padding( Padding(
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8), padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
child: Wrap( child: Wrap(
spacing: 8, spacing: 8,
children: [ children: [
for (final (size, label) in const [ for (final (size, label) in const [
(40.0, '小'), (40.0, 'Small'),
(52.0, '中'), (52.0, 'Medium'),
(64.0, '大'), (64.0, 'Large'),
]) ])
ChoiceChip( ChoiceChip(
label: AppText(label), label: AppText(label),
@@ -770,12 +769,12 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
FilledButton.tonalIcon( FilledButton.tonalIcon(
onPressed: _importPet, onPressed: _importPet,
icon: const Icon(Icons.swap_horiz, size: 18), icon: const Icon(Icons.swap_horiz, size: 18),
label: const AppText('更换宠物包'), label: const AppText('Change pet pack'),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
TextButton( TextButton(
onPressed: _confirmRemovePet, onPressed: _confirmRemovePet,
child: const AppText('移除'), child: const AppText('Remove'),
), ),
], ],
), ),
@@ -786,7 +785,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
Future<void> _importPet() async { Future<void> _importPet() async {
try { try {
final file = await FilePicker.pickFile( final file = await FilePicker.pickFile(
dialogTitle: tr('选择宠物包(.zip)'), dialogTitle: tr('Select a pet pack (.zip)'),
type: FileType.custom, type: FileType.custom,
allowedExtensions: const ['zip'], allowedExtensions: const ['zip'],
); );
@@ -797,12 +796,12 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: AppText(trArgs( content: AppText(trArgs(
'已导入 {0}', [pack.name.isEmpty ? pack.id : pack.name]))), 'Imported {0}', [pack.name.isEmpty ? pack.id : pack.name]))),
); );
} catch (e) { } catch (e) {
if (!mounted) return; if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: AppText(trArgs('导入失败:{0}', [e]))), SnackBar(content: AppText(trArgs('Import failed: {0}', [e]))),
); );
} }
} }
@@ -811,15 +810,15 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
final ok = await showDialog<bool>( final ok = await showDialog<bool>(
context: context, context: context,
builder: (dialog) => AlertDialog( builder: (dialog) => AlertDialog(
title: const AppText('移除宠物?'), title: const AppText('Remove pet?'),
content: const AppText('本机保存的宠物包会被删除。'), content: const AppText('The pet pack stored on this device will be deleted.'),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(dialog, false), onPressed: () => Navigator.pop(dialog, false),
child: const AppText('取消')), child: const AppText('Cancel')),
FilledButton( FilledButton(
onPressed: () => Navigator.pop(dialog, true), onPressed: () => Navigator.pop(dialog, true),
child: const AppText('移除')), child: const AppText('Remove')),
], ],
), ),
); );
@@ -873,11 +872,11 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
width: 14, height: 14, child: CircularProgressIndicator(strokeWidth: 1.6)); width: 14, height: 14, child: CircularProgressIndicator(strokeWidth: 1.6));
} }
final text = !_loaded final text = !_loaded
? '读取中…' ? 'Loading…'
: widget.app.client == null : widget.app.client == null
? '未连接' ? 'Not connected'
: value.isEmpty : value.isEmpty
? '未获取到' ? 'Not available'
: value; : value;
return AppText(text, return AppText(text,
style: TextStyle( style: TextStyle(
@@ -893,11 +892,11 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
final versions = _versions; final versions = _versions;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const AppText('关于'), title: const AppText('About'),
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Icons.refresh), icon: const Icon(Icons.refresh),
tooltip: tr('重新获取服务端版本'), tooltip: tr('Fetch the server version again'),
onPressed: _loading ? null : _load, onPressed: _loading ? null : _load,
), ),
], ],
@@ -927,7 +926,7 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
AppText('OpenChamber', AppText('OpenChamber',
style: theme.textTheme.titleLarge style: theme.textTheme.titleLarge
?.copyWith(fontWeight: FontWeight.w600)), ?.copyWith(fontWeight: FontWeight.w600)),
AppText('手机客户端', AppText('Mobile client',
style: TextStyle( style: TextStyle(
fontSize: 12.5, color: theme.hintColor)), fontSize: 12.5, color: theme.hintColor)),
], ],
@@ -936,27 +935,27 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
], ],
), ),
), ),
const _SectionHeader('应用'), const _SectionHeader('App'),
_Section(children: [ _Section(children: [
ListTile( ListTile(
leading: const Icon(Icons.tag, size: 20), leading: const Icon(Icons.tag, size: 20),
title: const AppText('版本'), title: const AppText('Version'),
trailing: AppText( trailing: AppText(
appVersion.isEmpty ? '未知' : appVersion, appVersion.isEmpty ? 'Unknown' : appVersion,
style: const TextStyle(fontSize: 13), style: const TextStyle(fontSize: 13),
), ),
), ),
ListTile( ListTile(
leading: const Icon(Icons.description_outlined, size: 20), leading: const Icon(Icons.description_outlined, size: 20),
title: const AppText('开源许可'), title: const AppText('Open-source licenses'),
subtitle: const AppText('本应用使用的第三方组件与它们的许可证'), subtitle: const AppText('Third-party components used by this app and their licenses'),
trailing: const Icon(Icons.chevron_right, size: 20), trailing: const Icon(Icons.chevron_right, size: 20),
onTap: () => Navigator.of(context).push(MaterialPageRoute( onTap: () => Navigator.of(context).push(MaterialPageRoute(
builder: (_) => const LicensesPage(), builder: (_) => const LicensesPage(),
)), )),
), ),
]), ]),
const _SectionHeader('服务端', note: '版本取自当前连接的服务器'), const _SectionHeader('Server', note: 'Version comes from the currently connected server'),
_Section(children: [ _Section(children: [
ListTile( ListTile(
leading: const Icon(Icons.terminal, size: 20), leading: const Icon(Icons.terminal, size: 20),
@@ -1015,7 +1014,7 @@ class _LicensesPageState extends State<LicensesPage> {
final theme = Theme.of(context); final theme = Theme.of(context);
final licenses = _licenses; final licenses = _licenses;
return Scaffold( return Scaffold(
appBar: AppBar(title: const AppText('开源许可')), appBar: AppBar(title: const AppText('Open-source licenses')),
body: licenses == null body: licenses == null
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: ListView.separated( : ListView.separated(
@@ -1028,7 +1027,7 @@ class _LicensesPageState extends State<LicensesPage> {
return Padding( return Padding(
padding: const EdgeInsets.fromLTRB(20, 14, 20, 14), padding: const EdgeInsets.fromLTRB(20, 14, 20, 14),
child: AppText( child: AppText(
'下面列出随本应用打包的第三方组件;点开可阅读完整许可证。', 'Third-party components bundled with this app are listed below; tap one to read its full license.',
style: style:
TextStyle(fontSize: 12.5, color: theme.hintColor), TextStyle(fontSize: 12.5, color: theme.hintColor),
), ),
@@ -1036,7 +1035,7 @@ class _LicensesPageState extends State<LicensesPage> {
} }
final name = licenses.keys.elementAt(i - 1); final name = licenses.keys.elementAt(i - 1);
return ListTile( return ListTile(
title: AppText(name), title: Text(name),
trailing: const Icon(Icons.chevron_right, size: 20), trailing: const Icon(Icons.chevron_right, size: 20),
onTap: () => Navigator.of(context).push(MaterialPageRoute( onTap: () => Navigator.of(context).push(MaterialPageRoute(
builder: (_) => _LicenseTextPage( builder: (_) => _LicenseTextPage(
@@ -1073,11 +1072,11 @@ class _LicenseTextPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: AppText(name)), appBar: AppBar(title: Text(name)),
body: SingleChildScrollView( body: SingleChildScrollView(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: SelectableText( child: SelectableText(
text.isEmpty ? tr('该组件没有附带许可证文本。') : text, text.isEmpty ? tr('This component has no license text.') : text,
style: const TextStyle(fontSize: 12, fontFamily: 'monospace', height: 1.45), style: const TextStyle(fontSize: 12, fontFamily: 'monospace', height: 1.45),
), ),
), ),
+18 -18
View File
@@ -121,20 +121,20 @@ class _TerminalPanelState extends State<TerminalPanel> {
ThemeData theme, TerminalTab tab, TerminalSessionState state) { ThemeData theme, TerminalTab tab, TerminalSessionState state) {
final scheme = theme.colorScheme; final scheme = theme.colorScheme;
final (label, color) = switch (state.link) { final (label, color) = switch (state.link) {
TerminalLinkState.idle => (tr('未启动'), theme.hintColor), TerminalLinkState.idle => (tr('Not started'), theme.hintColor),
TerminalLinkState.creating => (tr('正在创建…'), theme.hintColor), TerminalLinkState.creating => (tr('Creating…'), theme.hintColor),
TerminalLinkState.connecting => (tr('正在连接…'), theme.hintColor), TerminalLinkState.connecting => (tr('Connecting…'), theme.hintColor),
TerminalLinkState.reconnecting => TerminalLinkState.reconnecting =>
(tr('连接中断,正在重连…'), scheme.error), (tr('Connection lost, reconnecting…'), scheme.error),
TerminalLinkState.open => (tr('运行中'), scheme.primary), TerminalLinkState.open => (tr('Running'), scheme.primary),
TerminalLinkState.exited => (state.detail ?? tr('已退出'), theme.hintColor), TerminalLinkState.exited => (state.detail ?? tr('Exited'), theme.hintColor),
TerminalLinkState.error => (state.detail ?? tr('连接失败'), scheme.error), TerminalLinkState.error => (state.detail ?? tr('Connection failed'), scheme.error),
}; };
return Row( return Row(
children: [ children: [
Expanded( Expanded(
child: PopupMenuButton<int>( child: PopupMenuButton<int>(
tooltip: tr('切换终端'), tooltip: tr('Switch terminal'),
position: PopupMenuPosition.under, position: PopupMenuPosition.under,
onSelected: _onTabMenu, onSelected: _onTabMenu,
itemBuilder: (_) => [ itemBuilder: (_) => [
@@ -154,7 +154,7 @@ class _TerminalPanelState extends State<TerminalPanel> {
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
Expanded( Expanded(
child: AppText( child: Text(
_workspace.tabs[i].label, _workspace.tabs[i].label,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -170,7 +170,7 @@ class _TerminalPanelState extends State<TerminalPanel> {
children: [ children: [
Icon(Icons.add, size: 18), Icon(Icons.add, size: 18),
SizedBox(width: 10), SizedBox(width: 10),
AppText('新建终端'), AppText('New terminal'),
], ],
), ),
), ),
@@ -183,7 +183,7 @@ class _TerminalPanelState extends State<TerminalPanel> {
Icon(Icons.circle, size: 8, color: color), Icon(Icons.circle, size: 8, color: color),
const SizedBox(width: 6), const SizedBox(width: 6),
Flexible( Flexible(
child: AppText( child: Text(
tab.label, tab.label,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -193,7 +193,7 @@ class _TerminalPanelState extends State<TerminalPanel> {
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Flexible( Flexible(
child: AppText( child: Text(
'· $label', '· $label',
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -207,13 +207,13 @@ class _TerminalPanelState extends State<TerminalPanel> {
), ),
), ),
IconButton( IconButton(
tooltip: tr('键盘'), tooltip: tr('Keyboard'),
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
icon: const Icon(Icons.keyboard_outlined, size: 18), icon: const Icon(Icons.keyboard_outlined, size: 18),
onPressed: () => _focus.requestFocus(), onPressed: () => _focus.requestFocus(),
), ),
IconButton( IconButton(
tooltip: tr('重新启动'), tooltip: tr('Restart'),
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
icon: const Icon(Icons.restart_alt, size: 18), icon: const Icon(Icons.restart_alt, size: 18),
onPressed: state.link == TerminalLinkState.exited || onPressed: state.link == TerminalLinkState.exited ||
@@ -223,7 +223,7 @@ class _TerminalPanelState extends State<TerminalPanel> {
: null, : null,
), ),
PopupMenuButton<String>( PopupMenuButton<String>(
tooltip: tr('更多'), tooltip: tr('More'),
icon: const Icon(Icons.more_vert, size: 18), icon: const Icon(Icons.more_vert, size: 18),
onSelected: (value) { onSelected: (value) {
switch (value) { switch (value) {
@@ -236,8 +236,8 @@ class _TerminalPanelState extends State<TerminalPanel> {
} }
}, },
itemBuilder: (_) => const [ itemBuilder: (_) => const [
PopupMenuItem(value: 'clear', child: AppText('清屏')), PopupMenuItem(value: 'clear', child: AppText('Clear screen')),
PopupMenuItem(value: 'close', child: AppText('关闭此终端')), PopupMenuItem(value: 'close', child: AppText('Close this terminal')),
], ],
), ),
], ],
@@ -336,7 +336,7 @@ class _TerminalPanelState extends State<TerminalPanel> {
border: Border.all( border: Border.all(
color: active ? scheme.primary : Colors.transparent, width: 1), color: active ? scheme.primary : Colors.transparent, width: 1),
), ),
child: AppText( child: Text(
label, label,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
+39 -27
View File
@@ -175,7 +175,7 @@ class AppState extends ChangeNotifier {
/// The name of the connected server, for the sidebar footer. /// The name of the connected server, for the sidebar footer.
String get connectionName { String get connectionName {
final c = conn; final c = conn;
if (c == null) return tr('未连接'); if (c == null) return tr('Not connected');
final label = c.label.trim(); final label = c.label.trim();
if (label.isNotEmpty) return label; if (label.isNotEmpty) return label;
final host = Uri.tryParse(c.url)?.host ?? ''; final host = Uri.tryParse(c.url)?.host ?? '';
@@ -254,7 +254,7 @@ class AppState extends ChangeNotifier {
} catch (e) { } catch (e) {
if (client == cl) { if (client == cl) {
followUpBehavior = before; followUpBehavior = before;
_lastError = trArgs('保存失败:{0}', [e]); _lastError = trArgs('Couldn\'t save: {0}', [e]);
notifyListeners(); notifyListeners();
} }
return false; return false;
@@ -301,7 +301,7 @@ class AppState extends ChangeNotifier {
final payload = parsePairingLink(link); final payload = parsePairingLink(link);
if (payload == null) { if (payload == null) {
debugPrint('pair: invalid link (${link.length} chars)'); debugPrint('pair: invalid link (${link.length} chars)');
_lastError = tr('配对链接无效或已过期'); _lastError = tr('Pairing link is invalid or expired');
notifyListeners(); notifyListeners();
return false; return false;
} }
@@ -338,7 +338,7 @@ class AppState extends ChangeNotifier {
? const Duration(seconds: 30) ? const Duration(seconds: 30)
: const Duration(seconds: 15)); : const Duration(seconds: 15));
if (redeemed.token.isEmpty) { if (redeemed.token.isEmpty) {
throw ApiError(401, tr('服务器没有返回设备令牌')); throw ApiError(401, tr('Server did not return a device token'));
} }
final connection = _pairingConnection(candidate, payload, redeemed.response); final connection = _pairingConnection(candidate, payload, redeemed.response);
await storage.saveToken(connection.id, redeemed.token); await storage.saveToken(connection.id, redeemed.token);
@@ -359,7 +359,7 @@ class AppState extends ChangeNotifier {
} }
} }
busy = false; busy = false;
final message = friendlyConnectError(failure ?? tr('配对失败')); final message = friendlyConnectError(failure ?? tr('Pairing failed'));
debugPrint('pair: failed: $message'); debugPrint('pair: failed: $message');
error = message; error = message;
_lastError = message; _lastError = message;
@@ -390,7 +390,7 @@ class AppState extends ChangeNotifier {
if (candidate.isRelay) { if (candidate.isRelay) {
return Connection( return Connection(
id: existing?.id ?? Storage.newId(), id: existing?.id ?? Storage.newId(),
label: label.isNotEmpty ? label : (existing?.label ?? tr('Relay 服务器')), label: label.isNotEmpty ? label : (existing?.label ?? tr('Relay server')),
url: 'relay://${candidate.serverId}', url: 'relay://${candidate.serverId}',
relayUrl: candidate.relayUrl, relayUrl: candidate.relayUrl,
serverId: candidate.serverId, serverId: candidate.serverId,
@@ -419,7 +419,7 @@ class AppState extends ChangeNotifier {
if (c.isRelay) { if (c.isRelay) {
// A relay connection is created by pairing; a missing token means it // A relay connection is created by pairing; a missing token means it
// was never stored or was revoked. // was never stored or was revoked.
throw ApiError(401, tr('配对已失效,请重新配对')); throw ApiError(401, tr('Pairing expired, please pair again'));
} }
// No saved token: a passwordless server needs none. // No saved token: a passwordless server needs none.
try { try {
@@ -429,13 +429,13 @@ class AppState extends ChangeNotifier {
} }
} on ApiError { } on ApiError {
if (password.isEmpty) { if (password.isEmpty) {
throw ApiError(401, tr('需要密码或已保存的凭据')); throw ApiError(401, tr('Password or saved credentials required'));
} }
} }
if (token == null && password.isNotEmpty) { if (token == null && password.isNotEmpty) {
final res = await cl.login(password, await storage.installId()); final res = await cl.login(password, await storage.installId());
token = res['clientToken'] as String? ?? ''; token = res['clientToken'] as String? ?? '';
if (token.isEmpty) throw ApiError(401, tr('登录成功但没有返回令牌')); if (token.isEmpty) throw ApiError(401, tr('Signed in but no token was returned'));
await storage.saveToken(c.id, token); await storage.saveToken(c.id, token);
} }
} }
@@ -458,25 +458,25 @@ class AppState extends ChangeNotifier {
if (e is ApiError) { if (e is ApiError) {
if (e.status == 401 && if (e.status == 401 &&
e.message.toLowerCase().contains('invalid credentials')) { e.message.toLowerCase().contains('invalid credentials')) {
return tr('密码错误,请重试'); return tr('Wrong password, try again');
} }
return e.message; return e.message;
} }
if (e is ArgumentError) return e.message?.toString() ?? e.toString(); if (e is ArgumentError) return e.message?.toString() ?? e.toString();
if (e is TimeoutException) return tr('连接超时:检查服务器与代理地址'); if (e is TimeoutException) return tr('Connection timed out: check the server and proxy address');
final s = e.toString(); final s = e.toString();
if (e is SocketException) { if (e is SocketException) {
if (s.contains('Connection refused')) { if (s.contains('Connection refused')) {
return tr('连接被拒绝:服务器或代理未启动,或端口不对'); return tr('Connection refused: server or proxy not running, or wrong port');
} }
if (s.contains('Failed host lookup') || s.contains('nodename nor servname')) { if (s.contains('Failed host lookup') || s.contains('nodename nor servname')) {
return tr('无法解析地址:检查服务器或代理主机名'); return tr('Could not resolve address: check the server or proxy hostname');
} }
if (s.contains('Network is unreachable')) return tr('网络不可达'); if (s.contains('Network is unreachable')) return tr('Network unreachable');
if (s.contains('Connection closed') || s.contains('reset by peer')) { if (s.contains('Connection closed') || s.contains('reset by peer')) {
return tr('连接被断开:检查代理是否可用'); return tr('Connection closed: check whether the proxy works');
} }
return trArgs('网络错误:{0}', [s]); return trArgs('Network error: {0}', [s]);
} }
return s; return s;
} }
@@ -706,7 +706,7 @@ class AppState extends ChangeNotifier {
final local = [ final local = [
SlashItem( SlashItem(
name: 'compact', name: 'compact',
description: tr('使用 AI 压缩会话历史以减少上下文大小'), description: tr('Use AI to compact the session history and reduce context size'),
action: 'compact', action: 'compact',
), ),
]; ];
@@ -741,7 +741,7 @@ class AppState extends ChangeNotifier {
} }
String projectLabelFor(String directory) { String projectLabelFor(String directory) {
if (directory == chatTarget || isChatDirectory(directory)) return tr('聊天'); if (directory == chatTarget || isChatDirectory(directory)) return tr('Chat');
if (directory.isEmpty) return ''; if (directory.isEmpty) return '';
for (final project in projects) { for (final project in projects) {
if (samePath(project.canonical, directory)) return project.label; if (samePath(project.canonical, directory)) return project.label;
@@ -784,7 +784,7 @@ class AppState extends ChangeNotifier {
await openChat(session); await openChat(session);
return true; return true;
} catch (e) { } catch (e) {
_lastError = trArgs('无法打开子代理会话:{0}', [e]); _lastError = trArgs('Could not open the subagent session: {0}', [e]);
notifyListeners(); notifyListeners();
return false; return false;
} }
@@ -827,11 +827,11 @@ class AppState extends ChangeNotifier {
/// project scope. /// project scope.
Future<String> createChatDirectory() async { Future<String> createChatDirectory() async {
final cl = client; final cl = client;
if (cl == null) throw StateError(tr('未连接服务器')); if (cl == null) throw StateError(tr('Not connected to a server'));
if (chatsRoot == null || chatsRoot!.isEmpty) await refreshFsHome(); if (chatsRoot == null || chatsRoot!.isEmpty) await refreshFsHome();
final root = chatsRoot; final root = chatsRoot;
if (root == null || root.isEmpty) { if (root == null || root.isEmpty) {
throw StateError(tr('服务器没有提供聊天目录')); throw StateError(tr('Server did not provide a chat directory'));
} }
final now = DateTime.now(); final now = DateTime.now();
final date = '${now.year.toString().padLeft(4, '0')}-' final date = '${now.year.toString().padLeft(4, '0')}-'
@@ -1009,7 +1009,7 @@ class AppState extends ChangeNotifier {
} catch (e) { } catch (e) {
sendingDraft = false; sendingDraft = false;
current.error = trArgs( current.error = trArgs(
'无法创建聊天目录:{0}', [e is ApiError ? e.message : e]); 'Could not create the chat directory: {0}', [e is ApiError ? e.message : e]);
notifyListeners(); notifyListeners();
return; return;
} }
@@ -1119,7 +1119,7 @@ class AppState extends ChangeNotifier {
// Anything arriving means the stream is back (the server greets // Anything arriving means the stream is back (the server greets
// every connection with `server.connected`), so the "reconnecting" // every connection with `server.connected`), so the "reconnecting"
// banner has done its job. // banner has done its job.
if (error == tr('连接中断,正在重连…')) error = null; if (error == tr('Connection lost, reconnecting…')) error = null;
if (catchUp) { if (catchUp) {
catchUp = false; catchUp = false;
_resyncActivity(); _resyncActivity();
@@ -1137,7 +1137,7 @@ class AppState extends ChangeNotifier {
await done.future; await done.future;
if (client != cl || gen != _streamGen) return; if (client != cl || gen != _streamGen) return;
afterDrop = true; afterDrop = true;
error = tr('连接中断,正在重连…'); error = tr('Connection lost, reconnecting…');
notifyListeners(); notifyListeners();
await Future.delayed(const Duration(seconds: 2)); await Future.delayed(const Duration(seconds: 2));
} }
@@ -1486,6 +1486,7 @@ class ChatState extends ChangeNotifier {
try { try {
final page = await app.client!.listMessages(id, directory: dir); final page = await app.client!.listMessages(id, directory: dir);
_setMessages(page.data); _setMessages(page.data);
_recovered.clear();
// A desc page's `next` cursor points at the older side. The server also // A desc page's `next` cursor points at the older side. The server also
// hands out a cursor for a page that already holds everything, so a // hands out a cursor for a page that already holds everything, so a
// short page means there is nothing older. // short page means there is nothing older.
@@ -1789,7 +1790,7 @@ class ChatState extends ChangeNotifier {
type: 'user', type: 'user',
text: t, text: t,
created: DateTime.now().millisecondsSinceEpoch, created: DateTime.now().millisecondsSinceEpoch,
files: files?.map((f) => FileAttachment(f['name'] ?? tr('附件'), '')).toList() ?? const [], files: files?.map((f) => FileAttachment(f['name'] ?? tr('Attachment'), '')).toList() ?? const [],
)); ));
_sortMsgs(); _sortMsgs();
notifyListeners(); notifyListeners();
@@ -1823,7 +1824,7 @@ class ChatState extends ChangeNotifier {
type: 'user', type: 'user',
text: t, text: t,
created: DateTime.now().millisecondsSinceEpoch, created: DateTime.now().millisecondsSinceEpoch,
files: files?.map((f) => FileAttachment(f['name'] ?? tr('附件'), '')).toList() ?? const [], files: files?.map((f) => FileAttachment(f['name'] ?? tr('Attachment'), '')).toList() ?? const [],
)); ));
_sortMsgs(); _sortMsgs();
notifyListeners(); notifyListeners();
@@ -1858,7 +1859,7 @@ class ChatState extends ChangeNotifier {
delivery: delivery, delivery: delivery,
created: DateTime.now().millisecondsSinceEpoch, created: DateTime.now().millisecondsSinceEpoch,
files: files files: files
?.map((f) => FileAttachment(f['name'] ?? tr('附件'), '')) ?.map((f) => FileAttachment(f['name'] ?? tr('Attachment'), ''))
.toList() ?? .toList() ??
const [], const [],
); );
@@ -1995,8 +1996,19 @@ class ChatState extends ChangeNotifier {
// ------------------------------------------------------------ events // ------------------------------------------------------------ events
/// Assistant messages whose turn we already fetched once after seeing an
/// event for a message the transcript did not have yet.
final Set<String> _recovered = {};
void handleEvent(String type, Map<String, dynamic> data, int created) { void handleEvent(String type, Map<String, dynamic> data, int created) {
final mid = data['assistantMessageID'] as String?; final mid = data['assistantMessageID'] as String?;
if (mid != null && !byId.containsKey(mid) && _recovered.add(mid)) {
// The turn began while the event stream was down: its start event is
// gone, so neither the user prompt nor the assistant message is in the
// transcript. The delta events alone would stitch an answer without
// them; take the tail from the server once instead.
reloadTail();
}
if (mid != null) { if (mid != null) {
_ensureAssistant(mid, created); _ensureAssistant(mid, created);
} }
+2 -2
View File
@@ -170,7 +170,7 @@ class Storage {
final entry = (await _terminalMap(connectionId))[directory]; final entry = (await _terminalMap(connectionId))[directory];
if (entry is String && entry.isNotEmpty) { if (entry is String && entry.isNotEmpty) {
return SavedTerminalTabs( return SavedTerminalTabs(
[SavedTerminalTab(entry, tr('终端 1'))], entry); [SavedTerminalTab(entry, tr('Terminal 1'))], entry);
} }
if (entry is! Map) return null; if (entry is! Map) return null;
final rawTabs = entry['tabs']; final rawTabs = entry['tabs'];
@@ -182,7 +182,7 @@ class Storage {
final label = raw['label']; final label = raw['label'];
if (id is! String || id.isEmpty) continue; if (id is! String || id.isEmpty) continue;
tabs.add(SavedTerminalTab( tabs.add(SavedTerminalTab(
id, label is String && label.trim().isNotEmpty ? label : tr('终端'))); id, label is String && label.trim().isNotEmpty ? label : tr('Terminal')));
} }
if (tabs.isEmpty) return null; if (tabs.isEmpty) return null;
final active = entry['active']; final active = entry['active'];
+6 -6
View File
@@ -122,7 +122,7 @@ class TerminalWorkspace extends ChangeNotifier {
while (used.contains(n)) { while (used.contains(n)) {
n++; n++;
} }
return trArgs('终端 {0}', [n]); return trArgs('Terminal {0}', [n]);
} }
Future<SavedTerminalTabs?> _savedTabs() async { Future<SavedTerminalTabs?> _savedTabs() async {
@@ -434,8 +434,8 @@ class TerminalSessionState extends ChangeNotifier {
if (event.status == 'exited') { if (event.status == 'exited') {
_set(TerminalLinkState.exited, _set(TerminalLinkState.exited,
detail: event.exitCode == null detail: event.exitCode == null
? tr('已退出') ? tr('Exited')
: trArgs('退出码 {0}', [event.exitCode])); : trArgs('Exit code {0}', [event.exitCode]));
} }
break; break;
case 'restarted': case 'restarted':
@@ -449,8 +449,8 @@ class TerminalSessionState extends ChangeNotifier {
case 'exit': case 'exit':
_set(TerminalLinkState.exited, _set(TerminalLinkState.exited,
detail: event.exitCode == null detail: event.exitCode == null
? tr('已退出') ? tr('Exited')
: trArgs('退出码 {0}', [event.exitCode])); : trArgs('Exit code {0}', [event.exitCode]));
break; break;
case 'error': case 'error':
if (event.fatal) { if (event.fatal) {
@@ -461,7 +461,7 @@ class TerminalSessionState extends ChangeNotifier {
_recoverMissing(); _recoverMissing();
} else { } else {
_set(TerminalLinkState.error, _set(TerminalLinkState.error,
detail: event.message ?? event.code ?? tr('终端连接失败')); detail: event.message ?? event.code ?? tr('Terminal connection failed'));
} }
} }
break; break;
+2 -2
View File
@@ -36,7 +36,7 @@ Future<List<ComposerAttachment>> pickComposerAttachments(
if (bytes.length > 10 * 1024 * 1024) { if (bytes.length > 10 * 1024 * 1024) {
if (context.mounted) { if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: AppText('附件不能超过 10MB'))); const SnackBar(content: AppText('Attachments cannot be larger than 10 MB')));
} }
continue; continue;
} }
@@ -84,7 +84,7 @@ class AttachmentTray extends StatelessWidget {
: const Icon(Icons.insert_drive_file, size: 16), : const Icon(Icons.insert_drive_file, size: 16),
label: ConstrainedBox( label: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 160), constraints: const BoxConstraints(maxWidth: 160),
child: AppText(items[i].name, child: Text(items[i].name,
maxLines: 1, overflow: TextOverflow.ellipsis), maxLines: 1, overflow: TextOverflow.ellipsis),
), ),
onDeleted: () => onRemove(i), onDeleted: () => onRemove(i),
+4 -4
View File
@@ -247,8 +247,8 @@ class DiffView extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: AppText( child: Text(
file.path ?? trArgs('文件 {0}', [fileIndex + 1]), file.path ?? trArgs('File {0}', [fileIndex + 1]),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@@ -279,7 +279,7 @@ class DiffView extends StatelessWidget {
rows.add(Container( rows.add(Container(
color: background, color: background,
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 1), padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 1),
child: AppText( child: Text(
line.text.isEmpty ? ' ' : line.text, line.text.isEmpty ? ' ' : line.text,
style: mono.copyWith(color: foreground), style: mono.copyWith(color: foreground),
), ),
@@ -290,7 +290,7 @@ class DiffView extends StatelessWidget {
rows.add(Container( rows.add(Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5), padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
child: AppText( child: AppText(
trArgs('仅显示前 {0} 行,共 {1} 行', [maxLines, total]), trArgs('Showing the first {0} of {1} lines', [maxLines, total]),
style: TextStyle(fontSize: 11, color: theme.hintColor), style: TextStyle(fontSize: 11, color: theme.hintColor),
), ),
)); ));
+4 -4
View File
@@ -31,7 +31,7 @@ class ModelPill extends StatelessWidget {
info.variants.contains(model!.variant) info.variants.contains(model!.variant)
? model!.variant ? model!.variant
: null; : null;
final name = model == null ? '模型' : app.modelName(model!); final name = model == null ? 'Model' : app.modelName(model!);
final label = effort == null ? name : '$name · ${effortLabel(effort)}'; final label = effort == null ? name : '$name · ${effortLabel(effort)}';
return _Pill( return _Pill(
icon: Icons.smart_toy_outlined, icon: Icons.smart_toy_outlined,
@@ -90,7 +90,7 @@ class ModeChip extends StatelessWidget {
children: [ children: [
const Padding( const Padding(
padding: EdgeInsets.fromLTRB(20, 4, 20, 8), padding: EdgeInsets.fromLTRB(20, 4, 20, 8),
child: AppText('模式', child: AppText('Mode',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700)), style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700)),
), ),
for (final id in ids) for (final id in ids)
@@ -105,7 +105,7 @@ class ModeChip extends StatelessWidget {
fontWeight: id == current ? FontWeight.w700 : FontWeight.w400, fontWeight: id == current ? FontWeight.w700 : FontWeight.w400,
), ),
), ),
subtitle: AppText(id == 'plan' ? '先规划,不改动文件' : '直接构建', subtitle: AppText(id == 'plan' ? 'Plan first without changing files' : 'Build directly',
style: const TextStyle(fontSize: 12)), style: const TextStyle(fontSize: 12)),
trailing: id == current trailing: id == current
? Icon(Icons.check, size: 20, color: scheme.primary) ? Icon(Icons.check, size: 20, color: scheme.primary)
@@ -151,7 +151,7 @@ class _Pill extends StatelessWidget {
Icon(icon, size: 14, color: theme.hintColor), Icon(icon, size: 14, color: theme.hintColor),
const SizedBox(width: 4), const SizedBox(width: 4),
Flexible( Flexible(
child: AppText( child: Text(
label, label,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
+14 -14
View File
@@ -70,7 +70,7 @@ class _PickerSheetState extends State<_PickerSheet> {
children: [ children: [
const Padding( const Padding(
padding: EdgeInsets.fromLTRB(12, 12, 12, 4), padding: EdgeInsets.fromLTRB(12, 12, 12, 4),
child: AppText('选择模型', child: AppText('Select model',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)), style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
), ),
Padding( Padding(
@@ -78,7 +78,7 @@ class _PickerSheetState extends State<_PickerSheet> {
child: TextField( child: TextField(
onChanged: (v) => setState(() => _filter = v), onChanged: (v) => setState(() => _filter = v),
decoration: InputDecoration( decoration: InputDecoration(
hintText: tr('搜索'), hintText: tr('Search'),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
isDense: true), isDense: true),
), ),
@@ -93,7 +93,7 @@ class _PickerSheetState extends State<_PickerSheet> {
Widget _models() { Widget _models() {
final all = widget.app.modelList; final all = widget.app.modelList;
if (all.isEmpty) { if (all.isEmpty) {
return const Center(child: AppText('正在载入模型…')); return const Center(child: AppText('Loading models…'));
} }
final filter = _filter.trim().toLowerCase(); final filter = _filter.trim().toLowerCase();
final matching = filter.isEmpty final matching = filter.isEmpty
@@ -104,7 +104,7 @@ class _PickerSheetState extends State<_PickerSheet> {
m.id.toLowerCase().contains(filter)) m.id.toLowerCase().contains(filter))
m, m,
]; ];
if (matching.isEmpty) return const Center(child: AppText('没有结果')); if (matching.isEmpty) return const Center(child: AppText('No results'));
final byKey = { final byKey = {
for (final m in all) ModelPrefs.keyFor(m.providerId, m.id): m, for (final m in all) ModelPrefs.keyFor(m.providerId, m.id): m,
@@ -126,7 +126,7 @@ class _PickerSheetState extends State<_PickerSheet> {
final children = <Widget>[]; final children = <Widget>[];
if (filter.isEmpty) { if (filter.isEmpty) {
if (favorites.isNotEmpty) { if (favorites.isNotEmpty) {
children.add(_sectionHeader(tr('收藏'), 'favorites', count: favorites.length)); children.add(_sectionHeader(tr('Favorites'), 'favorites', count: favorites.length));
if (!_collapsed.contains('favorites')) { if (!_collapsed.contains('favorites')) {
for (final model in favorites) { for (final model in favorites) {
children.add(_modelRow(model)); children.add(_modelRow(model));
@@ -134,7 +134,7 @@ class _PickerSheetState extends State<_PickerSheet> {
} }
} }
if (recents.isNotEmpty) { if (recents.isNotEmpty) {
children.add(_sectionHeader(tr('最近'), 'recents', count: recents.length)); children.add(_sectionHeader(tr('Recent'), 'recents', count: recents.length));
if (!_collapsed.contains('recents')) { if (!_collapsed.contains('recents')) {
for (final model in recents) { for (final model in recents) {
children.add(_modelRow(model)); children.add(_modelRow(model));
@@ -143,7 +143,7 @@ class _PickerSheetState extends State<_PickerSheet> {
} }
} }
for (final entry in providers.entries) { for (final entry in providers.entries) {
final label = entry.key.isEmpty ? tr('其它') : entry.key; final label = entry.key.isEmpty ? tr('Other') : entry.key;
children.add(_sectionHeader(label, 'provider:${entry.key}', children.add(_sectionHeader(label, 'provider:${entry.key}',
count: entry.value.length)); count: entry.value.length));
if (!_collapsed.contains('provider:${entry.key}')) { if (!_collapsed.contains('provider:${entry.key}')) {
@@ -174,7 +174,7 @@ class _PickerSheetState extends State<_PickerSheet> {
const SizedBox(width: 4), const SizedBox(width: 4),
Expanded( Expanded(
child: AppText( child: AppText(
count == null ? label : trArgs('{0}({1})', [label, count]), count == null ? label : trArgs('{0} ({1})', [label, count]),
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@@ -200,7 +200,7 @@ class _PickerSheetState extends State<_PickerSheet> {
title: Row( title: Row(
children: [ children: [
Flexible( Flexible(
child: AppText(model.name, child: Text(model.name,
maxLines: 1, overflow: TextOverflow.ellipsis), maxLines: 1, overflow: TextOverflow.ellipsis),
), ),
if (model.reasoning) if (model.reasoning)
@@ -213,7 +213,7 @@ class _PickerSheetState extends State<_PickerSheet> {
), ),
subtitle: model.context > 0 subtitle: model.context > 0
? AppText( ? AppText(
trArgs('{0} 上下文', [formatTokenCount(model.context)]), trArgs('{0} context', [formatTokenCount(model.context)]),
style: TextStyle(fontSize: 11, color: theme.hintColor)) style: TextStyle(fontSize: 11, color: theme.hintColor))
: null, : null,
trailing: Row( trailing: Row(
@@ -232,7 +232,7 @@ class _PickerSheetState extends State<_PickerSheet> {
size: 18, size: 18,
color: favorite ? theme.colorScheme.primary : theme.hintColor, color: favorite ? theme.colorScheme.primary : theme.hintColor,
), ),
tooltip: favorite ? tr('取消收藏') : tr('收藏'), tooltip: favorite ? tr('Remove from favorites') : tr('Favorites'),
onPressed: () async { onPressed: () async {
await _prefs.toggleFavorite(key); await _prefs.toggleFavorite(key);
if (mounted) setState(() {}); if (mounted) setState(() {});
@@ -289,12 +289,12 @@ class _PickerSheetState extends State<_PickerSheet> {
children: [ children: [
Row( Row(
children: [ children: [
const AppText('思考强度', const AppText('Thinking effort',
style: TextStyle( style: TextStyle(
fontSize: 13, fontWeight: FontWeight.w700)), fontSize: 13, fontWeight: FontWeight.w700)),
const SizedBox(width: 6), const SizedBox(width: 6),
Expanded( Expanded(
child: AppText(model.name, child: Text(model.name,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: style:
@@ -302,7 +302,7 @@ class _PickerSheetState extends State<_PickerSheet> {
), ),
TextButton( TextButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
child: const AppText('完成'), child: const AppText('Done'),
), ),
], ],
), ),
+44 -44
View File
@@ -122,14 +122,14 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
children: [ children: [
Expanded( Expanded(
child: AppText( child: AppText(
widget.initial == null ? '新建计划任务' : '编辑计划任务', widget.initial == null ? 'New scheduled task' : 'Edit scheduled task',
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.w600), fontSize: 18, fontWeight: FontWeight.w600),
), ),
), ),
TextButton( TextButton(
onPressed: _saving ? null : _save, onPressed: _saving ? null : _save,
child: AppText(_saving ? '保存中…' : '保存'), child: AppText(_saving ? 'Saving…' : 'Save'),
), ),
], ],
), ),
@@ -138,15 +138,15 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
child: ListView( child: ListView(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 32), padding: const EdgeInsets.fromLTRB(16, 0, 16, 32),
children: [ children: [
AppText(trArgs('运行位置:{0}', [widget.scopeLabel]), AppText(trArgs('Runs in: {0}', [widget.scopeLabel]),
style: TextStyle(fontSize: 12.5, color: theme.hintColor)), style: TextStyle(fontSize: 12.5, color: theme.hintColor)),
const SizedBox(height: 12), const SizedBox(height: 12),
TextField( TextField(
controller: _name, controller: _name,
maxLength: 80, maxLength: 80,
decoration: InputDecoration( decoration: InputDecoration(
labelText: tr('任务名称'), labelText: tr('Task name'),
hintText: tr('每日同步'), hintText: tr('Daily sync'),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
), ),
), ),
@@ -156,14 +156,14 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
minLines: 4, minLines: 4,
maxLines: 10, maxLines: 10,
decoration: InputDecoration( decoration: InputDecoration(
labelText: tr('提示词'), labelText: tr('Prompt'),
hintText: tr('总结未完成任务并给出下一步建议'), hintText: tr('Summarize unfinished tasks and suggest next steps'),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
alignLabelWithHint: true, alignLabelWithHint: true,
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
const _FieldLabel('计划类型'), const _FieldLabel('Schedule type'),
Wrap( Wrap(
spacing: 8, spacing: 8,
runSpacing: 8, runSpacing: 8,
@@ -181,23 +181,23 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
const SizedBox(height: 8), const SizedBox(height: 8),
SwitchListTile( SwitchListTile(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
title: const AppText('使用默认模型与智能体'), title: const AppText('Use default model and agent'),
subtitle: const AppText('关闭后可固定这次运行使用的模型和智能体。'), subtitle: const AppText('Turn off to pin the model and agent this run uses.'),
value: _useDefaults, value: _useDefaults,
onChanged: (v) => setState(() => _useDefaults = v), onChanged: (v) => setState(() => _useDefaults = v),
), ),
if (!_useDefaults) ..._executionFields(theme), if (!_useDefaults) ..._executionFields(theme),
SwitchListTile( SwitchListTile(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
title: const AppText('已启用'), title: const AppText('Enabled'),
subtitle: const AppText('暂停的任务不会按计划运行,但可以手动运行。'), subtitle: const AppText('Paused tasks don\'t run on schedule but can still be run manually.'),
value: _enabled, value: _enabled,
onChanged: (v) => setState(() => _enabled = v), onChanged: (v) => setState(() => _enabled = v),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
FilledButton( FilledButton(
onPressed: _saving ? null : _save, onPressed: _saving ? null : _save,
child: AppText(_saving ? '保存中…' : '保存'), child: AppText(_saving ? 'Saving…' : 'Save'),
), ),
], ],
), ),
@@ -213,7 +213,7 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
return [_timesField(theme)]; return [_timesField(theme)];
case 'weekly': case 'weekly':
return [ return [
const _FieldLabel('星期'), const _FieldLabel('Weekdays'),
Wrap( Wrap(
spacing: 8, spacing: 8,
runSpacing: 8, runSpacing: 8,
@@ -239,14 +239,14 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
return [ return [
ListTile( ListTile(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
title: const AppText('日期'), title: const AppText('Date'),
trailing: AppText(_dateText(_date)), trailing: Text(_dateText(_date)),
onTap: _pickDate, onTap: _pickDate,
), ),
ListTile( ListTile(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
title: const AppText('时间'), title: const AppText('Time'),
trailing: AppText(_time), trailing: Text(_time),
onTap: () async { onTap: () async {
final picked = await _pickTime(_time); final picked = await _pickTime(_time);
if (picked != null) setState(() => _time = picked); if (picked != null) setState(() => _time = picked);
@@ -258,7 +258,7 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
TextField( TextField(
controller: _cron, controller: _cron,
decoration: InputDecoration( decoration: InputDecoration(
labelText: tr('Cron 表达式'), labelText: tr('Cron expression'),
hintText: '*/5 * * * *', hintText: '*/5 * * * *',
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
), ),
@@ -269,11 +269,11 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
runSpacing: 8, runSpacing: 8,
children: [ children: [
for (final example in const [ for (final example in const [
('每 5 分钟', '*/5 * * * *'), ('Every 5 minutes', '*/5 * * * *'),
('每小时', '0 * * * *'), ('Every hour', '0 * * * *'),
('每天 9 点', '0 9 * * *'), ('Daily at 9', '0 9 * * *'),
('每周一 9 点', '0 9 * * 1'), ('Mondays at 9', '0 9 * * 1'),
('每月 1 日', '0 9 1 * *'), ('1st of each month', '0 9 1 * *'),
]) ])
ActionChip( ActionChip(
label: AppText(example.$1), label: AppText(example.$1),
@@ -291,7 +291,7 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const _FieldLabel('时间点'), const _FieldLabel('Times'),
for (var i = 0; i < _times.length; i++) for (var i = 0; i < _times.length; i++)
Padding( Padding(
padding: const EdgeInsets.only(bottom: 4), padding: const EdgeInsets.only(bottom: 4),
@@ -303,12 +303,12 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
final picked = await _pickTime(_times[i]); final picked = await _pickTime(_times[i]);
if (picked != null) setState(() => _times[i] = picked); if (picked != null) setState(() => _times[i] = picked);
}, },
child: AppText(_times[i]), child: Text(_times[i]),
), ),
), ),
IconButton( IconButton(
icon: const Icon(Icons.remove_circle_outline, size: 20), icon: const Icon(Icons.remove_circle_outline, size: 20),
tooltip: tr('移除时间'), tooltip: tr('Remove time'),
onPressed: _times.length <= 1 onPressed: _times.length <= 1
? null ? null
: () => setState(() => _times.removeAt(i)), : () => setState(() => _times.removeAt(i)),
@@ -322,30 +322,30 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
if (picked != null) setState(() => _times.add(picked)); if (picked != null) setState(() => _times.add(picked));
}, },
icon: const Icon(Icons.add, size: 18), icon: const Icon(Icons.add, size: 18),
label: const AppText('添加时间'), label: const AppText('Add time'),
), ),
AppText('时间按服务器所在时区。', style: TextStyle(fontSize: 11.5, color: theme.hintColor)), AppText('Times follow the server\'s time zone.', style: TextStyle(fontSize: 11.5, color: theme.hintColor)),
], ],
); );
} }
List<Widget> _executionFields(ThemeData theme) { List<Widget> _executionFields(ThemeData theme) {
final model = _modelId.isEmpty final model = _modelId.isEmpty
? '选择模型' ? 'Select model'
: (widget.app.modelNames['$_providerId/$_modelId'] ?? '$_providerId/$_modelId'); : (widget.app.modelNames['$_providerId/$_modelId'] ?? '$_providerId/$_modelId');
final agent = _agent.isEmpty ? '默认智能体' : _agent; final agent = _agent.isEmpty ? 'Default agent' : _agent;
return [ return [
ListTile( ListTile(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
leading: const Icon(Icons.memory, size: 20), leading: const Icon(Icons.memory, size: 20),
title: const AppText('模型'), title: const AppText('Model'),
trailing: AppText(model, overflow: TextOverflow.ellipsis), trailing: Text(model, overflow: TextOverflow.ellipsis),
onTap: _pickModel, onTap: _pickModel,
), ),
ListTile( ListTile(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
leading: const Icon(Icons.smart_toy_outlined, size: 20), leading: const Icon(Icons.smart_toy_outlined, size: 20),
title: const AppText('智能体'), title: const AppText('Agent'),
trailing: AppText(agent, overflow: TextOverflow.ellipsis), trailing: AppText(agent, overflow: TextOverflow.ellipsis),
onTap: _pickAgent, onTap: _pickAgent,
), ),
@@ -404,13 +404,13 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
shrinkWrap: true, shrinkWrap: true,
children: [ children: [
ListTile( ListTile(
title: const AppText('默认智能体'), title: const AppText('Default agent'),
trailing: _agent.isEmpty ? const Icon(Icons.check, size: 20) : null, trailing: _agent.isEmpty ? const Icon(Icons.check, size: 20) : null,
onTap: () => Navigator.pop(sheet, ''), onTap: () => Navigator.pop(sheet, ''),
), ),
for (final agent in widget.app.agentList) for (final agent in widget.app.agentList)
ListTile( ListTile(
title: AppText(agent.name.isEmpty ? agent.id : agent.name), title: Text(agent.name.isEmpty ? agent.id : agent.name),
trailing: _agent == agent.id trailing: _agent == agent.id
? const Icon(Icons.check, size: 20) ? const Icon(Icons.check, size: 20)
: null, : null,
@@ -429,22 +429,22 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
final messenger = ScaffoldMessenger.of(context); final messenger = ScaffoldMessenger.of(context);
String? problem; String? problem;
if (name.isEmpty) { if (name.isEmpty) {
problem = '任务名称为必填项'; problem = 'Task name is required';
} else if (name.length > 80) { } else if (name.length > 80) {
problem = '任务名称不能超过 80 个字符'; problem = 'Task name can\'t exceed 80 characters';
} else if (prompt.isEmpty) { } else if (prompt.isEmpty) {
problem = '提示词为必填项'; problem = 'Prompt is required';
} else if (prompt.length > 20000) { } else if (prompt.length > 20000) {
problem = '提示词不能超过 20000 个字符'; problem = 'Prompt can\'t exceed 20,000 characters';
} else if ((_kind == 'daily' || _kind == 'weekly') && } else if ((_kind == 'daily' || _kind == 'weekly') &&
_times.any((t) => !RegExp(r'^([01]\d|2[0-3]):[0-5]\d$').hasMatch(t))) { _times.any((t) => !RegExp(r'^([01]\d|2[0-3]):[0-5]\d$').hasMatch(t))) {
problem = '时间格式必须是 HH:mm'; problem = 'Time must be in HH:mm format';
} else if (_kind == 'weekly' && _weekdays.isEmpty) { } else if (_kind == 'weekly' && _weekdays.isEmpty) {
problem = '请至少选择一个星期'; problem = 'Select at least one weekday';
} else if (_kind == 'cron' && _cron.text.trim().isEmpty) { } else if (_kind == 'cron' && _cron.text.trim().isEmpty) {
problem = 'Cron 表达式为必填项'; problem = 'Cron expression is required';
} else if (!_useDefaults && _modelId.isEmpty) { } else if (!_useDefaults && _modelId.isEmpty) {
problem = '请选择模型,或改回使用默认模型'; problem = 'Select a model, or switch back to the default model';
} }
if (problem != null) { if (problem != null) {
messenger.showSnackBar(SnackBar(content: AppText(problem))); messenger.showSnackBar(SnackBar(content: AppText(problem)));
+26 -26
View File
@@ -87,8 +87,8 @@ class _ShellTaskBarState extends State<ShellTaskBar> {
Icon(Icons.terminal, size: 15, color: theme.hintColor), Icon(Icons.terminal, size: 15, color: theme.hintColor),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded( Expanded(
child: AppText( child: Text(
trArgs('正在执行 {0} 条命令', [count]), trArgs('Running {0} commands', [count]),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@@ -131,7 +131,7 @@ class _ShellTaskRow extends StatelessWidget {
Icon(Icons.terminal, size: 15, color: theme.hintColor), Icon(Icons.terminal, size: 15, color: theme.hintColor),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded( Expanded(
child: AppText( child: Text(
task.command.replaceAll(RegExp(r'\s+'), ' ').trim(), task.command.replaceAll(RegExp(r'\s+'), ' ').trim(),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -141,7 +141,7 @@ class _ShellTaskRow extends StatelessWidget {
), ),
if (subagent) ...[ if (subagent) ...[
const SizedBox(width: 6), const SizedBox(width: 6),
AppText('子代理', AppText('Subagent',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: theme.colorScheme.onSurfaceVariant, color: theme.colorScheme.onSurfaceVariant,
@@ -195,7 +195,7 @@ class _ShellElapsedState extends State<ShellElapsed> {
if (widget.startedAt <= 0 || !widget.running) return const SizedBox.shrink(); if (widget.startedAt <= 0 || !widget.running) return const SizedBox.shrink();
final label = final label =
formatElapsed(DateTime.now().millisecondsSinceEpoch - widget.startedAt); formatElapsed(DateTime.now().millisecondsSinceEpoch - widget.startedAt);
return AppText( return Text(
label, label,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
@@ -338,7 +338,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
Icon(Icons.terminal, size: 18, color: theme.hintColor), Icon(Icons.terminal, size: 18, color: theme.hintColor),
const SizedBox(width: 10), const SizedBox(width: 10),
Expanded( Expanded(
child: AppText( child: Text(
widget.task.command, widget.task.command,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -362,7 +362,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
Icon(Icons.check_circle_outline, Icon(Icons.check_circle_outline,
size: 15, color: theme.hintColor), size: 15, color: theme.hintColor),
const SizedBox(width: 6), const SizedBox(width: 6),
AppText('已结束', AppText('Ended',
style: style:
TextStyle(fontSize: 12, color: theme.hintColor)), TextStyle(fontSize: 12, color: theme.hintColor)),
], ],
@@ -371,7 +371,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
TextButton.icon( TextButton.icon(
onPressed: _stopping ? null : _stop, onPressed: _stopping ? null : _stop,
icon: const Icon(Icons.stop_rounded, size: 17), icon: const Icon(Icons.stop_rounded, size: 17),
label: AppText(_stopping ? '停止中…' : '停止'), label: AppText(_stopping ? 'Stopping…' : 'Stop'),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: theme.colorScheme.error, foregroundColor: theme.colorScheme.error,
minimumSize: const Size(0, 32), minimumSize: const Size(0, 32),
@@ -381,7 +381,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
TextButton.icon( TextButton.icon(
onPressed: _text.isEmpty ? null : _copy, onPressed: _text.isEmpty ? null : _copy,
icon: const Icon(Icons.copy, size: 15), icon: const Icon(Icons.copy, size: 15),
label: const AppText('复制'), label: const AppText('Copy'),
style: TextButton.styleFrom( style: TextButton.styleFrom(
minimumSize: const Size(0, 32), minimumSize: const Size(0, 32),
padding: const EdgeInsets.symmetric(horizontal: 10), padding: const EdgeInsets.symmetric(horizontal: 10),
@@ -412,10 +412,10 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
AppText( AppText(
_feed.error ?? _feed.error ??
(!_feed.loaded (!_feed.loaded
? '读取输出…' ? 'Reading output…'
: running : running
? '等待输出…' ? 'Waiting for output…'
: '没有输出'), : 'No output'),
style: TextStyle( style: TextStyle(
fontSize: 13, color: theme.hintColor), fontSize: 13, color: theme.hintColor),
), ),
@@ -447,7 +447,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
_onFeed(); _onFeed();
}, },
icon: const Icon(Icons.arrow_downward, size: 15), icon: const Icon(Icons.arrow_downward, size: 15),
label: const AppText('回到最新'), label: const AppText('Jump to latest'),
style: FilledButton.styleFrom( style: FilledButton.styleFrom(
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
), ),
@@ -465,7 +465,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
await Clipboard.setData(ClipboardData(text: _text)); await Clipboard.setData(ClipboardData(text: _text));
if (mounted) { if (mounted) {
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(content: AppText('已复制输出'))); .showSnackBar(const SnackBar(content: AppText('Output copied')));
} }
} }
} }
@@ -542,15 +542,15 @@ class _ShellOutputInlineState extends State<ShellOutputInline> {
children: [ children: [
Icon(Icons.terminal, size: 15, color: theme.hintColor), Icon(Icons.terminal, size: 15, color: theme.hintColor),
const SizedBox(width: 8), const SizedBox(width: 8),
AppText('后台输出', AppText('Background output',
style: TextStyle(fontSize: 12, color: theme.hintColor)), style: TextStyle(fontSize: 12, color: theme.hintColor)),
const SizedBox(width: 8), const SizedBox(width: 8),
if (!ended) if (!ended)
AppText('运行中', AppText('Running',
style: TextStyle( style: TextStyle(
fontSize: 12, color: theme.colorScheme.primary)), fontSize: 12, color: theme.colorScheme.primary)),
if (ended && text.isEmpty) if (ended && text.isEmpty)
AppText('已结束', AppText('Ended',
style: style:
TextStyle(fontSize: 12, color: theme.hintColor)), TextStyle(fontSize: 12, color: theme.hintColor)),
const Spacer(), const Spacer(),
@@ -563,7 +563,7 @@ class _ShellOutputInlineState extends State<ShellOutputInline> {
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
textStyle: const TextStyle(fontSize: 12.5), textStyle: const TextStyle(fontSize: 12.5),
), ),
child: const AppText('停止'), child: const AppText('Stop'),
), ),
TextButton( TextButton(
onPressed: widget.onOpen, onPressed: widget.onOpen,
@@ -572,7 +572,7 @@ class _ShellOutputInlineState extends State<ShellOutputInline> {
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
textStyle: const TextStyle(fontSize: 12.5), textStyle: const TextStyle(fontSize: 12.5),
), ),
child: const AppText('查看全部'), child: const AppText('View all'),
), ),
], ],
), ),
@@ -580,7 +580,7 @@ class _ShellOutputInlineState extends State<ShellOutputInline> {
Padding( Padding(
padding: const EdgeInsets.only(bottom: 6), padding: const EdgeInsets.only(bottom: 6),
child: AppText( child: AppText(
_feed.error ?? (ended ? '没有输出' : '等待输出…'), _feed.error ?? (ended ? 'No output' : 'Waiting for output…'),
style: TextStyle(fontSize: 12, color: theme.hintColor)), style: TextStyle(fontSize: 12, color: theme.hintColor)),
) )
else else
@@ -615,8 +615,8 @@ Future<bool?> confirmStopShell(BuildContext context, String command) {
return showDialog<bool>( return showDialog<bool>(
context: context, context: context,
builder: (dialog) => AlertDialog( builder: (dialog) => AlertDialog(
title: const AppText('停止这个任务?'), title: const AppText('Stop this task?'),
content: AppText( content: Text(
command, command,
maxLines: 4, maxLines: 4,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -625,14 +625,14 @@ Future<bool?> confirmStopShell(BuildContext context, String command) {
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(dialog, false), onPressed: () => Navigator.pop(dialog, false),
child: const AppText('取消')), child: const AppText('Cancel')),
FilledButton( FilledButton(
style: FilledButton.styleFrom( style: FilledButton.styleFrom(
backgroundColor: Theme.of(dialog).colorScheme.error, backgroundColor: Theme.of(dialog).colorScheme.error,
foregroundColor: Theme.of(dialog).colorScheme.onError, foregroundColor: Theme.of(dialog).colorScheme.onError,
), ),
onPressed: () => Navigator.pop(dialog, true), onPressed: () => Navigator.pop(dialog, true),
child: const AppText('停止'), child: const AppText('Stop'),
), ),
], ],
), ),
@@ -728,11 +728,11 @@ class ShellOutputFeed {
_timer?.cancel(); _timer?.cancel();
_timer = null; _timer = null;
} else { } else {
error = trArgs('读取输出失败:{0}', [e.message]); error = trArgs('Could not read output: {0}', [e.message]);
} }
_onUpdate?.call(); _onUpdate?.call();
} catch (e) { } catch (e) {
error = trArgs('读取输出失败:{0}', ['$e']); error = trArgs('Could not read output: {0}', ['$e']);
_onUpdate?.call(); _onUpdate?.call();
} finally { } finally {
_busy = false; _busy = false;
+12 -12
View File
@@ -6,14 +6,14 @@ import '../state.dart';
import '../l10n.dart'; import '../l10n.dart';
const _slashLabels = { const _slashLabels = {
'compact': '压缩', 'compact': 'Compact',
'init': '初始化', 'init': 'Init',
'review': '审查', 'review': 'Review',
'goal': '目标', 'goal': 'Goal',
'new-extension': '新建扩展', 'new-extension': 'New extension',
'permission': '权限', 'permission': 'Permission',
'plan': '计划', 'plan': 'Plans',
'feedback': '反馈', 'feedback': 'Feedback',
}; };
String? slashLabel(SlashItem item) => String? slashLabel(SlashItem item) =>
@@ -84,11 +84,11 @@ class SlashPalette extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText(title, Text(title,
style: style:
TextStyle(fontSize: 14, color: scheme.onSurface)), TextStyle(fontSize: 14, color: scheme.onSurface)),
if (subtitle.isNotEmpty) if (subtitle.isNotEmpty)
AppText(subtitle, Text(subtitle,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@@ -119,7 +119,7 @@ class SlashPalette extends StatelessWidget {
child: CircularProgressIndicator(strokeWidth: 2)), child: CircularProgressIndicator(strokeWidth: 2)),
), ),
) )
: row(Icons.search_off, '没有可用的指令', '这个目录还没有注册指令或技能')) : row(Icons.search_off, 'No commands available', 'This directory has no commands or skills yet'))
: ListView.builder( : ListView.builder(
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6), padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6),
@@ -176,7 +176,7 @@ class SlashPalette extends StatelessWidget {
], ],
), ),
if (item.description.isNotEmpty) if (item.description.isNotEmpty)
AppText(item.description, Text(item.description,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
+135 -135
View File
@@ -5,16 +5,16 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: android_file_picker name: android_file_picker
sha256: ec3cf2a2c7a9b2bd56747e85f80efdd994e563049dfb0981a23903acfdd58cb5 sha256: b8462091dcdd075511a842272374be2232e917ee2a51ecdba4aca02bff529482
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.0" version: "2.2.1"
archive: archive:
dependency: "direct main" dependency: "direct main"
description: description:
name: archive name: archive
sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.6.1" version: "3.6.1"
args: args:
@@ -22,7 +22,7 @@ packages:
description: description:
name: args name: args
sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.7.0" version: "2.7.0"
async: async:
@@ -30,7 +30,7 @@ packages:
description: description:
name: async name: async
sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.13.1" version: "2.13.1"
boolean_selector: boolean_selector:
@@ -38,7 +38,7 @@ packages:
description: description:
name: boolean_selector name: boolean_selector
sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
camera: camera:
@@ -46,7 +46,7 @@ packages:
description: description:
name: camera name: camera
sha256: "4a0863bc142f6fbfdca19161205574fd8a8f00d4753b48d214c4dfbdcc534c51" sha256: "4a0863bc142f6fbfdca19161205574fd8a8f00d4753b48d214c4dfbdcc534c51"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.2" version: "0.12.2"
camera_android_camerax: camera_android_camerax:
@@ -54,7 +54,7 @@ packages:
description: description:
name: camera_android_camerax name: camera_android_camerax
sha256: daefacb4c2c575426772a83ac312b93e2c49c003224962cddab904426dc04dbc sha256: daefacb4c2c575426772a83ac312b93e2c49c003224962cddab904426dc04dbc
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.6+2" version: "0.7.6+2"
camera_avfoundation: camera_avfoundation:
@@ -62,7 +62,7 @@ packages:
description: description:
name: camera_avfoundation name: camera_avfoundation
sha256: "971f7b4938ae761797dd667c078af92f1b6a1bb7760774c0cbcf9c9d4a14bdf1" sha256: "971f7b4938ae761797dd667c078af92f1b6a1bb7760774c0cbcf9c9d4a14bdf1"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.11.1" version: "0.11.1"
camera_platform_interface: camera_platform_interface:
@@ -70,7 +70,7 @@ packages:
description: description:
name: camera_platform_interface name: camera_platform_interface
sha256: c22b8403d7925c6cc6a37fc0cf01f645c1400bdfb0e765f81373a3ac080d93e3 sha256: c22b8403d7925c6cc6a37fc0cf01f645c1400bdfb0e765f81373a3ac080d93e3
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.15.1" version: "2.15.1"
camera_web: camera_web:
@@ -78,7 +78,7 @@ packages:
description: description:
name: camera_web name: camera_web
sha256: "54183db5a296cf29478dd150d7685b761f9e8eeb4a11114bcbc2792adea7cb3b" sha256: "54183db5a296cf29478dd150d7685b761f9e8eeb4a11114bcbc2792adea7cb3b"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.6" version: "0.3.6"
characters: characters:
@@ -86,7 +86,7 @@ packages:
description: description:
name: characters name: characters
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.1" version: "1.4.1"
charcode: charcode:
@@ -94,23 +94,23 @@ packages:
description: description:
name: charcode name: charcode
sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.0" version: "1.4.0"
cli_util: cli_util:
dependency: transitive dependency: transitive
description: description:
name: cli_util name: cli_util
sha256: "89b8801ba49f8b593fbf2d3e59efd0f566c46cd4ba6837ae2610c72b52a0f899" sha256: da2a2b22f919995eb427edab07725e2be0b1281ef26770f6ce3a213355565262
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.0" version: "0.6.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.3" version: "1.1.3"
code_assets: code_assets:
@@ -118,7 +118,7 @@ packages:
description: description:
name: code_assets name: code_assets
sha256: "1ef22a0be3af9370bd9481ac76db114db92bfe75d5ca2b2d7bc911764478a4d9" sha256: "1ef22a0be3af9370bd9481ac76db114db92bfe75d5ca2b2d7bc911764478a4d9"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.0" version: "2.2.0"
collection: collection:
@@ -126,7 +126,7 @@ packages:
description: description:
name: collection name: collection
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.19.1" version: "1.19.1"
convert: convert:
@@ -134,7 +134,7 @@ packages:
description: description:
name: convert name: convert
sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
cross_file: cross_file:
@@ -142,7 +142,7 @@ packages:
description: description:
name: cross_file name: cross_file
sha256: f141ea4f277af142a0356955707f6556f37b03947d39d55585981a06ca437bd6 sha256: f141ea4f277af142a0356955707f6556f37b03947d39d55585981a06ca437bd6
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.5+5" version: "0.3.5+5"
crypto: crypto:
@@ -150,7 +150,7 @@ packages:
description: description:
name: crypto name: crypto
sha256: e3626ae6270383c9e3a549f34c9e4cd26c09ae6a9adaab2bf4737a00340efdc4 sha256: e3626ae6270383c9e3a549f34c9e4cd26c09ae6a9adaab2bf4737a00340efdc4
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.8" version: "3.0.8"
cupertino_icons: cupertino_icons:
@@ -158,7 +158,7 @@ packages:
description: description:
name: cupertino_icons name: cupertino_icons
sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd" sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.9" version: "1.0.9"
cupertino_ui: cupertino_ui:
@@ -166,23 +166,23 @@ packages:
description: description:
name: cupertino_ui name: cupertino_ui
sha256: c3eaf7f5bdfee36deb0b14a4cbf7602f1b6b8d8b8576b81f38fc08c25881c94c sha256: c3eaf7f5bdfee36deb0b14a4cbf7602f1b6b8d8b8576b81f38fc08c25881c94c
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.7" version: "1.1.7"
dbus: dbus:
dependency: transitive dependency: transitive
description: description:
name: dbus name: dbus
sha256: f7db8504e715b835f5ebe5fe74604ccd961d504c73389a5d8e81bafc2e2f3612 sha256: fe6b46eae35441227e9e750656d06a4f40c230fe96e4390da7d7ebc69a60f0b3
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.8.0" version: "0.8.1"
equatable: equatable:
dependency: transitive dependency: transitive
description: description:
name: equatable name: equatable
sha256: "3bce007a596ff8b3119c45d68aaef631272537c03d30e5d4534dd24bf4c5eaa2" sha256: "3bce007a596ff8b3119c45d68aaef631272537c03d30e5d4534dd24bf4c5eaa2"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
fake_async: fake_async:
@@ -190,7 +190,7 @@ packages:
description: description:
name: fake_async name: fake_async
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.3" version: "1.3.3"
ffi: ffi:
@@ -198,7 +198,7 @@ packages:
description: description:
name: ffi name: ffi
sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.0" version: "2.2.0"
ffi_leak_tracker: ffi_leak_tracker:
@@ -206,7 +206,7 @@ packages:
description: description:
name: ffi_leak_tracker name: ffi_leak_tracker
sha256: "4093d4ef9ca06ffe2786e73bfb25e22aa92112b9bb4ec941f11e3e6b61489a97" sha256: "4093d4ef9ca06ffe2786e73bfb25e22aa92112b9bb4ec941f11e3e6b61489a97"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.2" version: "0.1.2"
file: file:
@@ -214,55 +214,55 @@ packages:
description: description:
name: file name: file
sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "7.0.1" version: "7.0.1"
file_picker: file_picker:
dependency: "direct main" dependency: "direct main"
description: description:
name: file_picker name: file_picker
sha256: c3780977700b8962c3b9b6a9aa4e2c988956893d70d4a4fa2d7adf4ec9b9eaee sha256: "5b99250437a4d34ee2cdc0686924452103540eaa1c248094b63f07f9d7216f6c"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "13.4.0" version: "13.4.1"
file_picker_darwin: file_picker_darwin:
dependency: transitive dependency: transitive
description: description:
name: file_picker_darwin name: file_picker_darwin
sha256: b7d3a6bd26a18c503d29070fc2d7b26fbfe918d08a6bcd984b6e806ff5ad923f sha256: "34e3344225bccfa1d45a8af025da58702f13efecad67b763dc0eb2691f388afb"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.5.1" version: "2.5.2"
file_picker_linux: file_picker_linux:
dependency: transitive dependency: transitive
description: description:
name: file_picker_linux name: file_picker_linux
sha256: "9215ee8c672508cdd9a325202669f849e1baac883658626b3abed5d7777e6a4b" sha256: cf3889644e8e54551f5c3a4f98b6b6ef5f0ef85c07d2a0c1a969538983be2f9b
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.4" version: "2.0.5"
file_picker_platform_interface: file_picker_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: file_picker_platform_interface name: file_picker_platform_interface
sha256: a2ef71c4628f92a4471d424576e3bf7042b40a2683c9f9a0e3033a7fc7f7763c sha256: a2ef71c4628f92a4471d424576e3bf7042b40a2683c9f9a0e3033a7fc7f7763c
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "4.3.0" version: "4.3.0"
file_picker_web: file_picker_web:
dependency: transitive dependency: transitive
description: description:
name: file_picker_web name: file_picker_web
sha256: "50749a6da2984fc29609e102ad4d80fd1d07e6895150f8e4922086167d9d45d8" sha256: "97f7085e3c4f5724595bbd94e8f380f7a690e9066140a5fb711e97ac45a02008"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "4.2.1" version: "4.2.2"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
name: fixnum name: fixnum
sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
flutter: flutter:
@@ -275,7 +275,7 @@ packages:
description: description:
name: flutter_lints name: flutter_lints
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "6.0.0" version: "6.0.0"
flutter_localizations: flutter_localizations:
@@ -288,7 +288,7 @@ packages:
description: description:
name: flutter_plugin_android_lifecycle name: flutter_plugin_android_lifecycle
sha256: "3854fe5e3bff0b113c658f260b90c95dea17c92db0f2addeac2e343dd9969785" sha256: "3854fe5e3bff0b113c658f260b90c95dea17c92db0f2addeac2e343dd9969785"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.35" version: "2.0.35"
flutter_secure_storage: flutter_secure_storage:
@@ -296,7 +296,7 @@ packages:
description: description:
name: flutter_secure_storage name: flutter_secure_storage
sha256: d4e1fb6b2cb524868929e78dc0282fa000554b22060fb53789dc481c9fc95bb8 sha256: d4e1fb6b2cb524868929e78dc0282fa000554b22060fb53789dc481c9fc95bb8
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "11.2.0" version: "11.2.0"
flutter_secure_storage_darwin: flutter_secure_storage_darwin:
@@ -304,7 +304,7 @@ packages:
description: description:
name: flutter_secure_storage_darwin name: flutter_secure_storage_darwin
sha256: a031ceac9b070e62ef183cd7f7d1a8798ebde402d5049f0fe6eb3a51bd797a21 sha256: a031ceac9b070e62ef183cd7f7d1a8798ebde402d5049f0fe6eb3a51bd797a21
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.3" version: "0.4.3"
flutter_secure_storage_linux: flutter_secure_storage_linux:
@@ -312,7 +312,7 @@ packages:
description: description:
name: flutter_secure_storage_linux name: flutter_secure_storage_linux
sha256: caa75bd78f017422912e3a904933113b2428eb79f981ac37acd2dd2a700458ea sha256: caa75bd78f017422912e3a904933113b2428eb79f981ac37acd2dd2a700458ea
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.3" version: "3.0.3"
flutter_secure_storage_platform_interface: flutter_secure_storage_platform_interface:
@@ -320,7 +320,7 @@ packages:
description: description:
name: flutter_secure_storage_platform_interface name: flutter_secure_storage_platform_interface
sha256: "64951127f001f546891c86f414972bf49ef2c4c8a4c92c65f5790cc0c9100045" sha256: "64951127f001f546891c86f414972bf49ef2c4c8a4c92c65f5790cc0c9100045"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
flutter_secure_storage_web: flutter_secure_storage_web:
@@ -328,7 +328,7 @@ packages:
description: description:
name: flutter_secure_storage_web name: flutter_secure_storage_web
sha256: "073a62b3aeb866ab4ce795f960413948e51e5a42a9b0c8333b6daf5bb3208a1c" sha256: "073a62b3aeb866ab4ce795f960413948e51e5a42a9b0c8333b6daf5bb3208a1c"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
flutter_secure_storage_windows: flutter_secure_storage_windows:
@@ -336,7 +336,7 @@ packages:
description: description:
name: flutter_secure_storage_windows name: flutter_secure_storage_windows
sha256: "471951813a97006d899db4948acc654a4f28c440083ea08178935ce20b173ec1" sha256: "471951813a97006d899db4948acc654a4f28c440083ea08178935ce20b173ec1"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "4.2.2" version: "4.2.2"
flutter_slidable: flutter_slidable:
@@ -344,17 +344,17 @@ packages:
description: description:
name: flutter_slidable name: flutter_slidable
sha256: "373a94a50169bc4732267539af312b3cc6c5ab5b5b240364163255ff4c9a8adc" sha256: "373a94a50169bc4732267539af312b3cc6c5ab5b5b240364163255ff4c9a8adc"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "5.2.0" version: "5.2.0"
flutter_svg: flutter_svg:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_svg name: flutter_svg
sha256: "4565a66f0a968f2e1ab4197854686990258aadab9572eb80a7655053a01dc302" sha256: "5b0dd02de78d110e4acaca042e3be80c9b2ec04c1f41a83ca39a717497c7e2d2"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.5.0" version: "2.5.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@@ -370,7 +370,7 @@ packages:
description: description:
name: gpt_markdown name: gpt_markdown
sha256: "948469e671fb6bce1d7ecdfb5b01b4ca5686741514f1274bf53b72452fecf07b" sha256: "948469e671fb6bce1d7ecdfb5b01b4ca5686741514f1274bf53b72452fecf07b"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.1" version: "1.4.1"
hooks: hooks:
@@ -378,7 +378,7 @@ packages:
description: description:
name: hooks name: hooks
sha256: eaac480a35ec0814146c2c48d96aaa829e0e44a7662c88ae84c9edf4bc35651f sha256: eaac480a35ec0814146c2c48d96aaa829e0e44a7662c88ae84c9edf4bc35651f
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.0" version: "2.2.0"
http: http:
@@ -386,7 +386,7 @@ packages:
description: description:
name: http name: http
sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.6.0" version: "1.6.0"
http_parser: http_parser:
@@ -394,7 +394,7 @@ packages:
description: description:
name: http_parser name: http_parser
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "4.1.2" version: "4.1.2"
intl: intl:
@@ -402,23 +402,23 @@ packages:
description: description:
name: intl name: intl
sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867" sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.20.3" version: "0.20.3"
jni: jni:
dependency: transitive dependency: transitive
description: description:
name: jni name: jni
sha256: "822c3f004742158b80b558773ebed29891f407058d5798992436a68bdf14ccda" sha256: "19764f78f6b9e0d40f6395b04649d1046eb57f5ccf05afce50cc63e5a82777b0"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
jni_flutter: jni_flutter:
dependency: transitive dependency: transitive
description: description:
name: jni_flutter name: jni_flutter
sha256: "586594ad345b403bda8a794b0b8a9e34298238b86c2a7d7f15160b092fe9ef3d" sha256: "586594ad345b403bda8a794b0b8a9e34298238b86c2a7d7f15160b092fe9ef3d"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
jni_util: jni_util:
@@ -426,7 +426,7 @@ packages:
description: description:
name: jni_util name: jni_util
sha256: "1ba86da04a5f2bf18fde2edb235587e70c5b0fc5bd4ba955f46b00942c3fc35f" sha256: "1ba86da04a5f2bf18fde2edb235587e70c5b0fc5bd4ba955f46b00942c3fc35f"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
leak_tracker: leak_tracker:
@@ -434,7 +434,7 @@ packages:
description: description:
name: leak_tracker name: leak_tracker
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "11.0.2" version: "11.0.2"
leak_tracker_flutter_testing: leak_tracker_flutter_testing:
@@ -442,7 +442,7 @@ packages:
description: description:
name: leak_tracker_flutter_testing name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.10" version: "3.0.10"
leak_tracker_testing: leak_tracker_testing:
@@ -450,7 +450,7 @@ packages:
description: description:
name: leak_tracker_testing name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.2" version: "3.0.2"
lints: lints:
@@ -458,7 +458,7 @@ packages:
description: description:
name: lints name: lints
sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "6.1.0" version: "6.1.0"
listen: listen:
@@ -466,7 +466,7 @@ packages:
description: description:
name: listen name: listen
sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
logging: logging:
@@ -474,7 +474,7 @@ packages:
description: description:
name: logging name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
matcher: matcher:
@@ -482,7 +482,7 @@ packages:
description: description:
name: matcher name: matcher
sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.20" version: "0.12.20"
material_color_utilities: material_color_utilities:
@@ -490,7 +490,7 @@ packages:
description: description:
name: material_color_utilities name: material_color_utilities
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.13.0" version: "0.13.0"
material_ui: material_ui:
@@ -498,7 +498,7 @@ packages:
description: description:
name: material_ui name: material_ui
sha256: a6b19012df437a356cbc01f8ea22a105e07194c47c9a6009da0032a0ce35c4ab sha256: a6b19012df437a356cbc01f8ea22a105e07194c47c9a6009da0032a0ce35c4ab
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.11.1" version: "1.11.1"
meta: meta:
@@ -506,7 +506,7 @@ packages:
description: description:
name: meta name: meta
sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.19.0" version: "1.19.0"
objective_c: objective_c:
@@ -514,7 +514,7 @@ packages:
description: description:
name: objective_c name: objective_c
sha256: c965d264fd4b0b4dd402dce9d049b70656bf98d3ca108b9bc55d2544ceadbe5e sha256: c965d264fd4b0b4dd402dce9d049b70656bf98d3ca108b9bc55d2544ceadbe5e
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "9.6.4" version: "9.6.4"
package_config: package_config:
@@ -522,7 +522,7 @@ packages:
description: description:
name: package_config name: package_config
sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
package_info_plus: package_info_plus:
@@ -530,7 +530,7 @@ packages:
description: description:
name: package_info_plus name: package_info_plus
sha256: "73ef2cd5c11a7548f9b7f6fc2a4f6113de2e64aa2a70de63feede95548822908" sha256: "73ef2cd5c11a7548f9b7f6fc2a4f6113de2e64aa2a70de63feede95548822908"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "10.2.2" version: "10.2.2"
package_info_plus_platform_interface: package_info_plus_platform_interface:
@@ -538,7 +538,7 @@ packages:
description: description:
name: package_info_plus_platform_interface name: package_info_plus_platform_interface
sha256: db762cb2f4f25ee60fb6359773861b0f199e00b90d237bd85a76a1e806b46ef4 sha256: db762cb2f4f25ee60fb6359773861b0f199e00b90d237bd85a76a1e806b46ef4
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "4.1.0" version: "4.1.0"
path: path:
@@ -546,7 +546,7 @@ packages:
description: description:
name: path name: path
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.1" version: "1.9.1"
path_parsing: path_parsing:
@@ -554,7 +554,7 @@ packages:
description: description:
name: path_parsing name: path_parsing
sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
path_provider: path_provider:
@@ -562,7 +562,7 @@ packages:
description: description:
name: path_provider name: path_provider
sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825 sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.6" version: "2.1.6"
path_provider_android: path_provider_android:
@@ -570,7 +570,7 @@ packages:
description: description:
name: path_provider_android name: path_provider_android
sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.1" version: "2.3.1"
path_provider_foundation: path_provider_foundation:
@@ -578,7 +578,7 @@ packages:
description: description:
name: path_provider_foundation name: path_provider_foundation
sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699" sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.6.0" version: "2.6.0"
path_provider_linux: path_provider_linux:
@@ -586,7 +586,7 @@ packages:
description: description:
name: path_provider_linux name: path_provider_linux
sha256: "58c2005f147315b11e9b4a7bc889cd5203e250cba8e3f012dae259b4972b5c16" sha256: "58c2005f147315b11e9b4a7bc889cd5203e250cba8e3f012dae259b4972b5c16"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.2" version: "2.2.2"
path_provider_platform_interface: path_provider_platform_interface:
@@ -594,7 +594,7 @@ packages:
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda" sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
path_provider_windows: path_provider_windows:
@@ -602,7 +602,7 @@ packages:
description: description:
name: path_provider_windows name: path_provider_windows
sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.0" version: "2.3.0"
petitparser: petitparser:
@@ -610,7 +610,7 @@ packages:
description: description:
name: petitparser name: petitparser
sha256: "2f1564aadb14215e478563b5406cb80729d022158c01dc50c96013c2f7eb4790" sha256: "2f1564aadb14215e478563b5406cb80729d022158c01dc50c96013c2f7eb4790"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "7.1.0" version: "7.1.0"
platform: platform:
@@ -618,7 +618,7 @@ packages:
description: description:
name: platform name: platform
sha256: a36d119c13416516a7b5913fbe8af8531e11633d784c550b2125f76c758524ec sha256: a36d119c13416516a7b5913fbe8af8531e11633d784c550b2125f76c758524ec
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.2.0" version: "3.2.0"
plugin_platform_interface: plugin_platform_interface:
@@ -626,7 +626,7 @@ packages:
description: description:
name: plugin_platform_interface name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.8" version: "2.1.8"
pointycastle: pointycastle:
@@ -634,7 +634,7 @@ packages:
description: description:
name: pointycastle name: pointycastle
sha256: "92aa3841d083cc4b0f4709b5c74fd6409a3e6ba833ffc7dc6a8fee096366acf5" sha256: "92aa3841d083cc4b0f4709b5c74fd6409a3e6ba833ffc7dc6a8fee096366acf5"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
pub_semver: pub_semver:
@@ -642,7 +642,7 @@ packages:
description: description:
name: pub_semver name: pub_semver
sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
qr: qr:
@@ -650,7 +650,7 @@ packages:
description: description:
name: qr name: qr
sha256: f9461594b257c2ec882159fb8100db28408f6aacdba5b21f109708bce2e482b6 sha256: f9461594b257c2ec882159fb8100db28408f6aacdba5b21f109708bce2e482b6
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.1" version: "4.0.1"
quiver: quiver:
@@ -658,7 +658,7 @@ packages:
description: description:
name: quiver name: quiver
sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.2.2" version: "3.2.2"
record_use: record_use:
@@ -666,7 +666,7 @@ packages:
description: description:
name: record_use name: record_use
sha256: "1cb8564af8d43b464294411db9217f5ec04891c6f22ee2c32d73ae05e88a6bd2" sha256: "1cb8564af8d43b464294411db9217f5ec04891c6f22ee2c32d73ae05e88a6bd2"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
shared_preferences: shared_preferences:
@@ -674,7 +674,7 @@ packages:
description: description:
name: shared_preferences name: shared_preferences
sha256: "1e85e0dccf5b4a016077fea7dfbb4a7cb39c759ac1596fcf60c06deadb7da91f" sha256: "1e85e0dccf5b4a016077fea7dfbb4a7cb39c759ac1596fcf60c06deadb7da91f"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.5.6" version: "2.5.6"
shared_preferences_android: shared_preferences_android:
@@ -682,7 +682,7 @@ packages:
description: description:
name: shared_preferences_android name: shared_preferences_android
sha256: "137dedccacb394b8f470d6c9b435ffc3d33faaa6ce2949c4f54a61007d64396d" sha256: "137dedccacb394b8f470d6c9b435ffc3d33faaa6ce2949c4f54a61007d64396d"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.5.5" version: "2.5.5"
shared_preferences_foundation: shared_preferences_foundation:
@@ -690,7 +690,7 @@ packages:
description: description:
name: shared_preferences_foundation name: shared_preferences_foundation
sha256: "89435cb71ecb1ad1bf29ef73a381f871a06f433d4182b7e2ba7243b02b2c544b" sha256: "89435cb71ecb1ad1bf29ef73a381f871a06f433d4182b7e2ba7243b02b2c544b"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.6.2" version: "2.6.2"
shared_preferences_linux: shared_preferences_linux:
@@ -698,7 +698,7 @@ packages:
description: description:
name: shared_preferences_linux name: shared_preferences_linux
sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.1" version: "2.4.1"
shared_preferences_platform_interface: shared_preferences_platform_interface:
@@ -706,7 +706,7 @@ packages:
description: description:
name: shared_preferences_platform_interface name: shared_preferences_platform_interface
sha256: "649dc798a33931919ea356c4305c2d1f81619ea6e92244070b520187b5140ef9" sha256: "649dc798a33931919ea356c4305c2d1f81619ea6e92244070b520187b5140ef9"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.2" version: "2.4.2"
shared_preferences_web: shared_preferences_web:
@@ -714,7 +714,7 @@ packages:
description: description:
name: shared_preferences_web name: shared_preferences_web
sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.3" version: "2.4.3"
shared_preferences_windows: shared_preferences_windows:
@@ -722,7 +722,7 @@ packages:
description: description:
name: shared_preferences_windows name: shared_preferences_windows
sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.1" version: "2.4.1"
sky_engine: sky_engine:
@@ -735,7 +735,7 @@ packages:
description: description:
name: socks5_proxy name: socks5_proxy
sha256: a4b95506cbd962fa403e862777432671d36511230c4aedd125a28ddb922e6399 sha256: a4b95506cbd962fa403e862777432671d36511230c4aedd125a28ddb922e6399
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
source_span: source_span:
@@ -743,7 +743,7 @@ packages:
description: description:
name: source_span name: source_span
sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.10.2" version: "1.10.2"
stack_trace: stack_trace:
@@ -751,7 +751,7 @@ packages:
description: description:
name: stack_trace name: stack_trace
sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.12.2" version: "1.12.2"
stream_channel: stream_channel:
@@ -759,7 +759,7 @@ packages:
description: description:
name: stream_channel name: stream_channel
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
stream_transform: stream_transform:
@@ -767,7 +767,7 @@ packages:
description: description:
name: stream_transform name: stream_transform
sha256: a00e5f18bffc764f923e7dec1038527f7fe7a1791361a7117f0358193f13d53a sha256: a00e5f18bffc764f923e7dec1038527f7fe7a1791361a7117f0358193f13d53a
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
string_scanner: string_scanner:
@@ -775,7 +775,7 @@ packages:
description: description:
name: string_scanner name: string_scanner
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.1" version: "1.4.1"
term_glyph: term_glyph:
@@ -783,7 +783,7 @@ packages:
description: description:
name: term_glyph name: term_glyph
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.2" version: "1.2.2"
test_api: test_api:
@@ -791,7 +791,7 @@ packages:
description: description:
name: test_api name: test_api
sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.14" version: "0.7.14"
typed_data: typed_data:
@@ -799,7 +799,7 @@ packages:
description: description:
name: typed_data name: typed_data
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.0" version: "1.4.0"
val_highlight: val_highlight:
@@ -807,7 +807,7 @@ packages:
description: description:
name: val_highlight name: val_highlight
sha256: dbb36108dfc96aa09f544dc25dc769be0a60fa1c420a53bf23fadfafd7707049 sha256: dbb36108dfc96aa09f544dc25dc769be0a60fa1c420a53bf23fadfafd7707049
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.1" version: "0.1.1"
val_highlight_flutter: val_highlight_flutter:
@@ -815,7 +815,7 @@ packages:
description: description:
name: val_highlight_flutter name: val_highlight_flutter
sha256: "68269b7050fce3f26e20d8884394fed1647153bc0b838bbd519ac8cc73612bb8" sha256: "68269b7050fce3f26e20d8884394fed1647153bc0b838bbd519ac8cc73612bb8"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.2" version: "0.1.2"
val_latex: val_latex:
@@ -823,7 +823,7 @@ packages:
description: description:
name: val_latex name: val_latex
sha256: ff7f4d937d4b84df4d79c3046aaeba85e1c198cc9f9ed2495567213865a5234c sha256: ff7f4d937d4b84df4d79c3046aaeba85e1c198cc9f9ed2495567213865a5234c
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.4" version: "0.1.4"
val_latex_flutter: val_latex_flutter:
@@ -831,7 +831,7 @@ packages:
description: description:
name: val_latex_flutter name: val_latex_flutter
sha256: "7e80cd9c113e257c3f4ad779adb8a386e33e05ee2946960e3b96317ea6f47089" sha256: "7e80cd9c113e257c3f4ad779adb8a386e33e05ee2946960e3b96317ea6f47089"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.4" version: "0.1.4"
vector_graphics: vector_graphics:
@@ -839,7 +839,7 @@ packages:
description: description:
name: vector_graphics name: vector_graphics
sha256: "06081e4f2d8f17c306aa58989520694b463ad411bc7c7b93e76afa3e41ca17ac" sha256: "06081e4f2d8f17c306aa58989520694b463ad411bc7c7b93e76afa3e41ca17ac"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
vector_graphics_codec: vector_graphics_codec:
@@ -847,23 +847,23 @@ packages:
description: description:
name: vector_graphics_codec name: vector_graphics_codec
sha256: "023f3afd1b08d040406e7ccc324f5173c04762a59e374f29d04cef00a4940742" sha256: "023f3afd1b08d040406e7ccc324f5173c04762a59e374f29d04cef00a4940742"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
vector_graphics_compiler: vector_graphics_compiler:
dependency: transitive dependency: transitive
description: description:
name: vector_graphics_compiler name: vector_graphics_compiler
sha256: "7d3d604c1ede26711f865f74e9273c5c5504ac449f3d92faa722878dbac88807" sha256: "4a3f1ed88eb49c0ce9de15832256a3681eb4ce03350375ba588b5918ea3ed60a"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.6" version: "1.3.7"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.4" version: "2.4.4"
vm_service: vm_service:
@@ -871,7 +871,7 @@ packages:
description: description:
name: vm_service name: vm_service
sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "15.4.0" version: "15.4.0"
web: web:
@@ -879,7 +879,7 @@ packages:
description: description:
name: web name: web
sha256: e119e82ac4795c7925103b7cf3768191f33941b99e7ccffbd6c645201d9f606b sha256: e119e82ac4795c7925103b7cf3768191f33941b99e7ccffbd6c645201d9f606b
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.2" version: "1.1.2"
win32: win32:
@@ -887,7 +887,7 @@ packages:
description: description:
name: win32 name: win32
sha256: a0b93865d5644f11cf6a8c3f6db909f1ec168958b5805f6cc684adea957cd63d sha256: a0b93865d5644f11cf6a8c3f6db909f1ec168958b5805f6cc684adea957cd63d
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "6.4.0" version: "6.4.0"
windows_file_picker: windows_file_picker:
@@ -895,7 +895,7 @@ packages:
description: description:
name: windows_file_picker name: windows_file_picker
sha256: cd1be37ada0abcfaa55bddb7410e8515844e35cd77669c35d9a28a15722299d8 sha256: cd1be37ada0abcfaa55bddb7410e8515844e35cd77669c35d9a28a15722299d8
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
xdg_directories: xdg_directories:
@@ -903,7 +903,7 @@ packages:
description: description:
name: xdg_directories name: xdg_directories
sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
xml: xml:
@@ -911,7 +911,7 @@ packages:
description: description:
name: xml name: xml
sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4" sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "7.0.1" version: "7.0.1"
xterm: xterm:
@@ -919,7 +919,7 @@ packages:
description: description:
name: xterm name: xterm
sha256: "168dfedca77cba33fdb6f52e2cd001e9fde216e398e89335c19b524bb22da3a2" sha256: "168dfedca77cba33fdb6f52e2cd001e9fde216e398e89335c19b524bb22da3a2"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
yaml: yaml:
@@ -927,7 +927,7 @@ packages:
description: description:
name: yaml name: yaml
sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.4" version: "3.1.4"
zmodem: zmodem:
@@ -935,7 +935,7 @@ packages:
description: description:
name: zmodem name: zmodem
sha256: "3b7e5b29f3a7d8aee472029b05165a68438eff2f3f7766edf13daba1e297adbf" sha256: "3b7e5b29f3a7d8aee472029b05165a68438eff2f3f7766edf13daba1e297adbf"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.0.6" version: "0.0.6"
zxing2: zxing2:
@@ -943,7 +943,7 @@ packages:
description: description:
name: zxing2 name: zxing2
sha256: "2677c49a3b9ca9457cb1d294fd4bd5041cac6aab8cdb07b216ba4e98945c684f" sha256: "2677c49a3b9ca9457cb1d294fd4bd5041cac6aab8cdb07b216ba4e98945c684f"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.4" version: "0.2.4"
sdks: sdks:
+1 -1
View File
@@ -2,7 +2,7 @@ name: openchamber
description: "A lightweight OpenChamber client for phones." description: "A lightweight OpenChamber client for phones."
publish_to: 'none' publish_to: 'none'
version: 0.5.2+502 version: 0.5.3+503
environment: environment:
sdk: ^3.14.0 sdk: ^3.14.0
+74 -37
View File
@@ -3,69 +3,106 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:openchamber/l10n.dart'; import 'package:openchamber/l10n.dart';
import 'package:openchamber/l10n/zh.dart';
/// Chinese literals that are not UI text: patterns matched against server /// Strings that are deliberately the same in both languages, or not UI text
/// data, protocol values, and the two language names that read the same in /// at all (a screen reader label, a path pattern built at runtime).
/// both languages.
const _notTranslated = <String>{ const _notTranslated = <String>{
r'^终端 (\d+)$',
'中文',
'English', 'English',
// The two halves of one key: both sentences are written as adjacent '中文',
// literals in servers_screen and in en_servers, and only the joined text is // Product names, separators and glyphs read the same everywhere.
// a key. 'OpenChamber',
'在 OpenChamber 网页端打开「连接设备」,粘贴链接或直接扫描二维码。', 'OpenCode',
'链接里带一次性密钥,以及直连地址或私有 Relay。', ' / ',
'·',
'🖼',
' *',
}; };
/// The literal arguments of AppText, tr and trArgs in [source]: the strings
/// our own code writes and therefore the ones a translation exists for.
Iterable<String> _uiLiterals(String source) sync* {
const quote = r'''(?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*")''';
final patterns = <RegExp>[
RegExp('AppText\\(\\s*(?:$quote)(?:\\s*(?:$quote))*'),
RegExp(r'\btr\(\s*(?:' + quote + ')'),
RegExp(r'\btrArgs\(\s*(?:' + quote + r')(?:\s*(?:' + quote + '))*'),
];
final single = RegExp(quote);
for (final pattern in patterns) {
for (final match in pattern.allMatches(source)) {
final call = match.group(0)!;
final joined = single
.allMatches(call)
.map((m) => m.group(0)!.substring(1, m.group(0)!.length - 1))
.map((s) => s.replaceAll(r'\n', '\n').replaceAll(r"\'", "'"))
.join();
// Interpolated text is built at runtime, not a translation key.
if (joined.contains(r'$')) continue;
yield joined;
}
}
}
void main() { void main() {
tearDown(() { tearDown(() {
L10n.instance.apply(AppLanguage.zh); L10n.instance.apply(AppLanguage.en);
}); });
test('English lookup falls back on the Chinese text it was given', () async { test('Chinese lookup falls back on the English it was given', () {
L10n.instance.apply(AppLanguage.zh);
expect(tr('Save'), '保存');
expect(tr('A text with no translation'), 'A text with no translation');
expect(trArgs('{0} subagents', [3]), '3 个子代理');
expect(trArgs('{0} notes', [1]), isNot(contains('notes')));
});
test('English is the source, so it needs no table', () {
L10n.instance.apply(AppLanguage.en); L10n.instance.apply(AppLanguage.en);
expect(tr('保存'), isNot('保存')); expect(tr('Save'), 'Save');
expect(tr('这不存在的文案'), '这不存在的文案'); expect(trArgs('{0} subagents', [3]), '3 subagents');
expect(trArgs('{0} 个子代理', [3]), contains('3')); });
expect(trArgs('{0} 条笔记', [1]), isNot(contains('条')));
test('a language without a table reads English', () {
L10n.instance.apply(AppLanguage.zh);
// Spanish follows the system language branch; the app has no Spanish
// table, so everything is the English source.
final dispatcher = TestWidgetsFlutterBinding.instance.platformDispatcher;
dispatcher.localeTestValue = const Locale('es', 'ES');
addTearDown(dispatcher.clearLocaleTestValue);
L10n.instance.apply(AppLanguage.system);
expect(L10n.instance.locale.languageCode, 'en');
expect(tr('Save'), 'Save');
expect(trArgs('{0} subagents', [3]), '3 subagents');
}); });
testWidgets('AppText follows the chosen language', (tester) async { testWidgets('AppText follows the chosen language', (tester) async {
L10n.instance.apply(AppLanguage.zh);
await tester
.pumpWidget(const MaterialApp(home: Scaffold(body: AppText('保存'))));
expect(find.text('保存'), findsOneWidget);
L10n.instance.apply(AppLanguage.en); L10n.instance.apply(AppLanguage.en);
await tester await tester
.pumpWidget(const MaterialApp(home: Scaffold(body: AppText('保存')))); .pumpWidget(const MaterialApp(home: Scaffold(body: AppText('Save'))));
expect(find.text('Save'), findsOneWidget); expect(find.text('Save'), findsOneWidget);
L10n.instance.apply(AppLanguage.zh);
await tester
.pumpWidget(const MaterialApp(home: Scaffold(body: AppText('Save'))));
expect(find.text('保存'), findsOneWidget);
}); });
test('every Chinese literal in lib has an English entry', () { test('every UI string the code writes has a Chinese entry', () {
final quotes = [RegExp(r"'(?:\\.|[^'\\])*'"), RegExp(r'"(?:\\.|[^"\\])*"')];
final cjk = RegExp(r'[\u4e00-\u9fff]');
final missing = <String>{}; final missing = <String>{};
for (final entity in Directory('lib').listSync(recursive: true)) { for (final entity in Directory('lib').listSync(recursive: true)) {
if (entity is! File || !entity.path.endsWith('.dart')) continue; if (entity is! File || !entity.path.endsWith('.dart')) continue;
if (entity.path.startsWith('lib/l10n')) continue; if (entity.path.startsWith('lib/l10n')) continue;
for (final line in entity.readAsLinesSync()) { final source = entity.readAsStringSync();
if (line.trimLeft().startsWith('//')) continue; for (final text in _uiLiterals(source)) {
for (final quote in quotes) { if (text.trim().isEmpty) continue;
for (final match in quote.allMatches(line)) { if (chineseStrings.containsKey(text)) continue;
final raw = match.group(0)!.substring(1, match.group(0)!.length - 1);
final text = raw.replaceAll(r'\n', '\n');
if (!cjk.hasMatch(text)) continue;
if (englishStrings.containsKey(text)) continue;
if (_notTranslated.contains(text)) continue; if (_notTranslated.contains(text)) continue;
missing.add(text); missing.add(text);
} }
} }
}
}
expect(missing, isEmpty, expect(missing, isEmpty,
reason: 'Add these to lib/l10n/en_*.dart (or to _notTranslated if ' reason: 'Add these to lib/l10n/zh.dart (or to _notTranslated if they '
'they are not UI text):\n${missing.join('\n')}'); 'are not UI text):\n${missing.join('\n')}');
}); });
} }