l10: update common & Lang settings

This commit is contained in:
2024-03-17 16:54:09 +08:00
parent 9d97dfc786
commit 17588dfab8
31 changed files with 1203 additions and 500 deletions

View File

@ -4,7 +4,6 @@ import 'dart:io';
import 'package:hive/hive.dart';
import 'package:starcitizen_doctor/common/utils/log.dart';
class SCLoggerHelper {
static Future<String?> getLogFilePath() async {
Map<String, String> envVars = Platform.environment;
@ -135,35 +134,42 @@ class SCLoggerHelper {
static MapEntry<String, String>? _checkRunningLine(String line) {
if (line.contains("STATUS_CRYENGINE_OUT_OF_SYSMEM")) {
return const MapEntry("可用内存不足", "请尝试增加虚拟内存( 1080p 下, 物理可用+虚拟内存需 > 64G ");
return MapEntry(S.current.doctor_game_error_low_memory,
S.current.doctor_game_error_low_memory_info);
}
if (line.contains("EXCEPTION_ACCESS_VIOLATION")) {
return const MapEntry("游戏触发了最为广泛的崩溃问题,请查看排障指南",
return MapEntry(S.current.doctor_game_error_generic_info,
"https://docs.qq.com/doc/DUURxUVhzTmZoY09Z");
}
if (line.contains("DXGI_ERROR_DEVICE_REMOVED")) {
return const MapEntry(
"您的显卡崩溃啦!请查看排障指南", "https://www.bilibili.com/read/cv19335199");
return MapEntry(S.current.doctor_game_error_gpu_crash,
"https://www.bilibili.com/read/cv19335199");
}
if (line.contains("Wakeup socket sendto error")) {
return const MapEntry("检测到 socket 异常", "如使用 X黑盒 加速器,请尝试更换加速模式");
return MapEntry(S.current.doctor_game_error_socket_error,
S.current.doctor_game_error_socket_error_info);
}
if (line.contains("The requested operation requires elevated")) {
return const MapEntry("权限不足", "请尝试以管理员权限运行启动器,或使用盒子(微软商店版)启动。");
return MapEntry(S.current.doctor_game_error_permissions_error,
S.current.doctor_game_error_permissions_error_info);
}
if (line.contains(
"The process cannot access the file because is is being used by another process")) {
return const MapEntry("游戏进程被占用", "请尝试重启启动器,或直接重启电脑");
return MapEntry(S.current.doctor_game_error_game_process_error,
S.current.doctor_game_error_game_process_error_info);
}
if (line.contains("0xc0000043")) {
return const MapEntry("游戏程序文件损坏", "请尝试删除 Bin64 文件夹 并在启动器校验。");
return MapEntry(S.current.doctor_game_error_game_damaged_file,
S.current.doctor_game_error_game_damaged_file_info);
}
if (line.contains("option to verify the content of the Data.p4k file")) {
return const MapEntry("P4K文件损坏", "请尝试删除 Data.p4k 文件 并在启动器校验 或 使用盒子分流。");
return MapEntry(S.current.doctor_game_error_game_damaged_p4k_file,
S.current.doctor_game_error_game_damaged_p4k_file_info);
}
if (line.contains("OUTOFMEMORY Direct3D could not allocate")) {
return const MapEntry("可用显存不足", "请不要在后台运行其他高显卡占用的 游戏/应用,或更换显卡。");
return MapEntry(S.current.doctor_game_error_low_gpu_memory,
S.current.doctor_game_error_low_gpu_memory_info);
}
/// Unknown

View File

@ -9,7 +9,7 @@ extension AsyncError on Future {
} catch (e) {
dPrint("unwrap error:$e");
if (context != null && context.mounted) {
showToast(context, "出现错误: $e");
showToast(context, S.current.app_common_error_info(e.toString()));
}
return null;
}

View File

@ -5,17 +5,19 @@ import 'package:flutter/rendering.dart';
import 'dart:ui' as ui;
import 'package:flutter/services.dart';
import 'package:starcitizen_doctor/generated/l10n.dart';
Future showToast(BuildContext context, String msg,
{BoxConstraints? constraints, String? title}) async {
return showBaseDialog(context,
title: title ?? "提示",
title: title ?? S.current.app_common_tip,
content: Text(msg),
actions: [
FilledButton(
child: const Padding(
padding: EdgeInsets.only(top: 2, bottom: 2, left: 8, right: 8),
child: Text('我知道了'),
child: Padding(
padding:
const EdgeInsets.only(top: 2, bottom: 2, left: 8, right: 8),
child: Text(S.current.app_common_tip_i_know),
),
onPressed: () => Navigator.pop(context),
),
@ -25,9 +27,12 @@ Future showToast(BuildContext context, String msg,
Future<bool> showConfirmDialogs(
BuildContext context, String title, Widget content,
{String confirm = "确认",
String cancel = "取消",
{String confirm = "",
String cancel = "",
BoxConstraints? constraints}) async {
if (confirm.isEmpty) confirm = S.current.app_common_tip_confirm;
if (cancel.isEmpty) confirm = S.current.app_common_tip_cancel;
final r = await showBaseDialog(context,
title: title,
content: content,