Skip to content

Commit

Permalink
fix: improve l10n
Browse files Browse the repository at this point in the history
  • Loading branch information
MuZhou233 committed Jan 26, 2024
1 parent c8b3715 commit 520e067
Show file tree
Hide file tree
Showing 15 changed files with 901 additions and 159 deletions.
98 changes: 93 additions & 5 deletions l10n_arb/intl_en.arb
Original file line number Diff line number Diff line change
@@ -1,9 +1,97 @@
{
"@@locale":"en",
"title": "TuiHub",
"@title": {
"description": "Title for the application",
"type": "text",
"placeholders": {}
}
"buttonConfirm": "Confirm",
"buttonClose": "Close",
"parseFailed": "Parse failed",
"unknownErrorOccurred": "Unknown error occurred",
"areYouSureToClose": "Are you sure to close?",
"buttonExit": "Exit",
"buttonMinimizeToTray": "Minimize to tray",
"buttonCancel": "Cancel",
"webVersionFunctionLimited": "Web version has limited functionality, for evaluation use only",

"durationJustNow": "Just now",
"durationSeconds": "{number} seconds ago",
"durationMinutes": "{number} minutes ago",
"durationHours": "{number} hours ago",
"durationDays": "{number} days ago",
"durationWeeks": "{number} weeks ago",
"durationMonths": "{number} months ago",
"durationYears": "{number} years ago",

"welcomeHeader": "\uD83C\uDF89Welcome!",
"welcome": "Welcome",
"welcomeBack": "Welcome back",
"login": "Login",
"clickLoginToStart": "CLICK LOGIN TO START",
"serverSetup": "Server setup",
"address": "Address",
"pleaseInputServerAddress": "Please input server address",
"port": "Port",
"pleaseInputServerPort": "Please input server port",
"tls": "TLS",
"buttonCheck": "Check",
"loginFailed": "Login failed, {reason}",
"buttonRetry": "Retry",
"loggingInTo": "Logging in to {server}",
"buttonBackward": "Backward",
"username": "Username",
"password": "Password",
"buttonLogin": "Login",

"chesed": "Chesed",
"updateImageUserCanceledPick": "User canceled pick",
"updateImageUserCanceledCapture": "User canceled capture",
"uploadImageFailed": "Upload image failed",

"gebura": "Gebura",
"pleaseSetupApplicationPath": "Please setup application path",
"pleaseDontReRunApplication": "Please don't re-run application",
"applicationExitAbnormally": "Application exit abnormally",
"launcherError": "Launcher error",
"scanningLocalFiles": "Scanning local files",
"newApplicationFound": "{number} new applications found",
"importingSteamApplications": "Importing steam applications",
"importSteamApplicationFinished": "Import steam application finished, {success} success, {failed} failed",

"grpc": "gRPC",
"USER_TYPE": "Type",
"USER_TYPE_UNSPECIFIED": "Unspecified",
"USER_TYPE_ADMIN": "Admin",
"USER_TYPE_NORMAL": "Normal",
"USER_TYPE_SENTINEL": "Sentinel",
"USER_STATUS": "Status",
"USER_STATUS_UNSPECIFIED": "Unspecified",
"USER_STATUS_ACTIVE": "Active",
"USER_STATUS_BLOCKED": "Blocked",
"ACCOUNT_PLATFORM": "Platform",
"ACCOUNT_PLATFORM_UNSPECIFIED": "Unspecified",
"ACCOUNT_PLATFORM_STEAM": "Steam",
"APP_SOURCE": "Source",
"APP_SOURCE_UNSPECIFIED": "Unspecified",
"APP_SOURCE_INTERNAL": "Internal",
"APP_SOURCE_STEAM": "Steam",
"APP_TYPE": "Type",
"APP_TYPE_UNSPECIFIED": "Unspecified",
"APP_TYPE_GAME": "Game",
"APP_PACKAGE_SOURCE": "Source",
"APP_PACKAGE_SOURCE_UNSPECIFIED": "Unspecified",
"APP_PACKAGE_SOURCE_MANUAL": "Manual",
"APP_PACKAGE_SOURCE_SENTINEL": "Sentinel",
"FEED_CONFIG_STATUS": "Status",
"FEED_CONFIG_STATUS_UNSPECIFIED": "Unspecified",
"FEED_CONFIG_STATUS_ACTIVE": "Active",
"FEED_CONFIG_STATUS_SUSPEND": "Suspend",
"NOTIFY_TARGET_STATUS": "Status",
"NOTIFY_TARGET_STATUS_UNSPECIFIED": "Unspecified",
"NOTIFY_TARGET_STATUS_ACTIVE": "Active",
"NOTIFY_TARGET_STATUS_SUSPEND": "Suspend",
"NOTIFY_TARGET_TYPE": "Type",
"NOTIFY_TARGET_TYPE_UNSPECIFIED": "Unspecified",
"NOTIFY_TARGET_TYPE_TELEGRAM": "Telegram",
"NOTIFY_FLOW_STATUS": "Status",
"NOTIFY_FLOW_STATUS_UNSPECIFIED": "Unspecified",
"NOTIFY_FLOW_STATUS_ACTIVE": "Active",
"NOTIFY_FLOW_STATUS_SUSPEND": "Suspend"
}
5 changes: 0 additions & 5 deletions l10n_arb/intl_zh_CN.arb
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{
"@@locale":"zh_CN",
"title": "TuiHub",
"@title": {
"description": "Title for the application",
"type": "text",
"placeholders": {}
},
"USER_TYPE": "类型",
"USER_TYPE_UNSPECIFIED": "未知",
"USER_TYPE_ADMIN": "管理员",
Expand Down
8 changes: 5 additions & 3 deletions lib/bloc/chesed/chesed_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:tuihub_protos/librarian/v1/common.pb.dart';
import 'package:universal_io/io.dart';

import '../../common/bloc_event_status_mixin.dart';
import '../../l10n/l10n.dart';
import '../../repo/grpc/api_helper.dart';

part 'chesed_event.dart';
Expand Down Expand Up @@ -89,7 +90,7 @@ class ChesedBloc extends Bloc<ChesedEvent, ChesedState> {
extension = pick.extension!;
} else {
emit(ChesedUploadImageState(state, EventStatus.failed,
msg: 'User canceled pick'));
msg: S.current.updateImageUserCanceledPick));
return;
}
}
Expand Down Expand Up @@ -119,7 +120,7 @@ class ChesedBloc extends Bloc<ChesedEvent, ChesedState> {
extension = 'png';
} else {
emit(ChesedUploadImageState(state, EventStatus.failed,
msg: 'User canceled capture'));
msg: S.current.updateImageUserCanceledCapture));
return;
}
}
Expand All @@ -145,7 +146,8 @@ class ChesedBloc extends Bloc<ChesedEvent, ChesedState> {
body: await file.readAsBytes(),
);
if (uploadResponse.statusCode != 200) {
throw Exception('文件上传失败: ${uploadResponse.reasonPhrase}');
throw Exception(
'${S.current.uploadImageFailed} ${uploadResponse.reasonPhrase}');
}
await _api.doRequestWithOptions(
(client) => client.presignedUploadFileStatus,
Expand Down
26 changes: 15 additions & 11 deletions lib/bloc/gebura/gebura_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import '../../common/platform.dart';
import '../../common/steam/local_library.dart';
import '../../ffi/ffi.dart';
import '../../ffi/ffi_model.dart';
import '../../l10n/l10n.dart';
import '../../model/gebura_model.dart';
import '../../repo/grpc/api_helper.dart';
import '../../repo/local/gebura.dart';
Expand Down Expand Up @@ -191,13 +192,13 @@ class GeburaBloc extends Bloc<GeburaEvent, GeburaState> {
final setting = _repo.getAppLauncherSetting(event.appID.id.toInt());
if (setting == null || setting.path.isEmpty) {
emit(GeburaRunAppState(state, event.appID, EventStatus.failed,
msg: '请先设置应用路径'));
msg: S.current.pleaseSetupApplicationPath));
return;
}
if (state.runState![event.appID] != null &&
state.runState![event.appID]!.running) {
emit(GeburaRunAppState(state, event.appID, EventStatus.failed,
msg: '请勿重复运行'));
msg: S.current.pleaseDontReRunApplication));
return;
}
state.runState![event.appID] =
Expand All @@ -216,7 +217,7 @@ class GeburaBloc extends Bloc<GeburaEvent, GeburaState> {
state.runState![event.appID] =
state.runState![event.appID]!.copyWith(running: false);
emit(GeburaRunAppState(state, event.appID, EventStatus.failed,
msg: '应用未正常退出'));
msg: S.current.applicationExitAbnormally));
return;
}
state.runState![event.appID] = AppRunState(
Expand All @@ -233,7 +234,8 @@ class GeburaBloc extends Bloc<GeburaEvent, GeburaState> {
state.runState![event.appID] =
state.runState![event.appID]!.copyWith(running: false);
emit(GeburaRunAppState(state, event.appID, EventStatus.failed,
msg: '启动器错误 ${e is FrbAnyhowException ? e.anyhow : e}'));
msg:
'${S.current.launcherError} ${e is FrbAnyhowException ? e.anyhow : e}'));
return;
}
});
Expand All @@ -242,15 +244,16 @@ class GeburaBloc extends Bloc<GeburaEvent, GeburaState> {
if (!PlatformHelper.isWindowsApp()) {
return;
}
emit(state.copyWith(localLibraryState: '正在扫描本地文件'));
emit(state.copyWith(localLibraryState: S.current.scanningLocalFiles));
final (apps, result) = await scanLocalLibrary();
final folders = await getSteamLibraryFolders();
final imported = _repo.getImportedSteamApps();
final unImported = apps.where((element) =>
!imported.any((imported) => imported.steamAppID == element.appId));
emit(state.copyWith(
localLibraryState:
unImported.isNotEmpty ? '发现${unImported.length}个本地游戏' : '',
localLibraryState: unImported.isNotEmpty
? S.current.newApplicationFound(unImported.length)
: '',
localSteamScanResult: result,
localSteamApps: apps,
importedSteamApps: imported,
Expand All @@ -263,7 +266,8 @@ class GeburaBloc extends Bloc<GeburaEvent, GeburaState> {
return;
}
emit(GeburaImportSteamAppsState(
state.copyWith(localLibraryState: '正在导入Steam应用'),
state.copyWith(
localLibraryState: S.current.importingSteamApplications),
EventStatus.processing));
var processCount = 0;
var failedCount = 0;
Expand All @@ -273,7 +277,7 @@ class GeburaBloc extends Bloc<GeburaEvent, GeburaState> {
emit(GeburaImportSteamAppsState(
state.copyWith(
localLibraryState:
'正在导入Steam应用 $processCount ( $failedCount ) / ${event.appIDs.length}',
'${S.current.importingSteamApplications} $processCount ( $failedCount ) / ${event.appIDs.length}',
),
EventStatus.processing));
if (importedSteamApps.any((element) => element.steamAppID == app)) {
Expand Down Expand Up @@ -331,8 +335,8 @@ class GeburaBloc extends Bloc<GeburaEvent, GeburaState> {
add(GeburaPurchasedAppsLoadEvent());
emit(GeburaImportSteamAppsState(
state.copyWith(
localLibraryState:
'Steam应用导入完成,${processCount - failedCount}成功,$failedCount失败',
localLibraryState: S.current.importSteamApplicationFinished(
processCount - failedCount, failedCount),
importedSteamApps: importedSteamApps,
),
EventStatus.success));
Expand Down
3 changes: 2 additions & 1 deletion lib/bloc/yesod/yesod_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:tuihub_protos/librarian/v1/common.pb.dart';
import 'package:webfeed_revised/domain/rss_feed.dart';

import '../../common/bloc_event_status_mixin.dart';
import '../../l10n/l10n.dart';
import '../../model/yesod_model.dart';
import '../../repo/grpc/api_helper.dart';
import '../../repo/local/yesod.dart';
Expand Down Expand Up @@ -138,7 +139,7 @@ class YesodBloc extends Bloc<YesodEvent, YesodState> {
title: '', link: '', iconUrl: '', description: '')),
),
EventStatus.failed,
msg: '解析失败, $e',
msg: '${S.current.parseFailed} $e',
));
}
}, transformer: droppable());
Expand Down
Loading

0 comments on commit 520e067

Please sign in to comment.