chore(i18n): migrate start stop keys to fl_lib (#1057)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
|
||||
enum ContainerMenu {
|
||||
start,
|
||||
@@ -37,12 +36,12 @@ enum ContainerMenu {
|
||||
};
|
||||
|
||||
String get toStr => switch (this) {
|
||||
ContainerMenu.start => l10n.start,
|
||||
ContainerMenu.stop => l10n.stop,
|
||||
ContainerMenu.restart => l10n.restart,
|
||||
ContainerMenu.start => libL10n.start,
|
||||
ContainerMenu.stop => libL10n.stop,
|
||||
ContainerMenu.restart => libL10n.restart,
|
||||
ContainerMenu.rm => libL10n.delete,
|
||||
ContainerMenu.logs => libL10n.log,
|
||||
ContainerMenu.terminal => l10n.terminal,
|
||||
ContainerMenu.terminal => libL10n.terminal,
|
||||
// DockerMenuType.stats => s.stats,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,34 +23,34 @@ class MacOSMenuBarManager {
|
||||
onSelected: () => _showAboutDialog(context),
|
||||
),
|
||||
PlatformMenuItem(
|
||||
label: l10n.menuSettings,
|
||||
label: libL10n.menuSettings,
|
||||
shortcut: const SingleActivator(LogicalKeyboardKey.comma, meta: true),
|
||||
onSelected: () => _openSettings(context),
|
||||
),
|
||||
PlatformMenuItem(
|
||||
label: l10n.menuQuit,
|
||||
label: libL10n.menuQuit,
|
||||
shortcut: const SingleActivator(LogicalKeyboardKey.keyQ, meta: true),
|
||||
onSelected: () => SystemNavigator.pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
PlatformMenu(
|
||||
label: l10n.menuNavigate,
|
||||
label: libL10n.menuNavigate,
|
||||
menus: _buildNavigateMenuItems(l10n, homeTabs, onTabChanged),
|
||||
),
|
||||
PlatformMenu(
|
||||
label: l10n.menuInfo,
|
||||
label: libL10n.menuInfo,
|
||||
menus: [
|
||||
PlatformMenuItem(
|
||||
label: l10n.menuGitHubRepository,
|
||||
onSelected: () => _openURL(Urls.thisRepo),
|
||||
),
|
||||
PlatformMenuItem(
|
||||
label: l10n.menuWiki,
|
||||
label: libL10n.menuWiki,
|
||||
onSelected: () => _openURL(Urls.appWiki),
|
||||
),
|
||||
PlatformMenuItem(
|
||||
label: l10n.menuHelp,
|
||||
label: libL10n.menuHelp,
|
||||
onSelected: () => _openURL(Urls.appHelp),
|
||||
),
|
||||
],
|
||||
@@ -65,10 +65,10 @@ class MacOSMenuBarManager {
|
||||
) {
|
||||
final menuItems = <PlatformMenuItem>[];
|
||||
final tabLabels = {
|
||||
AppTab.server: l10n.server,
|
||||
AppTab.server: libL10n.server,
|
||||
AppTab.ssh: 'SSH',
|
||||
AppTab.file: libL10n.file,
|
||||
AppTab.snippet: l10n.snippet,
|
||||
AppTab.snippet: libL10n.snippet,
|
||||
};
|
||||
for (var i = 0; i < homeTabs.length; i++) {
|
||||
final tab = homeTabs[i];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:icons_plus/icons_plus.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
import 'package:server_box/data/res/store.dart';
|
||||
|
||||
enum ServerFuncBtn {
|
||||
@@ -52,11 +52,11 @@ enum ServerFuncBtn {
|
||||
|
||||
String get toStr => switch (this) {
|
||||
sftp => 'SFTP',
|
||||
snippet => l10n.snippet,
|
||||
//pkg => l10n.pkg,
|
||||
container => l10n.container,
|
||||
process => l10n.process,
|
||||
terminal => l10n.terminal,
|
||||
snippet => libL10n.snippet,
|
||||
//pkg => libL10n.pkg,
|
||||
container => libL10n.container,
|
||||
process => libL10n.process,
|
||||
terminal => libL10n.terminal,
|
||||
iperf => 'iperf',
|
||||
systemd => 'Systemd',
|
||||
};
|
||||
|
||||
@@ -14,8 +14,8 @@ enum NetViewType {
|
||||
};
|
||||
|
||||
String get toStr => switch (this) {
|
||||
NetViewType.conn => l10n.conn,
|
||||
NetViewType.traffic => l10n.traffic,
|
||||
NetViewType.conn => libL10n.conn,
|
||||
NetViewType.traffic => libL10n.traffic,
|
||||
NetViewType.speed => l10n.speed,
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ enum NetViewType {
|
||||
try {
|
||||
switch (this) {
|
||||
case NetViewType.conn:
|
||||
return ('${l10n.conn}:\n${ss.tcp.maxConn}', '${libL10n.fail}:\n${ss.tcp.fail}');
|
||||
return ('${libL10n.conn}:\n${ss.tcp.maxConn}', '${libL10n.fail}:\n${ss.tcp.fail}');
|
||||
case NetViewType.speed:
|
||||
if (notSepcifyDev) {
|
||||
return ('↓:\n${ss.netSpeed.cachedVals.speedIn}', '↑:\n${ss.netSpeed.cachedVals.speedOut}');
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:icons_plus/icons_plus.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
@@ -306,11 +307,11 @@ enum WindowsStatusCmdType implements ShellCmdType {
|
||||
extension StatusCmdTypeX on StatusCmdType {
|
||||
String get i18n => switch (this) {
|
||||
StatusCmdType.sys => l10n.system,
|
||||
StatusCmdType.host => l10n.host,
|
||||
StatusCmdType.uptime => l10n.uptime,
|
||||
StatusCmdType.battery => l10n.battery,
|
||||
StatusCmdType.sensors => l10n.sensors,
|
||||
StatusCmdType.disk => l10n.disk,
|
||||
StatusCmdType.host => libL10n.host,
|
||||
StatusCmdType.uptime => libL10n.uptime,
|
||||
StatusCmdType.battery => libL10n.battery,
|
||||
StatusCmdType.sensors => libL10n.sensors,
|
||||
StatusCmdType.disk => libL10n.disk,
|
||||
final val => val.name,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -36,14 +36,14 @@ enum ServerDetailCards {
|
||||
mem => 'RAM',
|
||||
swap => 'Swap',
|
||||
gpu => 'GPU',
|
||||
disk => l10n.disk,
|
||||
disk => libL10n.disk,
|
||||
smart => l10n.diskHealth,
|
||||
net => l10n.net,
|
||||
sensor => l10n.sensors,
|
||||
temp => l10n.temperature,
|
||||
battery => l10n.battery,
|
||||
net => libL10n.net,
|
||||
sensor => libL10n.sensors,
|
||||
temp => libL10n.temperature,
|
||||
battery => libL10n.battery,
|
||||
pve => 'PVE',
|
||||
custom => l10n.cmd,
|
||||
custom => libL10n.cmd,
|
||||
};
|
||||
|
||||
/// If:
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive_ce_flutter/adapters.dart';
|
||||
import 'package:icons_plus/icons_plus.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
import 'package:server_box/view/page/server/tab/tab.dart';
|
||||
// import 'package:server_box/view/page/setting/entry.dart';
|
||||
import 'package:server_box/view/page/snippet/list.dart';
|
||||
@@ -38,7 +37,7 @@ enum AppTab {
|
||||
return switch (this) {
|
||||
server => NavigationDestination(
|
||||
icon: const Icon(BoxIcons.bx_server),
|
||||
label: l10n.server,
|
||||
label: libL10n.server,
|
||||
selectedIcon: const Icon(BoxIcons.bxs_server),
|
||||
),
|
||||
// settings => NavigationDestination(
|
||||
@@ -53,7 +52,7 @@ enum AppTab {
|
||||
),
|
||||
snippet => NavigationDestination(
|
||||
icon: const Icon(Icons.code),
|
||||
label: l10n.snippet,
|
||||
label: libL10n.snippet,
|
||||
selectedIcon: const Icon(Icons.code),
|
||||
),
|
||||
file => NavigationDestination(
|
||||
@@ -68,7 +67,7 @@ enum AppTab {
|
||||
return switch (this) {
|
||||
server => NavigationRailDestination(
|
||||
icon: const Icon(BoxIcons.bx_server),
|
||||
label: Text(l10n.server),
|
||||
label: Text(libL10n.server),
|
||||
selectedIcon: const Icon(BoxIcons.bxs_server),
|
||||
),
|
||||
// settings => NavigationRailDestination(
|
||||
@@ -83,7 +82,7 @@ enum AppTab {
|
||||
),
|
||||
snippet => NavigationRailDestination(
|
||||
icon: const Icon(Icons.code),
|
||||
label: Text(l10n.snippet),
|
||||
label: Text(libL10n.snippet),
|
||||
selectedIcon: const Icon(Icons.code),
|
||||
),
|
||||
file => NavigationRailDestination(
|
||||
|
||||
@@ -59,7 +59,7 @@ final class PodmanPs implements ContainerPs {
|
||||
final stats = json.decode(s);
|
||||
final cpuD = (stats['CPU'] as double? ?? 0).toStringAsFixed(1);
|
||||
final cpuAvgD = (stats['AvgCPU'] as double? ?? 0).toStringAsFixed(1);
|
||||
cpu = '$cpuD% / ${l10n.pingAvg} $cpuAvgD%';
|
||||
cpu = '$cpuD% / ${libL10n.pingAvg} $cpuAvgD%';
|
||||
final memLimit = (stats['MemLimit'] as int? ?? 0).bytes2Str;
|
||||
final memUsage = (stats['MemUsage'] as int? ?? 0).bytes2Str;
|
||||
mem = '$memUsage / $memLimit';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
|
||||
/// Represents the various states a container can be in.
|
||||
/// Supports both Docker and Podman container status parsing.
|
||||
@@ -57,7 +56,7 @@ enum ContainerStatus {
|
||||
/// Get display string for the status
|
||||
String get displayName {
|
||||
return switch (this) {
|
||||
ContainerStatus.running => l10n.running,
|
||||
ContainerStatus.running => libL10n.running,
|
||||
ContainerStatus.exited => libL10n.exit,
|
||||
ContainerStatus.created => 'Created',
|
||||
ContainerStatus.paused => 'Paused',
|
||||
|
||||
@@ -18,10 +18,10 @@ enum PveResType {
|
||||
};
|
||||
|
||||
String get toStr => switch (this) {
|
||||
PveResType.node => l10n.node,
|
||||
PveResType.node => libL10n.node,
|
||||
PveResType.qemu => 'QEMU',
|
||||
PveResType.lxc => 'LXC',
|
||||
PveResType.storage => l10n.storage,
|
||||
PveResType.storage => libL10n.storage,
|
||||
PveResType.sdn => 'SDN',
|
||||
};
|
||||
}
|
||||
@@ -131,7 +131,7 @@ final class PveLxc extends PveResIface implements PveCtrlIface {
|
||||
if (available) {
|
||||
return uptime.secondsToDuration().toAgoStr;
|
||||
}
|
||||
return l10n.stopped;
|
||||
return libL10n.stopped;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ final class PveQemu extends PveResIface implements PveCtrlIface {
|
||||
if (available) {
|
||||
return uptime.secondsToDuration().toAgoStr;
|
||||
}
|
||||
return l10n.stopped;
|
||||
return libL10n.stopped;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ final class PveNode extends PveResIface {
|
||||
if (isRunning) {
|
||||
return uptime.secondsToDuration().toAgoStr;
|
||||
}
|
||||
return l10n.stopped;
|
||||
return libL10n.stopped;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,9 +316,9 @@ final class PveStorage extends PveResIface implements PveCtrlIface {
|
||||
@override
|
||||
String get summary {
|
||||
if (available) {
|
||||
return '${l10n.used}: ${disk.bytes2Str} / ${l10n.total}: ${maxdisk.bytes2Str}';
|
||||
return '${l10n.used}: ${disk.bytes2Str} / ${libL10n.total}: ${maxdisk.bytes2Str}';
|
||||
}
|
||||
return l10n.notAvailable;
|
||||
return libL10n.notAvailable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ final class PveSdn extends PveResIface implements PveCtrlIface {
|
||||
String get name => sdn;
|
||||
|
||||
@override
|
||||
String get summary => available ? status : l10n.notAvailable;
|
||||
String get summary => available ? status : libL10n.notAvailable;
|
||||
}
|
||||
|
||||
final class PveRes {
|
||||
|
||||
Reference in New Issue
Block a user