feat: write the UI in English, select only conversation content
- source strings are English again; Chinese comes from lib/l10n/zh.dart through tr()/trArgs() and AppText, and a language without a table (Spanish, ...) reads English instead of Chinese - server and user data (titles, messages, file names, notes, task names) is drawn with plain Text, so it is never looked up in the table - SelectionArea moved from the whole message list to the messages, the answer text, an opened tool call's details and the turn footer; status lines and folded tool rows no longer start a selection - a message the transcript does not know (its start event was lost while the stream was down) fetches the tail once, so a turn continued from another client comes in with its prompt - bump to 0.5.3
This commit is contained in:
1 parent
7b5bccf28f
commit
511c3b006b
43 files changed
+1620
-1791
No files matched your search
@@ -21,7 +21,7 @@ Future<void> showFilesPanel(
|
||||
return showGeneralDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
barrierLabel: tr('文件'),
|
||||
barrierLabel: tr('Files'),
|
||||
barrierColor: Colors.black54,
|
||||
transitionDuration: const Duration(milliseconds: 220),
|
||||
pageBuilder: (context, _, __) {
|
||||
@@ -245,7 +245,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
setState(() {
|
||||
_previewLoading = false;
|
||||
_previewError = trArgs(
|
||||
'文件较大({0}),请下载后查看', [_fmtSize(stat.size)]);
|
||||
'File is large ({0}), download it to view', [_fmtSize(stat.size)]);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -285,7 +285,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
_previewText = _editor.text;
|
||||
_previewBinary = false;
|
||||
});
|
||||
_toast('已保存');
|
||||
_toast('Saved');
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
setState(() => _saving = false);
|
||||
@@ -316,9 +316,9 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
fileName: _previewName,
|
||||
bytes: bytes,
|
||||
);
|
||||
if (uri != null) _toast('已保存');
|
||||
if (uri != null) _toast('Saved');
|
||||
} 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 {
|
||||
final client = _client;
|
||||
if (client == null || _path.isEmpty) return;
|
||||
final name = await _askName(directory ? '新建文件夹' : '新建文件');
|
||||
final name = await _askName(directory ? 'New folder' : 'New file');
|
||||
if (name == null) return;
|
||||
final target = '$_path/$name';
|
||||
try {
|
||||
@@ -356,18 +356,18 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
controller: controller,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: tr('名称'),
|
||||
hintText: title == '新建文件夹' ? tr('例如 docs') : tr('例如 notes.md'),
|
||||
labelText: tr('Name'),
|
||||
hintText: title == 'New folder' ? tr('e.g. docs') : tr('e.g. notes.md'),
|
||||
),
|
||||
onSubmitted: (v) => Navigator.of(context).pop(v),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const AppText('取消')),
|
||||
child: const AppText('Cancel')),
|
||||
FilledButton(
|
||||
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() ?? '';
|
||||
if (trimmed.isEmpty) return null;
|
||||
if (trimmed.contains('/') || trimmed.contains('\\')) {
|
||||
_toast(tr('名称里不能有斜杠'));
|
||||
_toast(tr('Names cannot contain slashes'));
|
||||
return null;
|
||||
}
|
||||
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
|
||||
/// closing the panel. Everything else belongs to the tab's own header.
|
||||
Widget _tabs(ThemeData theme) {
|
||||
const labels = ['文件', '项目知识', '终端'];
|
||||
const labels = ['Files', 'Project knowledge', 'Terminal'];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 6, 2, 6),
|
||||
child: Row(
|
||||
@@ -435,7 +435,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
tooltip: tr('关闭侧栏'),
|
||||
tooltip: tr('Close sidebar'),
|
||||
onPressed: () => Navigator.of(context).maybePop(),
|
||||
),
|
||||
],
|
||||
@@ -445,7 +445,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
|
||||
Widget _body(ThemeData theme) {
|
||||
if (_root.isEmpty) {
|
||||
return const Center(child: AppText('这个会话没有关联目录'));
|
||||
return const Center(child: AppText('This session has no directory'));
|
||||
}
|
||||
switch (_tab) {
|
||||
case 1:
|
||||
@@ -487,12 +487,12 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
prefixIcon: const Icon(Icons.search, size: 20),
|
||||
hintText: tr('搜索当前目录…'),
|
||||
hintText: tr('Search this directory…'),
|
||||
suffixIcon: _query.trim().isEmpty
|
||||
? null
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.travel_explore, size: 20),
|
||||
tooltip: tr('搜索子目录'),
|
||||
tooltip: tr('Search subdirectories'),
|
||||
onPressed: _searching ? null : _deepSearch,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
@@ -515,7 +515,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
height: 14,
|
||||
child: CircularProgressIndicator(strokeWidth: 2)),
|
||||
const SizedBox(width: 8),
|
||||
AppText(trArgs('正在搜索子目录…({0})', [_deepResults.length]),
|
||||
AppText(trArgs('Searching subdirectories… ({0})', [_deepResults.length]),
|
||||
style: TextStyle(fontSize: 12, color: theme.hintColor)),
|
||||
],
|
||||
),
|
||||
@@ -537,7 +537,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
IconButton(
|
||||
icon: Icon(preview ? Icons.arrow_back : Icons.arrow_upward,
|
||||
size: 20),
|
||||
tooltip: preview ? tr('返回') : tr('上一级'),
|
||||
tooltip: preview ? tr('Back') : tr('Up one level'),
|
||||
onPressed: preview
|
||||
? () => setState(() => _previewPath = null)
|
||||
: (_path == _root ? null : _up),
|
||||
@@ -548,12 +548,12 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
AppText(_previewName,
|
||||
Text(_previewName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 13.5, fontWeight: FontWeight.w600)),
|
||||
AppText(_previewPath!,
|
||||
Text(_previewPath!,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
@@ -581,7 +581,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
icon: Icon(_editing
|
||||
? Icons.visibility_outlined
|
||||
: Icons.edit_outlined),
|
||||
tooltip: _editing ? tr('预览') : tr('编辑'),
|
||||
tooltip: _editing ? tr('Preview') : tr('Edit'),
|
||||
onPressed:
|
||||
_saving ? null : () => setState(() => _editing = !_editing),
|
||||
),
|
||||
@@ -593,27 +593,27 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: const Icon(Icons.check),
|
||||
tooltip: tr('保存'),
|
||||
tooltip: tr('Save'),
|
||||
onPressed: _saving ? null : _save,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.download_outlined),
|
||||
tooltip: tr('下载'),
|
||||
tooltip: tr('Download'),
|
||||
onPressed: _download,
|
||||
),
|
||||
] else if (_root.isNotEmpty) ...[
|
||||
PopupMenuButton<bool>(
|
||||
icon: const Icon(Icons.add),
|
||||
tooltip: tr('新建'),
|
||||
tooltip: tr('New'),
|
||||
onSelected: (directory) => _newEntry(directory: directory),
|
||||
itemBuilder: (_) => const [
|
||||
PopupMenuItem(value: false, child: AppText('新建文件')),
|
||||
PopupMenuItem(value: true, child: AppText('新建文件夹')),
|
||||
PopupMenuItem(value: false, child: AppText('New file')),
|
||||
PopupMenuItem(value: true, child: AppText('New folder')),
|
||||
],
|
||||
),
|
||||
PopupMenuButton<String>(
|
||||
icon: const Icon(Icons.more_horiz),
|
||||
tooltip: tr('更多'),
|
||||
tooltip: tr('More'),
|
||||
onSelected: (value) {
|
||||
if (value == 'ignored') {
|
||||
setState(() => _showIgnored = !_showIgnored);
|
||||
@@ -626,7 +626,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
CheckedPopupMenuItem(
|
||||
value: 'ignored',
|
||||
checked: _showIgnored,
|
||||
child: const AppText('显示被 git 忽略的文件'),
|
||||
child: const AppText('Show git-ignored files'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'refresh',
|
||||
@@ -634,7 +634,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
children: [
|
||||
Icon(Icons.refresh, size: 18),
|
||||
SizedBox(width: 10),
|
||||
AppText('刷新'),
|
||||
AppText('Refresh'),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -653,7 +653,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4),
|
||||
child: AppText(
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
@@ -674,9 +674,9 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AppText(_error!, textAlign: TextAlign.center),
|
||||
Text(_error!, textAlign: TextAlign.center),
|
||||
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();
|
||||
if (filtered.isEmpty && _deepResults.isEmpty) {
|
||||
return Center(
|
||||
child: AppText(_query.trim().isEmpty ? '目录为空' : '没有匹配的文件',
|
||||
child: AppText(_query.trim().isEmpty ? 'Directory is empty' : 'No matching files',
|
||||
style: TextStyle(color: theme.hintColor)),
|
||||
);
|
||||
}
|
||||
@@ -701,7 +701,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
if (_query.trim().isNotEmpty && _deepResults.isNotEmpty) ...[
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
|
||||
child: AppText('子目录结果',
|
||||
child: AppText('Subdirectory results',
|
||||
style: TextStyle(fontSize: 12, color: theme.hintColor)),
|
||||
),
|
||||
for (final e in _deepResults) _tile(theme, e, showPath: true),
|
||||
@@ -713,7 +713,7 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
filtered.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||
child: AppText('子目录里没有匹配的文件',
|
||||
child: AppText('No matching files in subdirectories',
|
||||
style: TextStyle(fontSize: 12, color: theme.hintColor)),
|
||||
),
|
||||
],
|
||||
@@ -730,10 +730,10 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
color: entry.isDirectory
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurfaceVariant),
|
||||
title: AppText(entry.name,
|
||||
title: Text(entry.name,
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis, style: const TextStyle(fontSize: 14)),
|
||||
subtitle: showPath
|
||||
? AppText(_relative(entry.path),
|
||||
? Text(_relative(entry.path),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 11, color: theme.hintColor))
|
||||
@@ -770,10 +770,10 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AppText(_previewError!, textAlign: TextAlign.center),
|
||||
Text(_previewError!, textAlign: TextAlign.center),
|
||||
const SizedBox(height: 8),
|
||||
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,
|
||||
size: 40, color: theme.hintColor),
|
||||
const SizedBox(height: 10),
|
||||
AppText('这个文件无法预览',
|
||||
AppText('This file cannot be previewed',
|
||||
style: TextStyle(color: theme.hintColor)),
|
||||
const SizedBox(height: 6),
|
||||
AppText(_fmtSize(_previewBytes?.length ?? 0),
|
||||
Text(_fmtSize(_previewBytes?.length ?? 0),
|
||||
style: TextStyle(fontSize: 12, color: theme.hintColor)),
|
||||
const SizedBox(height: 8),
|
||||
OutlinedButton.icon(
|
||||
onPressed: _download,
|
||||
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)
|
||||
: null;
|
||||
return AlertDialog(
|
||||
title: const AppText('正在下载'),
|
||||
title: const AppText('Downloading'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(widget.name,
|
||||
Text(widget.name,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 13)),
|
||||
@@ -1017,16 +1017,16 @@ class _DownloadDialogState extends State<_DownloadDialog> {
|
||||
const SizedBox(height: 8),
|
||||
AppText(
|
||||
total != null
|
||||
? trArgs('{0} / {1}({2}%)', [
|
||||
? trArgs('{0} / {1} ({2}%)', [
|
||||
_size(_received),
|
||||
_size(total),
|
||||
(fraction! * 100).toStringAsFixed(0),
|
||||
])
|
||||
: trArgs('已下载 {0}', [_size(_received)]),
|
||||
: trArgs('Downloaded {0}', [_size(_received)]),
|
||||
style: TextStyle(fontSize: 12, color: theme.hintColor),
|
||||
),
|
||||
] else
|
||||
AppText(_error!,
|
||||
Text(_error!,
|
||||
style:
|
||||
TextStyle(fontSize: 12.5, color: theme.colorScheme.error)),
|
||||
],
|
||||
@@ -1040,12 +1040,12 @@ class _DownloadDialogState extends State<_DownloadDialog> {
|
||||
setState(() => _cancelling = true);
|
||||
_cancel.cancel();
|
||||
},
|
||||
child: AppText(_cancelling ? '正在取消…' : '取消'),
|
||||
child: AppText(_cancelling ? 'Canceling…' : 'Cancel'),
|
||||
)
|
||||
else
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const AppText('关闭'),
|
||||
child: const AppText('Close'),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user