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:
1 parent
da4bfb6826
commit
7b5bccf28f
42 files changed
+1943
-735
No files matched your search
@@ -6,6 +6,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../l10n.dart';
|
||||
|
||||
class ComposerAttachment {
|
||||
final String name;
|
||||
@@ -35,7 +36,7 @@ Future<List<ComposerAttachment>> pickComposerAttachments(
|
||||
if (bytes.length > 10 * 1024 * 1024) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('附件不能超过 10MB')));
|
||||
const SnackBar(content: AppText('附件不能超过 10MB')));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -83,7 +84,7 @@ class AttachmentTray extends StatelessWidget {
|
||||
: const Icon(Icons.insert_drive_file, size: 16),
|
||||
label: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 160),
|
||||
child: Text(items[i].name,
|
||||
child: AppText(items[i].name,
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
onDeleted: () => onRemove(i),
|
||||
@@ -132,4 +133,4 @@ Future<String?> _keepImage(String src, String name) async {
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user