Made Swift 6 local translation support optional.

Esse commit está contido em:
23rd
2026-04-06 17:43:56 +03:00
commit b80f25fbc5
4 arquivos alterados com 26 adições e 2 exclusões
+3 -1
Ver Arquivo
@@ -97,7 +97,9 @@ PRIVATE
desktop-app::external_xxhash
)
telegram_add_apple_swift_runtime(Telegram)
if (NOT DESKTOP_APP_DISABLE_SWIFT6)
telegram_add_apple_swift_runtime(Telegram)
endif()
target_precompile_headers(Telegram PRIVATE $<$<COMPILE_LANGUAGE:CXX,OBJCXX>:${src_loc}/stdafx.h>)
nice_target_sources(Telegram ${src_loc}
@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/mac/translate_provider_mac.h"
#ifndef TDESKTOP_DISABLE_SWIFT6
#include "base/weak_ptr.h"
#include "spellcheck/platform/platform_language.h"
#include "translate_provider_mac_swift_bridge.h"
@@ -102,4 +104,19 @@ bool IsTranslateProviderAvailable() {
return TranslateProviderMacSwiftIsAvailable();
}
#else // TDESKTOP_DISABLE_SWIFT6
// Local on-device translation disabled (no Swift 6).
namespace Platform {
std::unique_ptr<Ui::TranslateProvider> CreateTranslateProvider() {
return nullptr;
}
bool IsTranslateProviderAvailable() {
return false;
}
#endif // TDESKTOP_DISABLE_SWIFT6
} // namespace Platform
+5
Ver Arquivo
@@ -51,3 +51,8 @@ endif()
if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_definitions(Telegram PRIVATE TDESKTOP_ALLOW_CLOSED_ALPHA)
endif()
option(DESKTOP_APP_DISABLE_SWIFT6 "Disable local on-device translation (build without Swift 6 on macOS)." OFF)
if (DESKTOP_APP_DISABLE_SWIFT6)
target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_SWIFT6)
endif()