feat: English and Chinese, and selectable chat text

- settings → general → language picks system, Chinese or English; the
  choice is stored on the device and read before the first frame
- our Chinese strings are translated through tr()/trArgs() and AppText,
  with the English in lib/l10n/en_*.dart; a missing entry falls back to
  Chinese and a test checks that every literal in lib has one
- AppText rebuilds on a language change (it depends on the resolved
  locale), so const text and whole pages switch at once; the built-in
  date/time pickers and selection menu follow the same language
- server and user data (titles, messages, prompts, paths) is never
  translated
- the chat list sits in a SelectionArea: long-press selects message text
  and shows the copy/select-all menu
- bump to 0.5.2
This commit is contained in:
blumia committed 2026-11-26 09:04:25 +08:00
1 parent da4bfb6826
commit 7b5bccf28f
42 files changed
+1943 -735

No files matched your search

+4 -2
View File
@@ -7,6 +7,8 @@ import 'dart:convert';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'l10n.dart';
class Connection {
final String id;
final String label;
@@ -168,7 +170,7 @@ class Storage {
final entry = (await _terminalMap(connectionId))[directory];
if (entry is String && entry.isNotEmpty) {
return SavedTerminalTabs(
[SavedTerminalTab(entry, '终端 1')], entry);
[SavedTerminalTab(entry, tr('终端 1'))], entry);
}
if (entry is! Map) return null;
final rawTabs = entry['tabs'];
@@ -180,7 +182,7 @@ class Storage {
final label = raw['label'];
if (id is! String || id.isEmpty) continue;
tabs.add(SavedTerminalTab(
id, label is String && label.trim().isNotEmpty ? label : '终端'));
id, label is String && label.trim().isNotEmpty ? label : tr('终端')));
}
if (tabs.isEmpty) return null;
final active = entry['active'];