mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 11:24:46 +08:00
feat: app full l10n support
This commit is contained in:
@ -18,57 +18,71 @@ class SettingsUI extends HookConsumerWidget {
|
||||
margin: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
makeSettingsItem(const Icon(FluentIcons.link, size: 20), S.current.setting_action_create_settings_shortcut,
|
||||
subTitle: S.current.setting_action_create_desktop_shortcut, onTap: ()=> model.addShortCut(context)),
|
||||
makeSettingsItem(const Icon(FluentIcons.link, size: 20),
|
||||
S.current.setting_action_create_settings_shortcut,
|
||||
subTitle: S.current.setting_action_create_desktop_shortcut,
|
||||
onTap: () => model.addShortCut(context)),
|
||||
if (ConstConf.isMSE) ...[
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(
|
||||
const Icon(FluentIcons.reset_device, size: 20), S.current.setting_action_reset_auto_password_fill,
|
||||
subTitle:
|
||||
"启用:${sate.isEnableAutoLogin ? "已启用" : "已禁用"} 设备支持:${sate.isDeviceSupportWinHello ? "支持" : "不支持"} 邮箱:${sate.autoLoginEmail} 密码:${sate.isEnableAutoLoginPwd ? "已加密保存" : "未保存"}",
|
||||
onTap: ()=> model.onResetAutoLogin(context)),
|
||||
makeSettingsItem(const Icon(FluentIcons.reset_device, size: 20),
|
||||
S.current.setting_action_reset_auto_password_fill,
|
||||
subTitle: S.current.setting_action_info_device_support_info(
|
||||
sate.isEnableAutoLogin
|
||||
? S.current.setting_action_info_enabled
|
||||
: S.current.setting_action_info_disabled,
|
||||
sate.isDeviceSupportWinHello
|
||||
? S.current.setting_action_info_support
|
||||
: S.current.setting_action_info_not_support,
|
||||
sate.autoLoginEmail,
|
||||
sate.isEnableAutoLoginPwd
|
||||
? S.current.setting_action_info_encrypted_saved
|
||||
: S.current.setting_action_info_not_saved),
|
||||
onTap: () => model.onResetAutoLogin(context)),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(const Icon(FontAwesomeIcons.microchip, size: 20),
|
||||
S.current.setting_action_ignore_efficiency_cores_on_launch,
|
||||
subTitle:
|
||||
"已设置的核心数量:${sate.inputGameLaunchECore} (此功能适用于首页的盒子一键启动 或 工具中的RSI启动器管理员模式,当为 0 时不启用此功能 )",
|
||||
onTap:()=> model.setGameLaunchECore(context)),
|
||||
subTitle: S.current
|
||||
.setting_action_set_core_count(sate.inputGameLaunchECore),
|
||||
onTap: () => model.setGameLaunchECore(context)),
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(const Icon(FluentIcons.folder_open, size: 20),
|
||||
S.current.setting_action_set_launcher_file,
|
||||
subTitle: sate.customLauncherPath != null
|
||||
? "${sate.customLauncherPath}"
|
||||
: S.current.setting_action_info_manual_launcher_location_setting,
|
||||
onTap: ()=> model.setLauncherPath(context), onDel: () {
|
||||
model.delName("custom_launcher_path");
|
||||
}),
|
||||
: S.current
|
||||
.setting_action_info_manual_launcher_location_setting,
|
||||
onTap: () => model.setLauncherPath(context),
|
||||
onDel: () {
|
||||
model.delName("custom_launcher_path");
|
||||
}),
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(const Icon(FluentIcons.game, size: 20),
|
||||
S.current.setting_action_set_game_file,
|
||||
subTitle: sate.customGamePath != null
|
||||
? "${sate.customGamePath}"
|
||||
: S.current.setting_action_info_manual_game_location_setting,
|
||||
onTap: ()=> model.setGamePath(context), onDel: () {
|
||||
model.delName("custom_game_path");
|
||||
}),
|
||||
onTap: () => model.setGamePath(context),
|
||||
onDel: () {
|
||||
model.delName("custom_game_path");
|
||||
}),
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(const Icon(FluentIcons.delete, size: 20), S.current.setting_action_clear_translation_file_cache,
|
||||
subTitle:
|
||||
"缓存大小 ${(sate.locationCacheSize / 1024 / 1024).toStringAsFixed(2)}MB,清理盒子下载的汉化文件缓存,不会影响已安装的汉化",
|
||||
onTap: ()=> model.cleanLocationCache(context)),
|
||||
makeSettingsItem(const Icon(FluentIcons.delete, size: 20),
|
||||
S.current.setting_action_clear_translation_file_cache,
|
||||
subTitle: S.current.setting_action_info_cache_clearing_info(
|
||||
(sate.locationCacheSize / 1024 / 1024).toStringAsFixed(2)),
|
||||
onTap: () => model.cleanLocationCache(context)),
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(
|
||||
const Icon(FluentIcons.speed_high, size: 20), S.current.setting_action_tool_site_access_acceleration,
|
||||
makeSettingsItem(const Icon(FluentIcons.speed_high, size: 20),
|
||||
S.current.setting_action_tool_site_access_acceleration,
|
||||
onTap: () =>
|
||||
model.onChangeToolSiteMirror(!sate.isEnableToolSiteMirrors),
|
||||
subTitle:
|
||||
S.current.setting_action_info_mirror_server_info,
|
||||
subTitle: S.current.setting_action_info_mirror_server_info,
|
||||
onSwitch: model.onChangeToolSiteMirror,
|
||||
switchStatus: sate.isEnableToolSiteMirrors),
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(
|
||||
const Icon(FluentIcons.document_set, size: 20), S.current.setting_action_view_log,
|
||||
makeSettingsItem(const Icon(FluentIcons.document_set, size: 20),
|
||||
S.current.setting_action_view_log,
|
||||
onTap: () => model.showLogs(),
|
||||
subTitle: S.current.setting_action_info_view_log_file),
|
||||
],
|
||||
@ -129,4 +143,4 @@ class SettingsUI extends HookConsumerWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,9 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
}
|
||||
|
||||
Future<void> onResetAutoLogin(BuildContext context) async {
|
||||
final ok = await showConfirmDialogs(context, S.current.setting_action_info_confirm_reset_autofill,
|
||||
final ok = await showConfirmDialogs(
|
||||
context,
|
||||
S.current.setting_action_info_confirm_reset_autofill,
|
||||
Text(S.current.setting_action_info_delete_local_account_warning));
|
||||
if (ok) {
|
||||
final userBox = await Hive.openBox("rsi_account_data");
|
||||
@ -90,8 +92,7 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
if (!context.mounted) return;
|
||||
final input = await showInputDialogs(context,
|
||||
title: S.current.setting_action_info_enter_cpu_core_to_ignore,
|
||||
content:
|
||||
"Tip:您的设备拥有几个能效核心就输入几,非大小核设备请保持 0\n\n此功能适用于首页的盒子一键启动 或 工具中的 RSI启动器管理员模式,当为 0 时不启用此功能。",
|
||||
content: S.current.setting_action_info_cpu_core_tip,
|
||||
initialValue: defaultInput,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly]);
|
||||
if (input == null) return;
|
||||
@ -175,7 +176,9 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
|
||||
Future<void> cleanLocationCache(BuildContext context) async {
|
||||
final ok = await showConfirmDialogs(
|
||||
context, "确认清理汉化缓存?", Text(S.current.setting_action_info_clear_cache_warning));
|
||||
context,
|
||||
S.current.setting_action_info_confirm_clear_cache,
|
||||
Text(S.current.setting_action_info_clear_cache_warning));
|
||||
if (ok == true) {
|
||||
final dir =
|
||||
Directory("${appGlobalState.applicationSupportDir}/Localizations");
|
||||
@ -187,15 +190,17 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
|
||||
Future<void> addShortCut(BuildContext context) async {
|
||||
if (ConstConf.isMSE) {
|
||||
showToast(context, S.current.setting_action_info_microsoft_version_limitation);
|
||||
showToast(
|
||||
context, S.current.setting_action_info_microsoft_version_limitation);
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
Process.run("explorer.exe", ["shell:AppsFolder"]);
|
||||
return;
|
||||
}
|
||||
dPrint(Platform.resolvedExecutable);
|
||||
final shortCuntName = S.current.app_shortcut_name;
|
||||
final script = """
|
||||
\$targetPath = "${Platform.resolvedExecutable}";
|
||||
\$shortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory), "SC汉化盒子DEV.lnk");
|
||||
\$shortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory), "$shortCuntName");
|
||||
\$shell = New-Object -ComObject WScript.Shell
|
||||
\$shortcut = \$shell.CreateShortcut(\$shortcutPath)
|
||||
if (\$shortcut -eq \$null) {
|
||||
@ -228,4 +233,4 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
showLogs() async {
|
||||
SystemHelper.openDir(getDPrintFile()?.absolute.path.replaceAll("/", "\\"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,8 @@ class UpgradeDialogUI extends HookConsumerWidget {
|
||||
|
||||
return Material(
|
||||
child: ContentDialog(
|
||||
title: Text("发现新版本 -> $targetVersion"),
|
||||
title:
|
||||
Text(S.current.app_upgrade_title_new_version_found(targetVersion)),
|
||||
constraints:
|
||||
BoxConstraints(maxWidth: MediaQuery.of(context).size.width * .55),
|
||||
content: Column(
|
||||
@ -64,7 +65,8 @@ class UpgradeDialogUI extends HookConsumerWidget {
|
||||
children: [
|
||||
const ProgressRing(),
|
||||
const SizedBox(height: 16),
|
||||
Text(S.current.app_upgrade_info_getting_new_version_details)
|
||||
Text(S.current
|
||||
.app_upgrade_info_getting_new_version_details)
|
||||
],
|
||||
),
|
||||
)
|
||||
@ -98,7 +100,8 @@ class UpgradeDialogUI extends HookConsumerWidget {
|
||||
children: [
|
||||
Text(progress.value == 100
|
||||
? S.current.app_upgrade_info_installing
|
||||
: "正在下载: ${progress.value.toStringAsFixed(2)}% "),
|
||||
: S.current.app_upgrade_info_downloading(
|
||||
progress.value.toStringAsFixed(2))),
|
||||
Expanded(
|
||||
child: ProgressBar(
|
||||
value: progress.value == 100 ? null : progress.value,
|
||||
@ -260,4 +263,4 @@ class UpgradeDialogUI extends HookConsumerWidget {
|
||||
["explorer.exe", "/select,\"$fileName\""]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user