From 75836c9c6bd0eeae51703b6bedafc65936610c37 Mon Sep 17 00:00:00 2001 From: Rust Date: Fri, 17 Oct 2025 22:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=AF=E7=94=B1=E5=86=B2?= =?UTF-8?q?=E7=AA=81=E5=92=8C=E8=A1=A5=E5=85=85=E5=A4=9A=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/translations/strings_en.i18n.json | 35 +++++++- assets/translations/strings_es.i18n.json | 33 +++++++- assets/translations/strings_et.i18n.json | 34 +++++++- assets/translations/strings_ja.i18n.json | 33 +++++++- assets/translations/strings_ru.i18n.json | 33 +++++++- assets/translations/strings_zh.i18n.json | 33 +++++++- assets/translations/strings_zh_Hant.i18n.json | 35 +++++++- lib/app/localization/app_translations.dart | 82 +++++++++++++++++++ .../kr_device_management_controller.dart | 43 +++++----- .../kr_user_info/views/kr_user_info_view.dart | 6 +- .../utils/kr_subscribe_navigation_util.dart | 15 ++-- 11 files changed, 343 insertions(+), 39 deletions(-) diff --git a/assets/translations/strings_en.i18n.json b/assets/translations/strings_en.i18n.json index aa4da82..3471185 100755 --- a/assets/translations/strings_en.i18n.json +++ b/assets/translations/strings_en.i18n.json @@ -116,7 +116,10 @@ }, "switchSubscription": "Switch Subscription", "resetTrafficTitle": "Reset Traffic", - "resetTrafficMessage": "Monthly plan traffic reset example: Reset the next cycle's traffic on a monthly basis, and the subscription validity period will be advanced from {currentTime} to {newTime}" + "resetTrafficMessage": "Monthly plan traffic reset example: Reset the next cycle's traffic on a monthly basis, and the subscription validity period will be advanced from {currentTime} to {newTime}", + "loginRegister": "Login/Register", + "guestId": "Guest ID: {id}", + "deviceManagement": "Device Management" }, "setting": { "title": "Settings", @@ -316,7 +319,35 @@ "confirm": "Confirm", "cancel": "Cancel", "ok": "OK", - "iKnow": "I Know" + "iKnow": "I Know", + "tip": "Tip", + "delete": "Delete", + "error": "Error", + "success": "Success", + "deviceLoginBindingTitle": "Tip", + "deviceLoginBindingMessage": "You need to login to purchase a subscription" + }, + "deviceManagement": { + "title": "Device Management", + "deleteConfirmTitle": "Confirm Delete", + "deleteCurrentDeviceMessage": "Are you sure you want to delete this device? You will be automatically re-logged in using device login.", + "deleteOtherDeviceMessage": "Are you sure you want to delete this device? It will be forced offline.", + "deleteSuccess": "Device deleted", + "deleteFailed": "Delete failed: {error}", + "loadDeviceListFailed": "Failed to load device list", + "deviceLoginDisabled": "Device login is not enabled, please login manually", + "reloginSuccess": "Automatically re-logged in", + "reloginFailed": "Auto login failed: {error}, please login manually", + "reloginFailedGeneric": "Auto login failed, please login manually", + "deviceTypes": { + "unknown": "Unknown Device", + "android": "Android Device", + "ios": "iOS Device", + "ipad": "iPad", + "macos": "macOS", + "windows": "Windows", + "linux": "Linux" + } }, "splash": { "appName": "BearVPN", diff --git a/assets/translations/strings_es.i18n.json b/assets/translations/strings_es.i18n.json index 8aca355..9a45ebd 100755 --- a/assets/translations/strings_es.i18n.json +++ b/assets/translations/strings_es.i18n.json @@ -114,6 +114,9 @@ "switchSubscription": "Cambiar Suscripción", "resetTrafficTitle": "Restablecer Tráfico", "resetTrafficMessage": "Ejemplo de restablecimiento de tráfico del plan mensual: restablecer el tráfico del siguiente ciclo mensualmente, y el período de validez de la suscripción se adelantará de {currentTime} a {newTime}", + "loginRegister": "Iniciar sesión/Registrarse", + "guestId": "ID de Invitado: {id}", + "deviceManagement": "Administración de Dispositivos", "trialStatus": "Estado de prueba", "trialing": "En período de prueba", "trialEndMessage": "No podrá continuar usando después de que expire el período de prueba", @@ -322,7 +325,35 @@ "confirm": "Confirmar", "cancel": "Cancelar", "ok": "OK", - "iKnow": "Lo entiendo" + "iKnow": "Lo entiendo", + "tip": "Aviso", + "delete": "Eliminar", + "error": "Error", + "success": "Éxito", + "deviceLoginBindingTitle": "Aviso", + "deviceLoginBindingMessage": "Necesita iniciar sesión para comprar una suscripción" + }, + "deviceManagement": { + "title": "Administración de Dispositivos", + "deleteConfirmTitle": "Confirmar Eliminación", + "deleteCurrentDeviceMessage": "¿Está seguro de que desea eliminar este dispositivo? Se volverá a iniciar sesión automáticamente usando el inicio de sesión del dispositivo.", + "deleteOtherDeviceMessage": "¿Está seguro de que desea eliminar este dispositivo? Se forzará a desconectarse.", + "deleteSuccess": "Dispositivo eliminado", + "deleteFailed": "Error al eliminar: {error}", + "loadDeviceListFailed": "Error al cargar la lista de dispositivos", + "deviceLoginDisabled": "El inicio de sesión del dispositivo no está habilitado, inicie sesión manualmente", + "reloginSuccess": "Sesión reiniciada automáticamente", + "reloginFailed": "Error al reiniciar sesión: {error}, inicie sesión manualmente", + "reloginFailedGeneric": "Error al reiniciar sesión, inicie sesión manualmente", + "deviceTypes": { + "unknown": "Dispositivo Desconocido", + "android": "Dispositivo Android", + "ios": "Dispositivo iOS", + "ipad": "iPad", + "macos": "macOS", + "windows": "Windows", + "linux": "Linux" + } }, "splash": { "appName": "BearVPN", diff --git a/assets/translations/strings_et.i18n.json b/assets/translations/strings_et.i18n.json index 0ec3aa2..b7a18b5 100755 --- a/assets/translations/strings_et.i18n.json +++ b/assets/translations/strings_et.i18n.json @@ -112,6 +112,9 @@ "unlimited": "Piiramatu liiklus", "limited": "Kasutatud liiklus" }, + "loginRegister": "Logi sisse/Registreeru", + "guestId": "Külalise ID: {id}", + "deviceManagement": "Seadmete haldus", "copySuccess": "Kopeeritud", "notAvailable": "Pole saadaval", "willBeDeleted": "kustutatakse", @@ -312,7 +315,36 @@ "dialog": { "confirm": "Kinnita", "cancel": "Tühista", - "ok": "OK" + "ok": "OK", + "iKnow": "Sain aru", + "tip": "Nõuanne", + "delete": "Kustuta", + "error": "Viga", + "success": "Edukas", + "deviceLoginBindingTitle": "Nõuanne", + "deviceLoginBindingMessage": "Tellimuse ostmiseks peate sisse logima" + }, + "deviceManagement": { + "title": "Seadmete haldus", + "deleteConfirmTitle": "Kinnita kustutamine", + "deleteCurrentDeviceMessage": "Kas olete kindel, et soovite selle seadme kustutada? Logitakse automaatselt tagasi sisse seadme sisselogimist kasutades.", + "deleteOtherDeviceMessage": "Kas olete kindel, et soovite selle seadme kustutada? See sunnitakse ühendust katkestama.", + "deleteSuccess": "Seade kustutatud", + "deleteFailed": "Kustutamine ebaõnnestus: {error}", + "loadDeviceListFailed": "Seadmete loendi laadimine ebaõnnestus", + "deviceLoginDisabled": "Seadme sisselogimine pole lubatud, logige käsitsi sisse", + "reloginSuccess": "Automaatselt tagasi sisse logitud", + "reloginFailed": "Automaatne sisselogimine ebaõnnestus: {error}, logige käsitsi sisse", + "reloginFailedGeneric": "Automaatne sisselogimine ebaõnnestus, logige käsitsi sisse", + "deviceTypes": { + "unknown": "Tundmatu seade", + "android": "Android seade", + "ios": "iOS seade", + "ipad": "iPad", + "macos": "macOS", + "windows": "Windows", + "linux": "Linux" + } }, "splash": { "appName": "BearVPN", diff --git a/assets/translations/strings_ja.i18n.json b/assets/translations/strings_ja.i18n.json index e5879e6..b668ece 100755 --- a/assets/translations/strings_ja.i18n.json +++ b/assets/translations/strings_ja.i18n.json @@ -117,6 +117,9 @@ "switchSubscription": "サブスクリプションの切り替え", "resetTrafficTitle": "トラフィックリセット", "resetTrafficMessage": "月間プランのトラフィックリセット例:次のサイクルのトラフィックを月次でリセットし、サブスクリプションの有効期限が{currentTime}から{newTime}に繰り上げられます", + "loginRegister": "ログイン/登録", + "guestId": "ゲストID:{id}", + "deviceManagement": "デバイス管理", "trialStatus": "トライアル状態", "trialing": "トライアル中", "trialEndMessage": "トライアル期間終了後は使用できなくなります", @@ -330,7 +333,35 @@ "confirm": "確認", "cancel": "キャンセル", "ok": "OK", - "iKnow": "分かりました" + "iKnow": "分かりました", + "tip": "ヒント", + "delete": "削除", + "error": "エラー", + "success": "成功", + "deviceLoginBindingTitle": "ヒント", + "deviceLoginBindingMessage": "サブスクリプションを購入するにはログインする必要があります" + }, + "deviceManagement": { + "title": "デバイス管理", + "deleteConfirmTitle": "削除の確認", + "deleteCurrentDeviceMessage": "このデバイスを削除してもよろしいですか?デバイスログインを使用して自動的に再ログインされます。", + "deleteOtherDeviceMessage": "このデバイスを削除してもよろしいですか?強制的にオフラインになります。", + "deleteSuccess": "デバイスを削除しました", + "deleteFailed": "削除に失敗しました:{error}", + "loadDeviceListFailed": "デバイスリストの読み込みに失敗しました", + "deviceLoginDisabled": "デバイスログインが有効になっていません。手動でログインしてください", + "reloginSuccess": "自動的に再ログインしました", + "reloginFailed": "自動ログインに失敗しました:{error}、手動でログインしてください", + "reloginFailedGeneric": "自動ログインに失敗しました。手動でログインしてください", + "deviceTypes": { + "unknown": "不明なデバイス", + "android": "Androidデバイス", + "ios": "iOSデバイス", + "ipad": "iPad", + "macos": "macOS", + "windows": "Windows", + "linux": "Linux" + } }, "splash": { "appName": "BearVPN", diff --git a/assets/translations/strings_ru.i18n.json b/assets/translations/strings_ru.i18n.json index eabfc49..d986f03 100755 --- a/assets/translations/strings_ru.i18n.json +++ b/assets/translations/strings_ru.i18n.json @@ -104,6 +104,9 @@ "switchSubscription": "Сменить подписку", "resetTrafficTitle": "Сброс трафика", "resetTrafficMessage": "Пример сброса трафика месячного плана: сброс трафика следующего цикла ежемесячно, и срок действия подписки будет перенесен с {currentTime} на {newTime}", + "loginRegister": "Вход/Регистрация", + "guestId": "ID гостя: {id}", + "deviceManagement": "Управление устройствами", "reset": "Сбросить", "trafficUsage": "Использовано: {used} / {total}", "trafficProgress": { @@ -331,7 +334,35 @@ "confirm": "Подтвердить", "cancel": "Отмена", "ok": "OK", - "iKnow": "Я понял" + "iKnow": "Я понял", + "tip": "Совет", + "delete": "Удалить", + "error": "Ошибка", + "success": "Успех", + "deviceLoginBindingTitle": "Совет", + "deviceLoginBindingMessage": "Для покупки подписки необходимо войти в систему" + }, + "deviceManagement": { + "title": "Управление устройствами", + "deleteConfirmTitle": "Подтвердить удаление", + "deleteCurrentDeviceMessage": "Вы уверены, что хотите удалить это устройство? Вы будете автоматически переавторизованы с помощью входа на устройство.", + "deleteOtherDeviceMessage": "Вы уверены, что хотите удалить это устройство? Оно будет принудительно отключено.", + "deleteSuccess": "Устройство удалено", + "deleteFailed": "Ошибка удаления: {error}", + "loadDeviceListFailed": "Не удалось загрузить список устройств", + "deviceLoginDisabled": "Вход на устройство не включен, войдите вручную", + "reloginSuccess": "Автоматически переавторизован", + "reloginFailed": "Ошибка автоматического входа: {error}, войдите вручную", + "reloginFailedGeneric": "Ошибка автоматического входа, войдите вручную", + "deviceTypes": { + "unknown": "Неизвестное устройство", + "android": "Android устройство", + "ios": "iOS устройство", + "ipad": "iPad", + "macos": "macOS", + "windows": "Windows", + "linux": "Linux" + } }, "update": { "title": "Доступна новая версия", diff --git a/assets/translations/strings_zh.i18n.json b/assets/translations/strings_zh.i18n.json index 5aa3632..6e6648d 100755 --- a/assets/translations/strings_zh.i18n.json +++ b/assets/translations/strings_zh.i18n.json @@ -164,6 +164,9 @@ "switchSubscription": "切换订阅", "resetTrafficTitle": "重置流量", "resetTrafficMessage": "月付套餐流量重置示例:将下一个周期的流量按月重置,订阅有效期将从{currentTime}提前至{newTime}", + "loginRegister": "登录/注册", + "guestId": "游客ID:{id}", + "deviceManagement": "设备管理", "trialStatus": "试用状态", "trialing": "试用中", "trialEndMessage": "试用结束后将无法继续使用", @@ -332,7 +335,35 @@ "confirm": "确认", "cancel": "取消", "ok": "确定", - "iKnow": "我知道了" + "iKnow": "我知道了", + "tip": "提示", + "delete": "删除", + "error": "错误", + "success": "成功", + "deviceLoginBindingTitle": "提示", + "deviceLoginBindingMessage": "购买套餐需要登录绑定用户" + }, + "deviceManagement": { + "title": "设备管理", + "deleteConfirmTitle": "确认删除", + "deleteCurrentDeviceMessage": "确定要删除本机设备吗?删除后将使用设备登录自动重新登录。", + "deleteOtherDeviceMessage": "确定要删除此设备吗?删除后该设备将被强制下线。", + "deleteSuccess": "设备已删除", + "deleteFailed": "删除失败:{error}", + "loadDeviceListFailed": "加载设备列表失败", + "deviceLoginDisabled": "设备登录未启用,请手动登录", + "reloginSuccess": "已自动重新登录", + "reloginFailed": "自动登录失败:{error},请手动登录", + "reloginFailedGeneric": "自动登录失败,请手动登录", + "deviceTypes": { + "unknown": "未知设备", + "android": "安卓设备", + "ios": "iOS 设备", + "ipad": "iPad", + "macos": "macOS", + "windows": "Windows", + "linux": "Linux" + } }, "splash": { "appName": "BearVPN", diff --git a/assets/translations/strings_zh_Hant.i18n.json b/assets/translations/strings_zh_Hant.i18n.json index 4e91a34..99e7612 100755 --- a/assets/translations/strings_zh_Hant.i18n.json +++ b/assets/translations/strings_zh_Hant.i18n.json @@ -116,7 +116,10 @@ "unlimited": "不限流量", "limited": "已用流量" }, - "deviceLimit": "設備限制: {count}" + "deviceLimit": "設備限制: {count}", + "loginRegister": "登錄/註冊", + "guestId": "遊客ID:{id}", + "deviceManagement": "設備管理" }, "setting": { "title": "設置", @@ -280,7 +283,35 @@ "dialog": { "confirm": "確認", "cancel": "取消", - "ok": "我知道了" + "ok": "我知道了", + "tip": "提示", + "delete": "刪除", + "error": "錯誤", + "success": "成功", + "deviceLoginBindingTitle": "提示", + "deviceLoginBindingMessage": "購買套餐需要登錄綁定用戶" + }, + "deviceManagement": { + "title": "設備管理", + "deleteConfirmTitle": "確認刪除", + "deleteCurrentDeviceMessage": "確定要刪除本機設備嗎?刪除後將使用設備登錄自動重新登錄。", + "deleteOtherDeviceMessage": "確定要刪除此設備嗎?刪除後該設備將被強制下線。", + "deleteSuccess": "設備已刪除", + "deleteFailed": "刪除失敗:{error}", + "loadDeviceListFailed": "加載設備列表失敗", + "deviceLoginDisabled": "設備登錄未啟用,請手動登錄", + "reloginSuccess": "已自動重新登錄", + "reloginFailed": "自動登錄失敗:{error},請手動登錄", + "reloginFailedGeneric": "自動登錄失敗,請手動登錄", + "deviceTypes": { + "unknown": "未知設備", + "android": "安卓設備", + "ios": "iOS 設備", + "ipad": "iPad", + "macos": "macOS", + "windows": "Windows", + "linux": "Linux" + } }, "update": { "title": "發現新版本", diff --git a/lib/app/localization/app_translations.dart b/lib/app/localization/app_translations.dart index 50f15f4..1cbd24e 100755 --- a/lib/app/localization/app_translations.dart +++ b/lib/app/localization/app_translations.dart @@ -60,6 +60,10 @@ class AppTranslations { /// 托盘相关翻译 static final AppTranslationsTray kr_tray = AppTranslationsTray(); + /// 设备管理翻译类 + static final AppTranslationsDeviceManagement kr_deviceManagement = + AppTranslationsDeviceManagement(); + /// 初始化翻译 static void kr_initTranslations() { // Get.addTranslations({ @@ -429,6 +433,15 @@ class AppTranslationsUserInfo { final String download = '下载'; final String upload = '上传'; + + /// 登录/注册 + String get loginRegister => 'userInfo.loginRegister'.tr; + + /// 游客ID + String guestId(int id) => 'userInfo.guestId'.trParams({'id': id.toString()}); + + /// 设备管理 + String get deviceManagement => 'userInfo.deviceManagement'.tr; } class AppTranslationsSetting { @@ -817,6 +830,24 @@ class AppTranslationsDialog { /// 我知道了按钮文本 String get kr_iKnow => 'dialog.iKnow'.tr; + + /// 提示 + String get tip => 'dialog.tip'.tr; + + /// 删除 + String get delete => 'dialog.delete'.tr; + + /// 错误 + String get error => 'dialog.error'.tr; + + /// 成功 + String get success => 'dialog.success'.tr; + + /// 设备登录绑定标题 + String get deviceLoginBindingTitle => 'dialog.deviceLoginBindingTitle'.tr; + + /// 设备登录绑定消息 + String get deviceLoginBindingMessage => 'dialog.deviceLoginBindingMessage'.tr; } /// 更新相关翻译 @@ -932,3 +963,54 @@ class AppTranslationsTray { /// 退出应用 String get exitApp => 'tray.exit_app'.tr; } + +/// 设备管理模块的翻译类 +class AppTranslationsDeviceManagement { + /// 设备管理标题 + String get title => 'deviceManagement.title'.tr; + + /// 删除确认标题 + String get deleteConfirmTitle => 'deviceManagement.deleteConfirmTitle'.tr; + + /// 删除当前设备消息 + String get deleteCurrentDeviceMessage => + 'deviceManagement.deleteCurrentDeviceMessage'.tr; + + /// 删除其他设备消息 + String get deleteOtherDeviceMessage => + 'deviceManagement.deleteOtherDeviceMessage'.tr; + + /// 删除成功 + String get deleteSuccess => 'deviceManagement.deleteSuccess'.tr; + + /// 删除失败 + String deleteFailed(String error) => + 'deviceManagement.deleteFailed'.trParams({'error': error}); + + /// 加载设备列表失败 + String get loadDeviceListFailed => + 'deviceManagement.loadDeviceListFailed'.tr; + + /// 设备登录未启用 + String get deviceLoginDisabled => 'deviceManagement.deviceLoginDisabled'.tr; + + /// 重新登录成功 + String get reloginSuccess => 'deviceManagement.reloginSuccess'.tr; + + /// 重新登录失败(带错误信息) + String reloginFailed(String error) => + 'deviceManagement.reloginFailed'.trParams({'error': error}); + + /// 重新登录失败(通用) + String get reloginFailedGeneric => + 'deviceManagement.reloginFailedGeneric'.tr; + + /// 设备类型 + String get deviceTypeUnknown => 'deviceManagement.deviceTypes.unknown'.tr; + String get deviceTypeAndroid => 'deviceManagement.deviceTypes.android'.tr; + String get deviceTypeIos => 'deviceManagement.deviceTypes.ios'.tr; + String get deviceTypeIpad => 'deviceManagement.deviceTypes.ipad'.tr; + String get deviceTypeMacos => 'deviceManagement.deviceTypes.macos'.tr; + String get deviceTypeWindows => 'deviceManagement.deviceTypes.windows'.tr; + String get deviceTypeLinux => 'deviceManagement.deviceTypes.linux'.tr; +} diff --git a/lib/app/modules/kr_device_management/controllers/kr_device_management_controller.dart b/lib/app/modules/kr_device_management/controllers/kr_device_management_controller.dart index 5266afe..fe3c3d0 100644 --- a/lib/app/modules/kr_device_management/controllers/kr_device_management_controller.dart +++ b/lib/app/modules/kr_device_management/controllers/kr_device_management_controller.dart @@ -10,6 +10,7 @@ import 'package:kaer_with_panels/app/services/kr_site_config_service.dart'; import 'package:kaer_with_panels/app/services/kr_device_info_service.dart'; import 'package:kaer_with_panels/app/services/kr_subscribe_service.dart'; import 'package:kaer_with_panels/app/model/enum/kr_request_type.dart'; +import 'package:kaer_with_panels/app/localization/app_translations.dart'; import 'dart:io'; import 'dart:math'; @@ -52,7 +53,7 @@ class KRDeviceManagementController extends GetxController { result.fold( (error) { KRLogUtil.kr_e('加载设备列表失败: ${error.msg}', tag: 'DeviceManagement'); - Get.snackbar('错误', error.msg); + Get.snackbar(AppTranslations.kr_dialog.error, error.msg); }, (deviceList) { KRLogUtil.kr_i('获取到 ${deviceList.length} 个设备', tag: 'DeviceManagement'); @@ -78,7 +79,7 @@ class KRDeviceManagementController extends GetxController { } catch (e, stackTrace) { KRLogUtil.kr_e('加载设备列表异常: $e', tag: 'DeviceManagement'); KRLogUtil.kr_e('堆栈跟踪: $stackTrace', tag: 'DeviceManagement'); - Get.snackbar('错误', '加载设备列表失败'); + Get.snackbar(AppTranslations.kr_dialog.error, AppTranslations.kr_deviceManagement.loadDeviceListFailed); } finally { isLoading.value = false; } @@ -102,10 +103,10 @@ class KRDeviceManagementController extends GetxController { // 显示确认对话框 await KRDialog.show( - title: '确认删除', + title: AppTranslations.kr_deviceManagement.deleteConfirmTitle, message: isCurrent - ? '确定要删除本机设备吗?删除后将使用设备登录自动重新登录。' - : '确定要删除此设备吗?删除后该设备将被强制下线。', + ? AppTranslations.kr_deviceManagement.deleteCurrentDeviceMessage + : AppTranslations.kr_deviceManagement.deleteOtherDeviceMessage, icon: Container( width: 56, height: 56, @@ -119,8 +120,8 @@ class KRDeviceManagementController extends GetxController { size: 32, ), ), - confirmText: '删除', - cancelText: '取消', + confirmText: AppTranslations.kr_dialog.delete, + cancelText: AppTranslations.kr_dialog.kr_cancel, onConfirm: () { confirmed = true; }, @@ -139,7 +140,7 @@ class KRDeviceManagementController extends GetxController { result.fold( (error) { KRLogUtil.kr_e('删除设备失败: ${error.msg}', tag: 'DeviceManagement'); - Get.snackbar('错误', '删除失败:${error.msg}'); + Get.snackbar(AppTranslations.kr_dialog.error, AppTranslations.kr_deviceManagement.deleteFailed(error.msg)); }, (_) async { KRLogUtil.kr_i('设备删除成功', tag: 'DeviceManagement'); @@ -156,14 +157,14 @@ class KRDeviceManagementController extends GetxController { } else { // 删除其他设备,从列表中移除 devices.removeWhere((device) => device['id'] == id); - Get.snackbar('成功', '设备已删除'); + Get.snackbar(AppTranslations.kr_dialog.success, AppTranslations.kr_deviceManagement.deleteSuccess); } }, ); } catch (e, stackTrace) { KRLogUtil.kr_e('删除设备异常: $e', tag: 'DeviceManagement'); KRLogUtil.kr_e('堆栈跟踪: $stackTrace', tag: 'DeviceManagement'); - Get.snackbar('错误', '删除失败:$e'); + Get.snackbar(AppTranslations.kr_dialog.error, AppTranslations.kr_deviceManagement.deleteFailed(e.toString())); } } @@ -187,7 +188,7 @@ class KRDeviceManagementController extends GetxController { if (!isDeviceLoginEnabled) { KRLogUtil.kr_w('设备登录未启用,执行完整退出登录', tag: 'DeviceManagement'); - Get.snackbar('提示', '设备登录未启用,请手动登录'); + Get.snackbar(AppTranslations.kr_dialog.tip, AppTranslations.kr_deviceManagement.deviceLoginDisabled); await appRunData.kr_loginOut(); return; } @@ -205,7 +206,7 @@ class KRDeviceManagementController extends GetxController { (error) { // 设备登录失败 KRLogUtil.kr_e('设备登录失败: ${error.msg}', tag: 'DeviceManagement'); - Get.snackbar('错误', '自动登录失败:${error.msg},请手动登录'); + Get.snackbar(AppTranslations.kr_dialog.error, AppTranslations.kr_deviceManagement.reloginFailed(error.msg)); // 执行完整退出登录,显示登录界面 appRunData.kr_loginOut(); @@ -238,13 +239,13 @@ class KRDeviceManagementController extends GetxController { KRLogUtil.kr_e('订阅信息刷新失败: $e', tag: 'DeviceManagement'); } - Get.snackbar('成功', '已自动重新登录'); + Get.snackbar(AppTranslations.kr_dialog.success, AppTranslations.kr_deviceManagement.reloginSuccess); }, ); } catch (e, stackTrace) { KRLogUtil.kr_e('设备重新登录异常: $e', tag: 'DeviceManagement'); KRLogUtil.kr_e('堆栈跟踪: $stackTrace', tag: 'DeviceManagement'); - Get.snackbar('错误', '自动登录失败,请手动登录'); + Get.snackbar(AppTranslations.kr_dialog.error, AppTranslations.kr_deviceManagement.reloginFailedGeneric); // 发生异常,执行完整退出登录 await KRAppRunData.getInstance().kr_loginOut(); @@ -253,26 +254,26 @@ class KRDeviceManagementController extends GetxController { /// 获取设备类型和图标 Map getDeviceTypeInfo(String userAgent) { - String deviceType = '未知设备'; + String deviceType = AppTranslations.kr_deviceManagement.deviceTypeUnknown; String iconName = 'devices'; if (userAgent.contains('Android') || userAgent.toLowerCase().contains('android')) { - deviceType = '安卓设备'; + deviceType = AppTranslations.kr_deviceManagement.deviceTypeAndroid; iconName = 'phone_android'; } else if (userAgent.contains('iOS') || userAgent.contains('iPhone') || userAgent.toLowerCase().contains('ios')) { - deviceType = 'iOS 设备'; + deviceType = AppTranslations.kr_deviceManagement.deviceTypeIos; iconName = 'phone_iphone'; } else if (userAgent.contains('iPad')) { - deviceType = 'iPad'; + deviceType = AppTranslations.kr_deviceManagement.deviceTypeIpad; iconName = 'tablet'; } else if (userAgent.contains('macOS') || userAgent.contains('Mac') || userAgent.toLowerCase().contains('mac')) { - deviceType = 'macOS'; + deviceType = AppTranslations.kr_deviceManagement.deviceTypeMacos; iconName = 'desktop_mac'; } else if (userAgent.contains('Windows') || userAgent.toLowerCase().contains('windows')) { - deviceType = 'Windows'; + deviceType = AppTranslations.kr_deviceManagement.deviceTypeWindows; iconName = 'computer'; } else if (userAgent.contains('Linux') || userAgent.toLowerCase().contains('linux')) { - deviceType = 'Linux'; + deviceType = AppTranslations.kr_deviceManagement.deviceTypeLinux; iconName = 'computer'; } diff --git a/lib/app/modules/kr_user_info/views/kr_user_info_view.dart b/lib/app/modules/kr_user_info/views/kr_user_info_view.dart index 421bb60..397579c 100755 --- a/lib/app/modules/kr_user_info/views/kr_user_info_view.dart +++ b/lib/app/modules/kr_user_info/views/kr_user_info_view.dart @@ -119,7 +119,7 @@ class KRUserInfoView extends GetView { shouldShowLoginPrompt = false; } else if (isDeviceLogin) { // 设备登录(游客模式) - displayText = "登录/注册"; + displayText = AppTranslations.kr_userInfo.loginRegister; displayColor = const Color(0xFF1797FF); // 使用蓝色提示可以点击 displayIcon = Icons.touch_app; shouldShowLoginPrompt = true; @@ -195,7 +195,7 @@ class KRUserInfoView extends GetView { SizedBox(width: 8.w), Text( appRunData.isDeviceLogin() - ? "游客ID:${(appRunData.kr_userId.value ?? 0) + 10000}" + ? AppTranslations.kr_userInfo.guestId((appRunData.kr_userId.value ?? 0) + 10000) : "${AppTranslations.kr_userInfo.balance} ${controller.kr_balance.value.toString()}", style: KrAppTextStyle( fontSize: 12, @@ -667,7 +667,7 @@ class KRUserInfoView extends GetView { if (showDeviceManagement) _kr_buildShortcutContainer( icon: "my_dns", - title: "设备管理", + title: AppTranslations.kr_userInfo.deviceManagement, onTap: () { Get.toNamed(Routes.KR_DEVICE_MANAGEMENT); }, diff --git a/lib/app/utils/kr_subscribe_navigation_util.dart b/lib/app/utils/kr_subscribe_navigation_util.dart index 6784f9e..dc7b216 100644 --- a/lib/app/utils/kr_subscribe_navigation_util.dart +++ b/lib/app/utils/kr_subscribe_navigation_util.dart @@ -3,6 +3,7 @@ import 'package:kaer_with_panels/app/common/app_run_data.dart'; import 'package:kaer_with_panels/app/widgets/dialogs/kr_dialog.dart'; import 'package:kaer_with_panels/app/routes/app_pages.dart'; import 'package:kaer_with_panels/app/utils/kr_log_util.dart'; +import 'package:kaer_with_panels/app/localization/app_translations.dart'; /// 订阅导航工具类 /// 用于统一处理订阅相关的导航逻辑 @@ -25,14 +26,16 @@ class KRSubscribeNavigationUtil { // 设备登录用户需要绑定账号 KRLogUtil.kr_i('检测到设备登录,显示绑定提示', tag: tag); KRDialog.show( - title: '提示', - message: '购买套餐需要登录绑定用户', - confirmText: '确定', - cancelText: '取消', + title: AppTranslations.kr_dialog.deviceLoginBindingTitle, + message: AppTranslations.kr_dialog.deviceLoginBindingMessage, + confirmText: AppTranslations.kr_dialog.kr_ok, + cancelText: AppTranslations.kr_dialog.kr_cancel, onConfirm: () { Get.back(); // 关闭对话框 - // 跳转到登录页面(保持设备登录状态) - Get.toNamed(Routes.MR_LOGIN); + // 等待对话框完全关闭后再跳转到登录页面 + Future.delayed(const Duration(milliseconds: 300), () { + Get.toNamed(Routes.MR_LOGIN); + }); }, onCancel: () => Get.back(), );