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

+5 -4
View File
@@ -6,6 +6,7 @@ import '../api/models.dart';
import '../model_prefs.dart';
import '../state.dart';
import 'model_picker.dart';
import '../l10n.dart';
/// `deepseek-flash · 高` — model and effort together, as dsh-Go shows them.
class ModelPill extends StatelessWidget {
@@ -89,7 +90,7 @@ class ModeChip extends StatelessWidget {
children: [
const Padding(
padding: EdgeInsets.fromLTRB(20, 4, 20, 8),
child: Text('模式',
child: AppText('模式',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700)),
),
for (final id in ids)
@@ -98,13 +99,13 @@ class ModeChip extends StatelessWidget {
id == 'plan' ? Icons.map_outlined : Icons.construction_outlined,
color: id == current ? scheme.primary : null,
),
title: Text(
title: AppText(
names[id]?.isNotEmpty == true ? names[id]! : _label(id),
style: TextStyle(
fontWeight: id == current ? FontWeight.w700 : FontWeight.w400,
),
),
subtitle: Text(id == 'plan' ? '先规划,不改动文件' : '直接构建',
subtitle: AppText(id == 'plan' ? '先规划,不改动文件' : '直接构建',
style: const TextStyle(fontSize: 12)),
trailing: id == current
? Icon(Icons.check, size: 20, color: scheme.primary)
@@ -150,7 +151,7 @@ class _Pill extends StatelessWidget {
Icon(icon, size: 14, color: theme.hintColor),
const SizedBox(width: 4),
Flexible(
child: Text(
child: AppText(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,