chore(i18n): migrate start stop keys to fl_lib (#1057)

This commit is contained in:
lollipopkit🏳️‍⚧️
2026-02-27 23:36:59 +08:00
committed by GitHub
parent 2166e27771
commit c3678f3df9
75 changed files with 137 additions and 4220 deletions

View File

@@ -116,7 +116,7 @@ class _ConnectionStatsPageState extends State<ConnectionStatsPage> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildStatItem(l10n.totalAttempts, stats.totalAttempts.toString(), Icons.all_inclusive),
_buildStatItem(libL10n.totalAttempts, stats.totalAttempts.toString(), Icons.all_inclusive),
_buildStatItem(
libL10n.success,
stats.successCount.toString(),
@@ -237,7 +237,7 @@ class _ConnectionStatsPageState extends State<ConnectionStatsPage> {
}
}
},
child: Text(l10n.confirm),
child: Text(libL10n.confirm),
),
],
);

View File

@@ -124,7 +124,7 @@ class _ServerDetailPageState extends ConsumerState<ServerDetailPage> with Single
style: TextStyle(fontSize: 20, color: context.isDark ? Colors.white : Colors.black),
),
actions: [
QrShareBtn(data: si.spi.toJsonString(), tip: si.spi.name, tip2: '${l10n.server} ~ ServerBox'),
QrShareBtn(data: si.spi.toJsonString(), tip: si.spi.name, tip2: '${libL10n.server} ~ ServerBox'),
IconButton(
icon: const Icon(Icons.edit),
onPressed: () async {
@@ -551,7 +551,7 @@ class _ServerDetailPageState extends ConsumerState<ServerDetailPage> with Single
if (children.isEmpty) return null;
return ExpandTile(
title: Text(l10n.disk),
title: Text(libL10n.disk),
childrenPadding: const EdgeInsets.only(bottom: 7),
leading: Icon(ServerDetailCards.disk.icon, size: 17),
initiallyExpanded: _getInitExpand(children.length),
@@ -790,7 +790,7 @@ class _ServerDetailPageState extends ConsumerState<ServerDetailPage> with Single
leading: Icon(ServerDetailCards.net.icon, size: 17),
title: Row(
children: [
Text(l10n.net),
Text(libL10n.net),
UIs.width13,
_netSortType.listenVal(
(val) => InkWell(
@@ -859,7 +859,7 @@ class _ServerDetailPageState extends ConsumerState<ServerDetailPage> with Single
return CardX(
child: ExpandTile(
title: Text(l10n.temperature),
title: Text(libL10n.temperature),
leading: const Icon(Icons.ac_unit, size: 20),
initiallyExpanded: _getInitExpand(ss.temps.devices.length),
childrenPadding: const EdgeInsets.only(bottom: 7),
@@ -891,7 +891,7 @@ class _ServerDetailPageState extends ConsumerState<ServerDetailPage> with Single
return CardX(
child: ExpandTile(
title: Text(l10n.battery),
title: Text(libL10n.battery),
leading: const Icon(Icons.battery_charging_full, size: 17),
childrenPadding: const EdgeInsets.only(bottom: 7),
initiallyExpanded: _getInitExpand(ss.batteries.length, 2),
@@ -925,7 +925,7 @@ class _ServerDetailPageState extends ConsumerState<ServerDetailPage> with Single
if (ss.sensors.isEmpty) return UIs.placeholder;
return CardX(
child: ExpandTile(
title: Text(l10n.sensors),
title: Text(libL10n.sensors),
leading: const Icon(Icons.thermostat, size: 17),
childrenPadding: const EdgeInsets.only(bottom: 7),
initiallyExpanded: _getInitExpand(ss.sensors.length, 2),

View File

@@ -75,7 +75,7 @@ class _SshDiscoveryPageState extends ConsumerState<SshDiscoveryPage> {
children: [
Text(l10n.discoverySummary, style: const TextStyle(fontWeight: FontWeight.bold)),
UIs.height7,
Text('${libL10n.found}: ${report.count} ${l10n.servers}'),
Text('${libL10n.found}: ${report.count} ${libL10n.servers}'),
Text('${libL10n.duration}: ${report.durationMs}ms'),
Text(
'${l10n.finishedAt}: ${DateTime.parse(report.generatedAt).toLocal().toString().substring(0, 16)}',

View File

@@ -25,12 +25,12 @@ extension _Actions on _ServerEditPageState {
if (_nameController.text.isEmpty) {
_nameController.text = server.ip;
}
context.showSnackBar('${libL10n.found} 1 ${l10n.server}');
context.showSnackBar('${libL10n.found} 1 ${libL10n.server}');
} else {
// Multiple servers - show import dialog
final shouldImport = await context.showRoundDialog<bool>(
title: libL10n.import,
child: Text(libL10n.askContinue('${libL10n.found} ${discoveredServers.length} ${l10n.servers}')),
child: Text(libL10n.askContinue('${libL10n.found} ${discoveredServers.length} ${libL10n.servers}')),
actions: Btnx.cancelOk,
);
@@ -46,7 +46,7 @@ extension _Actions on _ServerEditPageState {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('${libL10n.found} ${discoveredServers.length} ${l10n.servers}.'),
Text('${libL10n.found} ${discoveredServers.length} ${libL10n.servers}.'),
const SizedBox(height: 8),
Text(libL10n.setting),
const SizedBox(height: 8),
@@ -99,7 +99,7 @@ extension _Actions on _ServerEditPageState {
dprint('Failed to import server ${server.name}: $e');
}
}
context.showSnackBar('${libL10n.success}: $imported ${l10n.servers}');
context.showSnackBar('${libL10n.success}: $imported ${libL10n.servers}');
if (mounted) context.pop(true);
}
@@ -221,7 +221,7 @@ extension _Actions on _ServerEditPageState {
void _onSave() async {
if (_ipController.text.isEmpty) {
context.showSnackBar('${libL10n.empty} ${l10n.host}');
context.showSnackBar('${libL10n.empty} ${libL10n.host}');
return;
}
@@ -369,7 +369,7 @@ extension _Utils on _ServerEditPageState {
Future<void> _showCmdTypesDialog(Set<ShellCmdType> allCmdTypes) {
return context.showRoundDialog(
title: '${libL10n.disabled} ${l10n.cmd}',
title: '${libL10n.disabled} ${libL10n.cmd}',
child: SizedBox(
width: 270,
child: _disabledCmdTypes.listenVal((disabled) {

View File

@@ -160,7 +160,7 @@ class _ServerEditPageState extends ConsumerState<ServerEditPage> with AfterLayou
type: TextInputType.url,
onSubmitted: (_) => _focusScope.requestFocus(_portFocus),
node: _ipFocus,
label: l10n.host,
label: libL10n.host,
icon: BoxIcons.bx_server,
hint: 'example.com',
suggestion: false,
@@ -170,7 +170,7 @@ class _ServerEditPageState extends ConsumerState<ServerEditPage> with AfterLayou
type: TextInputType.number,
node: _portFocus,
onSubmitted: (_) => _focusScope.requestFocus(_usernameFocus),
label: l10n.port,
label: libL10n.port,
icon: Bootstrap.number_123,
hint: '22',
suggestion: false,

View File

@@ -157,7 +157,7 @@ extension _Widgets on _ServerEditPageState {
return Input(
controller: _scriptDirCtrl,
type: TextInputType.text,
label: '${l10n.remotePath} (Shell ${l10n.install})',
label: '${l10n.remotePath} (Shell ${libL10n.install})',
icon: Icons.folder,
hint: '~/.config/server_box',
suggestion: false,
@@ -176,7 +176,7 @@ extension _Widgets on _ServerEditPageState {
Input(
controller: _preferTempDevCtrl,
type: TextInputType.text,
label: l10n.temperature,
label: libL10n.temperature,
icon: MingCute.low_temperature_line,
hint: 'nvme-pci-0400',
suggestion: false,
@@ -184,7 +184,7 @@ extension _Widgets on _ServerEditPageState {
Input(
controller: _netDevCtrl,
type: TextInputType.text,
label: l10n.net,
label: libL10n.net,
icon: ZondIcons.network,
hint: 'eth0',
suggestion: false,
@@ -278,7 +278,7 @@ extension _Widgets on _ServerEditPageState {
leading: const Icon(MingCute.doc_line),
title: Text(libL10n.doc),
trailing: const Icon(Icons.open_in_new, size: 17),
onTap: l10n.customCmdDocUrl.launchUrl,
onTap: libL10n.customCmdDocUrl.launchUrl,
).cardx,
],
);
@@ -288,11 +288,11 @@ extension _Widgets on _ServerEditPageState {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
CenterGreyTitle('${libL10n.disabled} ${l10n.cmd}'),
CenterGreyTitle('${libL10n.disabled} ${libL10n.cmd}'),
_disabledCmdTypes.listenVal((disabled) {
return ListTile(
leading: const Icon(Icons.disabled_by_default),
title: Text('${libL10n.disabled} ${l10n.cmd}'),
title: Text('${libL10n.disabled} ${libL10n.cmd}'),
subtitle: disabled.isEmpty
? null
: Text(disabled.join(', '), style: UIs.textGrey),
@@ -458,7 +458,7 @@ extension _Widgets on _ServerEditPageState {
title: libL10n.attention,
child: Text(
libL10n.askContinue(
'${libL10n.delete} ${l10n.server}(${spi!.name})',
'${libL10n.delete} ${libL10n.server}(${spi!.name})',
),
),
actions: Btn.ok(

View File

@@ -270,19 +270,19 @@ class _ServerPageState extends ConsumerState<ServerPage>
Btn.column(
onTap: () => _onTapSuspend(srv),
icon: const Icon(Icons.stop, color: color),
text: l10n.suspend,
text: libL10n.suspend,
textStyle: textStyle,
),
Btn.column(
onTap: () => _onTapShutdown(srv),
icon: const Icon(Icons.power_off, color: color),
text: l10n.shutdown,
text: libL10n.shutdown,
textStyle: textStyle,
),
Btn.column(
onTap: () => _onTapReboot(srv),
icon: const Icon(Icons.restart_alt, color: color),
text: l10n.reboot,
text: libL10n.reboot,
textStyle: textStyle,
),
Btn.column(

View File

@@ -41,7 +41,7 @@ final class _TopBar extends ConsumerWidget implements PreferredSizeWidget {
if (conn.index >= ServerConn.connected.index) connected++;
}
final total = order.length;
final connectionText = '$connected/$total ${context.l10n.conn}';
final connectionText = '$connected/$total ${context.libL10n.conn}';
leading = InkWell(
onTap: () => ConnectionStatsPage.route.go(context),
child: Text(connectionText, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),

View File

@@ -56,7 +56,7 @@ extension _Operation on _ServerPageState {
) ??
(null, '');
},
typ: l10n.suspend,
typ: libL10n.suspend,
name: srv.spi.name,
);
}
@@ -70,7 +70,7 @@ extension _Operation on _ServerPageState {
id: srv.id,
);
},
typ: l10n.shutdown,
typ: libL10n.shutdown,
name: srv.spi.name,
);
}
@@ -85,7 +85,7 @@ extension _Operation on _ServerPageState {
) ??
(null, '');
},
typ: l10n.reboot,
typ: libL10n.reboot,
name: srv.spi.name,
);
}
@@ -127,7 +127,7 @@ extension _Utils on _ServerPageState {
void _askFor({required void Function() func, required String typ, required String name}) {
context.showRoundDialog(
title: libL10n.attention,
child: Text(libL10n.askContinue('$typ ${l10n.server}($name)')),
child: Text(libL10n.askContinue('$typ ${libL10n.server}($name)')),
actions: Btn.ok(
onTap: () {
context.pop();