mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-29 06:55:37 +08:00
l10n: Update
This commit is contained in:
@ -21,7 +21,8 @@ class AdvancedLocalizationUI extends HookConsumerWidget {
|
||||
final model = ref.read(advancedLocalizationUIModelProvider.notifier);
|
||||
final homeUIState = ref.watch(homeUIModelProvider);
|
||||
return makeDefaultPage(
|
||||
title: "高级汉化 -> ${homeUIState.scInstalledPath}",
|
||||
title: S.current.home_localization_advanced_title(
|
||||
homeUIState.scInstalledPath ?? "-"),
|
||||
context,
|
||||
content: state.workingText.isNotEmpty
|
||||
? Center(
|
||||
@ -40,16 +41,19 @@ class AdvancedLocalizationUI extends HookConsumerWidget {
|
||||
children: [
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'已加载汉化版本:${state.apiLocalizationData?.versionName}')),
|
||||
Text('汉化文本行数:${state.serverGlobalIniLines}'
|
||||
' P4K文本行数:${state.p4kGlobalIniLines}'),
|
||||
child: Text(S.current
|
||||
.home_localization_advanced_msg_version(
|
||||
state.apiLocalizationData?.versionName ??
|
||||
"-"))),
|
||||
Text(S.current.home_localization_advanced_title_msg(
|
||||
state.serverGlobalIniLines, state.p4kGlobalIniLines)),
|
||||
const SizedBox(width: 32),
|
||||
Button(
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 12, right: 12, top: 4, bottom: 4),
|
||||
child: Text("安装汉化"),
|
||||
child: Text(S.current
|
||||
.home_localization_advanced_action_install),
|
||||
),
|
||||
onPressed: () async {
|
||||
await model.doInstall().unwrap(context: context);
|
||||
@ -128,7 +132,8 @@ class AdvancedLocalizationUI extends HookConsumerWidget {
|
||||
children: [
|
||||
makeLoading(context),
|
||||
const SizedBox(height: 6),
|
||||
const Text("正在重新生成文本..."),
|
||||
Text(
|
||||
S.current.home_localization_advanced_action_mod_change),
|
||||
],
|
||||
)
|
||||
else ...[
|
||||
@ -136,7 +141,9 @@ class AdvancedLocalizationUI extends HookConsumerWidget {
|
||||
padding: const EdgeInsets.only(left: 12, right: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
const Expanded(child: Text("模式")),
|
||||
Expanded(
|
||||
child: Text(S
|
||||
.current.home_localization_advanced_action_mode)),
|
||||
ComboBox(
|
||||
value: item.mode,
|
||||
items: [
|
||||
@ -222,7 +229,8 @@ class AdvancedLocalizationUI extends HookConsumerWidget {
|
||||
const SizedBox(
|
||||
width: 24,
|
||||
),
|
||||
Text("预览:${item.className}"),
|
||||
Text(S.current.home_localization_advanced_title_preview(
|
||||
item.className ?? "-")),
|
||||
],
|
||||
),
|
||||
content: textData.value.isEmpty
|
||||
|
@ -1,8 +1,10 @@
|
||||
import 'package:starcitizen_doctor/generated/l10n.dart';
|
||||
|
||||
final advancedLocalizationJsonData = {
|
||||
"class_keys": [
|
||||
{
|
||||
"id": "location_opt",
|
||||
"class_name": "地点-其他",
|
||||
"class_name": S.current.home_localization_advanced_json_text_location_other,
|
||||
"keys": [
|
||||
"ATC_.*",
|
||||
"Crus_HistMarker_.*",
|
||||
@ -58,7 +60,7 @@ final advancedLocalizationJsonData = {
|
||||
},
|
||||
{
|
||||
"id": "location",
|
||||
"class_name": "地点-常用",
|
||||
"class_name": S.current.home_localization_advanced_json_text_location_used,
|
||||
"keys": [
|
||||
"Bacchus(?!.*_Desc).*",
|
||||
"Cano(?!.*_Desc).*",
|
||||
@ -81,7 +83,7 @@ final advancedLocalizationJsonData = {
|
||||
]
|
||||
},
|
||||
{
|
||||
"class_name": "物品-其他",
|
||||
"class_name": S.current.home_localization_advanced_json_text_things_other,
|
||||
"id": "thing_opt",
|
||||
"keys": [
|
||||
"BarMenu_.*",
|
||||
@ -96,12 +98,12 @@ final advancedLocalizationJsonData = {
|
||||
]
|
||||
},
|
||||
{
|
||||
"class_name": "物品-常用",
|
||||
"class_name": S.current.home_localization_advanced_json_text_things_used,
|
||||
"id": "thing",
|
||||
"keys": ["item_Name.*"]
|
||||
},
|
||||
{
|
||||
"class_name": "载具-其他",
|
||||
"class_name": S.current.home_localization_advanced_json_text_vehicle_other,
|
||||
"id": "vehicle_name",
|
||||
"keys": [
|
||||
"vehicle_Desc.*",
|
||||
@ -111,13 +113,13 @@ final advancedLocalizationJsonData = {
|
||||
]
|
||||
},
|
||||
{
|
||||
"class_name": "载具-常用",
|
||||
"class_name": S.current.home_localization_advanced_json_text_vehicle_used,
|
||||
"id": "vehicle",
|
||||
"keys": ["vehicle_Name.*"]
|
||||
},
|
||||
{
|
||||
"id": "mission",
|
||||
"class_name": "任务/日志",
|
||||
"class_name": S.current.home_localization_advanced_json_text_mission_or_logs,
|
||||
"keys": [
|
||||
"BasicSalvage_.*",
|
||||
"BitZeros_.*",
|
||||
@ -377,7 +379,7 @@ final advancedLocalizationJsonData = {
|
||||
},
|
||||
{
|
||||
"id": "subtitle",
|
||||
"class_name": "字幕",
|
||||
"class_name": S.current.home_localization_advanced_json_text_subtitle,
|
||||
"keys": [
|
||||
"DXSH_",
|
||||
"Dlg_SC_.*",
|
||||
@ -402,7 +404,7 @@ final advancedLocalizationJsonData = {
|
||||
},
|
||||
{
|
||||
"id": "ui",
|
||||
"class_name": "UI/HUD/菜单",
|
||||
"class_name": S.current.home_localization_advanced_json_text_ui_or_hud_or_menu,
|
||||
"keys": [
|
||||
".*_RepUI_.*",
|
||||
"CharacterCustomizer_.*",
|
||||
@ -558,4 +560,4 @@ final advancedLocalizationJsonData = {
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
@ -33,10 +33,14 @@ class AdvancedLocalizationUIState with _$AdvancedLocalizationUIState {
|
||||
|
||||
extension AdvancedLocalizationUIStateEx on AdvancedLocalizationUIState {
|
||||
Map<AppAdvancedLocalizationClassKeysDataMode, String> get typeNames => {
|
||||
AppAdvancedLocalizationClassKeysDataMode.localization: "汉化",
|
||||
AppAdvancedLocalizationClassKeysDataMode.unLocalization: "英文原文",
|
||||
AppAdvancedLocalizationClassKeysDataMode.mixed: "双语",
|
||||
AppAdvancedLocalizationClassKeysDataMode.mixedNewline: "双语(换行)",
|
||||
AppAdvancedLocalizationClassKeysDataMode.localization:
|
||||
S.current.home_localization_advanced_action_mod_change_localization,
|
||||
AppAdvancedLocalizationClassKeysDataMode.unLocalization: S.current
|
||||
.home_localization_advanced_action_mod_change_un_localization,
|
||||
AppAdvancedLocalizationClassKeysDataMode.mixed:
|
||||
S.current.home_localization_advanced_action_mod_change_mixed,
|
||||
AppAdvancedLocalizationClassKeysDataMode.mixedNewline: S
|
||||
.current.home_localization_advanced_action_mod_change_mixed_newline,
|
||||
};
|
||||
}
|
||||
|
||||
@ -57,8 +61,15 @@ class AdvancedLocalizationUIModel extends _$AdvancedLocalizationUIModel {
|
||||
await _readIni(localizationUIState, localizationUIModel);
|
||||
final ald = await _readClassJson();
|
||||
if (ald.classKeys == null) return;
|
||||
state = state.copyWith(workingText: "正在分类 ...");
|
||||
final m = await compute(_doClassIni, (ald, p4kGlobalIni, serverGlobalIni));
|
||||
state = state.copyWith(
|
||||
workingText: S.current.home_localization_advanced_msg_classifying);
|
||||
final m = await compute(_doClassIni, (
|
||||
ald,
|
||||
p4kGlobalIni,
|
||||
serverGlobalIni,
|
||||
S.current.home_localization_advanced_json_text_un_localization,
|
||||
S.current.home_localization_advanced_json_text_others
|
||||
));
|
||||
final p4kGlobalIniLines = p4kGlobalIni.split("\n").length;
|
||||
final serverGlobalIniLines = serverGlobalIni.split("\n").length;
|
||||
state = state.copyWith(
|
||||
@ -74,24 +85,28 @@ class AdvancedLocalizationUIModel extends _$AdvancedLocalizationUIModel {
|
||||
(
|
||||
AppAdvancedLocalizationData ald,
|
||||
String p4kGlobalIni,
|
||||
String serverGlobalIni
|
||||
String serverGlobalIni,
|
||||
String unLocalizationClassName,
|
||||
String othersClassName,
|
||||
) v,
|
||||
) {
|
||||
final (
|
||||
AppAdvancedLocalizationData ald,
|
||||
String p4kGlobalIni,
|
||||
String serverGlobalIni,
|
||||
String unLocalizationClassName,
|
||||
String othersClassName,
|
||||
) = v;
|
||||
final unLocalization = AppAdvancedLocalizationClassKeysData(
|
||||
id: "un_localization",
|
||||
className: "未汉化",
|
||||
className: unLocalizationClassName,
|
||||
keys: [],
|
||||
)
|
||||
..mode = AppAdvancedLocalizationClassKeysDataMode.unLocalization
|
||||
..lockMod = true;
|
||||
final unClass = AppAdvancedLocalizationClassKeysData(
|
||||
id: "un_class",
|
||||
className: "其他",
|
||||
className: othersClassName,
|
||||
keys: [],
|
||||
);
|
||||
final classMap = <String, AppAdvancedLocalizationClassKeysData>{
|
||||
@ -158,10 +173,13 @@ class AdvancedLocalizationUIModel extends _$AdvancedLocalizationUIModel {
|
||||
final homeUIState = ref.read(homeUIModelProvider);
|
||||
final gameDir = homeUIState.scInstalledPath;
|
||||
if (gameDir == null) return ("", "");
|
||||
state = state.copyWith(workingText: "读取 p4k 文件 ...");
|
||||
state = state.copyWith(
|
||||
workingText: S.current.home_localization_advanced_msg_reading_p4k);
|
||||
final p4kGlobalIni = await readEnglishInI(gameDir);
|
||||
dPrint("read p4kGlobalIni => ${p4kGlobalIni.length}");
|
||||
state = state.copyWith(workingText: "获取汉化文本 ...");
|
||||
state = state.copyWith(
|
||||
workingText: S.current
|
||||
.home_localization_advanced_msg_reading_server_localization_text);
|
||||
final apiLocalizationData =
|
||||
localizationUIState.apiLocalizationData?.values.firstOrNull;
|
||||
if (apiLocalizationData == null) return ("", "");
|
||||
@ -239,7 +257,9 @@ class AdvancedLocalizationUIModel extends _$AdvancedLocalizationUIModel {
|
||||
}
|
||||
|
||||
Future<bool> doInstall() async {
|
||||
state = state.copyWith(workingText: "生成汉化文件...");
|
||||
state = state.copyWith(
|
||||
workingText:
|
||||
S.current.home_localization_advanced_msg_gen_localization_text);
|
||||
final classMap = state.classMap!;
|
||||
final globalIni = StringBuffer();
|
||||
for (var item in classMap.values) {
|
||||
@ -248,7 +268,9 @@ class AdvancedLocalizationUIModel extends _$AdvancedLocalizationUIModel {
|
||||
await Future.delayed(Duration.zero);
|
||||
}
|
||||
}
|
||||
state = state.copyWith(workingText: "安装汉化文件...");
|
||||
state = state.copyWith(
|
||||
workingText:
|
||||
S.current.home_localization_advanced_msg_gen_localization_install);
|
||||
final localizationUIModel = ref.read(localizationUIModelProvider.notifier);
|
||||
await localizationUIModel.installFormString(
|
||||
globalIni, state.apiLocalizationData?.versionName ?? "-",
|
||||
|
@ -7,7 +7,7 @@ part of 'advanced_localization_ui_model.dart';
|
||||
// **************************************************************************
|
||||
|
||||
String _$advancedLocalizationUIModelHash() =>
|
||||
r'2db0a21dd98f5fb002469fcefe1bc1c0d514e135';
|
||||
r'acf91fc467108c3669d8ddd6fed3c24434be4ae8';
|
||||
|
||||
/// See also [AdvancedLocalizationUIModel].
|
||||
@ProviderFor(AdvancedLocalizationUIModel)
|
||||
|
@ -86,7 +86,7 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
Row(
|
||||
children: [
|
||||
Text(S.current.localization_info_installed_version(
|
||||
"${state.patchStatus?.value ?? ""} ${(state.isInstalledAdvanced ?? false) ? " (高级汉化)" : ""}")),
|
||||
"${state.patchStatus?.value ?? ""} ${(state.isInstalledAdvanced ?? false) ? S.current.home_localization_msg_version_advanced : ""}")),
|
||||
const Spacer(),
|
||||
if (state.patchStatus?.value !=
|
||||
S.current.home_action_info_game_built_in)
|
||||
@ -426,7 +426,7 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
item.value.note ?? "该版本没有提供描述",
|
||||
item.value.note ?? S.current.home_localization_msg_no_note,
|
||||
style: const TextStyle(fontSize: 15),
|
||||
),
|
||||
),
|
||||
@ -451,22 +451,22 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
final toolsMenu = {
|
||||
"launcher_mod": (
|
||||
const Icon(FluentIcons.c_plus_plus, size: 24),
|
||||
"RSI 启动器汉化",
|
||||
(S.current.home_localization_action_rsi_launcher_localization),
|
||||
),
|
||||
"advanced": (
|
||||
const Icon(FluentIcons.queue_advanced, size: 24),
|
||||
"高级汉化",
|
||||
(S.current.home_localization_action_advanced),
|
||||
),
|
||||
"custom_files": (
|
||||
const Icon(FluentIcons.custom_activity, size: 24),
|
||||
"安装自定义文件",
|
||||
(S.current.home_localization_action_install_customize),
|
||||
),
|
||||
};
|
||||
|
||||
final enableTap = state.workingVersion.isEmpty;
|
||||
|
||||
return makeListContainer(
|
||||
"汉化工具",
|
||||
S.current.home_localization_title_localization_tools,
|
||||
[
|
||||
for (final item in toolsMenu.entries)
|
||||
Tilt(
|
||||
@ -512,6 +512,6 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
],
|
||||
context,
|
||||
gridViewMode: true,
|
||||
gridViewCrossAxisCount: 4);
|
||||
gridViewCrossAxisCount: 3);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user