From 34d9875ff3f9407966de82791aedfd6ee3be8b7d Mon Sep 17 00:00:00 2001 From: True Zhuanjia Date: Sun, 30 Jun 2024 23:46:21 +0800 Subject: [PATCH] host discovery Chinese localization. Cancel LAN restriction --- Limelight/Localization/Localizable.xcstrings | 30 +++++++++++++++++++- Limelight/Network/DiscoveryManager.m | 14 ++++----- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Limelight/Localization/Localizable.xcstrings b/Limelight/Localization/Localizable.xcstrings index 5825964f..7ddfd189 100644 --- a/Limelight/Localization/Localizable.xcstrings +++ b/Limelight/Localization/Localizable.xcstrings @@ -349,6 +349,23 @@ } } }, + "Manual_Add_Host_Fail" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Could not connect to host.\n\nIf you're hosting using GeForce Experience, make sure you've enabled the toggle on the SHIELD tab.\n\nIf you're hosting using Sunshine, ensure it is running properly. If you're using a non-default port, you will need to include that here." + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "无法连接远程主机\n\n如果主机运行的是Geforce Experience, 确认SHIELD已启用.\n\n如果主机运行的是Sushine, 确认服务正常运行. 如果使用非默认端口, 请添加到地址中." + } + } + } + }, "ML_TEST_RESULT_INCONCLUSIVE" : { "extractionState" : "manual", "localizations" : { @@ -366,6 +383,17 @@ } } }, + "Moonlight-iOS/tvOS only supports adding PCs on your local network on %s." : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "Moonlight-iOS/tvOS仅支持添加局域网中的主机" + } + } + } + }, "Mouse Pointer Velocity: %d%%" : { "extractionState" : "manual", "localizations" : { @@ -924,7 +952,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "调节靠右 %d%%屏幕区域的触点灵敏度" + "value" : "调节屏幕靠右 %d%%区域的触点灵敏度" } } } diff --git a/Limelight/Network/DiscoveryManager.m b/Limelight/Network/DiscoveryManager.m index a72df635..e0d382f2 100644 --- a/Limelight/Network/DiscoveryManager.m +++ b/Limelight/Network/DiscoveryManager.m @@ -14,6 +14,7 @@ #import "DiscoveryWorker.h" #import "ServerInfoResponse.h" #import "IdManager.h" +#import "LocalizationHelper.h" #include #include @@ -110,7 +111,8 @@ return NO; } - BOOL ret = ![DiscoveryManager isAddressLAN:((struct sockaddr_in*)result->ai_addr)->sin_addr.s_addr]; + // BOOL ret = ![DiscoveryManager isAddressLAN:((struct sockaddr_in*)result->ai_addr)->sin_addr.s_addr]; + BOOL ret = NO; // Cancel LAN restriction for personnal use. freeaddrinfo(result); return ret; @@ -128,13 +130,7 @@ - (void) discoverHost:(NSString *)hostAddress withCallback:(void (^)(TemporaryHost *, NSString*))callback { BOOL prohibitedAddress = [DiscoveryManager isProhibitedAddress:hostAddress]; - NSString* prohibitedAddressMessage = [NSString stringWithFormat: @"Moonlight only supports adding PCs on your local network on %s.", - #if TARGET_OS_TV - "tvOS" - #else - "iOS" - #endif - ]; + NSString* prohibitedAddressMessage = [LocalizationHelper localizedStringForKey: @"Moonlight-iOS/tvOS only supports adding PCs on your local network on %s."]; ServerInfoResponse* serverInfoResponse = [self getServerInfoResponseForAddress:hostAddress]; TemporaryHost* host = nil; @@ -202,7 +198,7 @@ callback(host, nil); } } else if (!prohibitedAddress) { - callback(nil, @"Could not connect to host.\n\nIf you're hosting using GeForce Experience, make sure you've enabled the toggle on the SHIELD tab.\n\nIf you're hosting using Sunshine, ensure it is running properly. If you're using a non-default port, you will need to include that here."); + callback(nil, [LocalizationHelper localizedStringForKey:@"Manual_Add_Host_Fail"]); } else { callback(nil, prohibitedAddressMessage); }