feat: 全量英文界面(i18n 翻译表接入全部页面与服务层文案)
This commit is contained in:
1 parent
2eb3f42731
commit
71e76b1c2b
26 files changed
+775
-325
No files matched your search
@@ -6,6 +6,7 @@ import 'jar_metadata.dart';
|
||||
import 'sftp_service.dart';
|
||||
import 'package:dartssh2/dartssh2.dart' show SftpName;
|
||||
import '../../providers/server_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 本地依赖索引库(SQLite):
|
||||
/// 1. 记录服务器 mods/plugins 下每个 jar 的元数据与依赖;
|
||||
@@ -167,7 +168,7 @@ class SyncResult {
|
||||
int unchanged = 0;
|
||||
int total = 0;
|
||||
@override
|
||||
String toString() => '新增 $added · 更新 $updated · 未变化 $unchanged · 共 $total 条';
|
||||
String toString() => S.f('新增 {0} · 更新 {1} · 未变化 {2} · 共 {3} 条', [added, updated, unchanged, total]);
|
||||
}
|
||||
|
||||
class IndexedMod {
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'sftp_service.dart';
|
||||
import '../../providers/server_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
enum DownloadStatus { queued, running, paused, completed, failed, canceled }
|
||||
|
||||
@@ -219,7 +220,7 @@ class DownloadManager extends ChangeNotifier {
|
||||
} on DioException catch (e) {
|
||||
if (token.isCancelled) return; // 暂停/取消
|
||||
attempt++;
|
||||
task.error = e.message ?? '网络错误';
|
||||
task.error = e.message ?? S.t('网络错误');
|
||||
if (attempt > maxRetry) {
|
||||
_updateStatus(task.id, DownloadStatus.failed);
|
||||
notifyListeners();
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 镜像源服务:内置 MCIM(Modrinth 国内镜像),支持自定义线路与一键测速。
|
||||
class MirrorService extends ChangeNotifier {
|
||||
static const _prefKey = 'mirror_line';
|
||||
|
||||
/// 内置镜像线路:id → 名称。'official' 为 Modrinth 官方源。
|
||||
static const builtinMirrors = {
|
||||
'official': 'Modrinth 官方',
|
||||
'mcim': 'MCIM 国内镜像 (mcimirror.top)',
|
||||
static Map<String, String> get builtinMirrors => {
|
||||
'official': S.t('Modrinth 官方'),
|
||||
'mcim': S.t('MCIM 国内镜像 (mcimirror.top)'),
|
||||
};
|
||||
|
||||
String _current = 'mcim';
|
||||
@@ -20,7 +21,7 @@ class MirrorService extends ChangeNotifier {
|
||||
String get customUrl => _customUrl;
|
||||
|
||||
String get currentName {
|
||||
if (_current == 'custom') return '自定义 ($_customUrl)';
|
||||
if (_current == 'custom') return S.f('自定义 ({0})', [_customUrl]);
|
||||
return builtinMirrors[_current] ?? _current;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:typed_data';
|
||||
import 'package:dartssh2/dartssh2.dart';
|
||||
import 'dart:io' as io;
|
||||
import '../../providers/server_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 基于 dartssh2 的 SFTP 文件服务。
|
||||
/// 一次连接同时支持列目录 / 上传 / 下载 / 删除 / 重命名,
|
||||
@@ -103,7 +104,7 @@ class SftpService {
|
||||
SftpClient _requireSftp() {
|
||||
final sftp = _sftp;
|
||||
if (sftp == null || !isConnected) {
|
||||
throw StateError('SFTP 未连接,请先调用 connect()');
|
||||
throw StateError(S.t('SFTP 未连接,请先调用 connect()'));
|
||||
}
|
||||
return sftp;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user