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
+4
-2
@@ -1,6 +1,7 @@
|
||||
// Background commands of a session (opencode's shells), as the first-party
|
||||
// client shows them above the composer: the command, how long it has been
|
||||
// running, and a way to stop it.
|
||||
import '../l10n.dart';
|
||||
import 'models.dart';
|
||||
|
||||
/// One running (or just ended) shell. `id` is the shell id opencode created
|
||||
@@ -238,10 +239,11 @@ const shellOutputTailBytes = 256 * 1024;
|
||||
/// `12秒`, `3分05秒`, `1:02:03`: the running clock a task row shows.
|
||||
String formatElapsed(int milliseconds) {
|
||||
final secs = milliseconds <= 0 ? 0 : milliseconds ~/ 1000;
|
||||
if (secs < 60) return '$secs秒';
|
||||
if (secs < 60) return trArgs('{0}秒', [secs]);
|
||||
if (secs < 3600) {
|
||||
final rest = secs % 60;
|
||||
return '${secs ~/ 60}分${rest.toString().padLeft(2, '0')}秒';
|
||||
return trArgs(
|
||||
'{0}分{1}秒', [secs ~/ 60, rest.toString().padLeft(2, '0')]);
|
||||
}
|
||||
final hours = secs ~/ 3600;
|
||||
final mins = (secs % 3600) ~/ 60;
|
||||
|
||||
Reference in new issue
Block a user