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

+6 -5
View File
@@ -3,6 +3,7 @@
import 'package:flutter/material.dart';
import '../state.dart';
import '../l10n.dart';
const _slashLabels = {
'compact': '压缩',
@@ -83,11 +84,11 @@ class SlashPalette extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title,
AppText(title,
style:
TextStyle(fontSize: 14, color: scheme.onSurface)),
if (subtitle.isNotEmpty)
Text(subtitle,
AppText(subtitle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@@ -159,7 +160,7 @@ class SlashPalette extends StatelessWidget {
children: [
Row(
children: [
Text('/${item.name}',
AppText('/${item.name}',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
@@ -167,7 +168,7 @@ class SlashPalette extends StatelessWidget {
if (label != null)
Padding(
padding: const EdgeInsets.only(left: 6),
child: Text(label,
child: AppText(label,
style: TextStyle(
fontSize: 12,
color: scheme.onSurfaceVariant)),
@@ -175,7 +176,7 @@ class SlashPalette extends StatelessWidget {
],
),
if (item.description.isNotEmpty)
Text(item.description,
AppText(item.description,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(