mirror of
https://github.com/xweiba/location-spoofer.git
synced 2026-09-26 16:41:54 +08:00
fix(i18n): 修复首选语言回退并准备 v1.0.8
This commit is contained in:
@@ -25,25 +25,25 @@ enum ThirdPartyProxyError: LocalizedError, Equatable {
|
||||
var errorDescription: String? {
|
||||
switch self {
|
||||
case .invalidResponse:
|
||||
return String(localized: "第三方代理返回了无法识别的数据")
|
||||
return AppLocalization.string("第三方代理返回了无法识别的数据")
|
||||
case .moduleNotIntercepted:
|
||||
return String(localized: "请求未被第三方代理模块拦截,请检查模块、MITM 和代理连接")
|
||||
return AppLocalization.string("请求未被第三方代理模块拦截,请检查模块、MITM 和代理连接")
|
||||
case .rejected(let message):
|
||||
return message
|
||||
case .coordinateMismatch:
|
||||
return String(localized: "第三方代理保存的坐标与当前选点不一致")
|
||||
return AppLocalization.string("第三方代理保存的坐标与当前选点不一致")
|
||||
case .network(let message):
|
||||
return String(localized: "第三方代理请求失败:\(message)")
|
||||
return AppLocalization.string("第三方代理请求失败:\(message)")
|
||||
}
|
||||
}
|
||||
|
||||
var recoverySuggestion: String {
|
||||
return String(localized: "检查模块、MITM、证书和代理/VPN连接")
|
||||
return AppLocalization.string("检查模块、MITM、证书和代理/VPN连接")
|
||||
}
|
||||
|
||||
static func recoverySuggestion(for error: Error) -> String {
|
||||
(error as? Self)?.recoverySuggestion
|
||||
?? String(localized: "检查模块、MITM、证书和代理/VPN连接")
|
||||
?? AppLocalization.string("检查模块、MITM、证书和代理/VPN连接")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
randomRadius: RandomRadiusStore.shared.isEnabled ? RandomRadiusStore.shared.radius : 0
|
||||
))
|
||||
guard response.success else {
|
||||
throw ThirdPartyProxyError.rejected(response.error ?? String(localized: "第三方代理拒绝保存坐标"))
|
||||
throw ThirdPartyProxyError.rejected(response.error ?? AppLocalization.string("第三方代理拒绝保存坐标"))
|
||||
}
|
||||
guard let latitude = response.latitude,
|
||||
let longitude = response.longitude,
|
||||
@@ -126,7 +126,7 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
func clear() async throws {
|
||||
let response = try await perform(action: .clear)
|
||||
guard response.success else {
|
||||
throw ThirdPartyProxyError.rejected(response.error ?? String(localized: "第三方代理清除坐标失败"))
|
||||
throw ThirdPartyProxyError.rejected(response.error ?? AppLocalization.string("第三方代理清除坐标失败"))
|
||||
}
|
||||
activeSettings = nil
|
||||
connectionState = .connected(active: false)
|
||||
@@ -142,7 +142,7 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
if response.error?.contains("无已保存") == true {
|
||||
return false
|
||||
}
|
||||
throw ThirdPartyProxyError.rejected(response.error ?? String(localized: "第三方代理查询失败"))
|
||||
throw ThirdPartyProxyError.rejected(response.error ?? AppLocalization.string("第三方代理查询失败"))
|
||||
}
|
||||
|
||||
private enum Action {
|
||||
@@ -153,7 +153,7 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
|
||||
private func perform(action: Action) async throws -> ThirdPartyProxySettingsResponse {
|
||||
guard !isRequesting else {
|
||||
throw ThirdPartyProxyError.rejected(String(localized: "已有第三方代理请求正在执行"))
|
||||
throw ThirdPartyProxyError.rejected(AppLocalization.string("已有第三方代理请求正在执行"))
|
||||
}
|
||||
isRequesting = true
|
||||
defer { isRequesting = false }
|
||||
@@ -229,7 +229,7 @@ enum ThirdPartyProxyClient: String, CaseIterable, Identifiable {
|
||||
}
|
||||
|
||||
var verificationText: String? {
|
||||
self == .shadowrocket ? nil : String(localized: "配置已提供,尚未验证")
|
||||
self == .shadowrocket ? nil : AppLocalization.string("配置已提供,尚未验证")
|
||||
}
|
||||
|
||||
var moduleFileName: String {
|
||||
|
||||
Reference in New Issue
Block a user