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
+1620 -1791

No files matched your search

+18 -18
View File
@@ -93,7 +93,7 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
return;
}
if (cameras.isEmpty) {
if (mounted) setState(() => _error = tr('没有可用的相机'));
if (mounted) setState(() => _error = tr('No camera available'));
return;
}
CameraDescription pick = cameras.first;
@@ -124,11 +124,11 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
await controller.startImageStream(_onFrame);
_watchdog = Timer(const Duration(seconds: 4), () {
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), () {
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);
});
return;
@@ -153,11 +153,11 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
if (error.code == 'CameraAccessDenied' ||
error.code == 'CameraAccessDeniedWithoutPrompt' ||
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) {
@@ -189,14 +189,14 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
if (text.trim().startsWith('openchamber://connect')) {
_accept(text.trim());
} else {
_showHint(tr('这不是 OpenChamber 配对二维码'));
_showHint(tr('This is not an OpenChamber pairing QR code'));
}
}).catchError((Object error) {
_decoding = false;
_decodeErrors += 1;
if (_decodeErrors == 1) {
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);
if (mounted) setState(() => _torch = !_torch);
} 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,
size: 36, color: Colors.white70),
const SizedBox(height: 12),
AppText(_error!,
Text(_error!,
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white70)),
const SizedBox(height: 16),
FilledButton.tonal(
onPressed: _start,
child: const AppText('重试'),
child: const AppText('Retry'),
),
],
),
@@ -296,14 +296,14 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
Row(
children: [
IconButton(
tooltip: tr('关闭'),
tooltip: tr('Close'),
icon: const Icon(Icons.close),
color: Colors.white,
onPressed: () => Navigator.of(context).pop(),
),
const Spacer(),
IconButton(
tooltip: tr('手电筒'),
tooltip: tr('Flashlight'),
icon: Icon(_torch ? Icons.flash_on : Icons.flash_off),
color: Colors.white,
onPressed: _toggleTorch,
@@ -315,22 +315,22 @@ class _ScanQrScreenState extends State<ScanQrScreen> {
padding: const EdgeInsets.fromLTRB(24, 0, 24, 32),
child: Column(
children: [
AppText(
_hint ?? '把配对二维码放进框内',
Text(
_hint ?? tr('Put the pairing QR code inside the frame'),
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white, fontSize: 14),
),
const SizedBox(height: 6),
const AppText(
'在 OpenChamber 网页端打开「连接设备」,选择二维码',
'In the OpenChamber web app, open “Connect a device” and choose the QR code',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white60, fontSize: 12),
),
if (ready && _frames > 0)
Padding(
padding: const EdgeInsets.only(top: 8),
child: AppText(
trArgs('{0} · 已扫描 {1} 帧 / 解码 {2} 次',
child: Text(
trArgs('{0} · {1} frames scanned / {2} decode attempts',
[_frameShape ?? '', _frames, _decodeAttempts]),
textAlign: TextAlign.center,
style: const TextStyle(