diff --git a/Source/TolgeeProvider/Private/TolgeeLocalizationProvider.cpp b/Source/TolgeeProvider/Private/TolgeeLocalizationProvider.cpp index 2713cf6..94d22ea 100644 --- a/Source/TolgeeProvider/Private/TolgeeLocalizationProvider.cpp +++ b/Source/TolgeeProvider/Private/TolgeeLocalizationProvider.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "TolgeeProviderLocalizationServiceCommand.h" #include "TolgeeProviderLocalizationServiceWorker.h" @@ -286,6 +287,15 @@ void FTolgeeLocalizationProvider::ExportAllCulturesForTargetToTolgee(TWeakObject // TODO: Revisit after https://github.com/tolgee/tolgee-platform/issues/3053 LocalizationTarget->Settings.ExportSettings.POFormat = EPortableObjectFormat::Crowdin; + // NOTE: Export uses files from "ProjectDir/Saved/Tolgee/..., therefore we never want to check them out (or perforce any SCP actions) + // There, we disabled it temporarily before the tasks starts and reset it (in case the developer wants to use it for the import flow). + const bool bWasSourceControlEnabled = FLocalizationSourceControlSettings::IsSourceControlEnabled(); + FLocalizationSourceControlSettings::SetSourceControlEnabled(false); + ON_SCOPE_EXIT + { + FLocalizationSourceControlSettings::SetSourceControlEnabled(bWasSourceControlEnabled); + }; + IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked(TEXT("MainFrame")); const TSharedPtr& MainFrameParentWindow = MainFrameModule.GetParentWindow(); LocalizationCommandletTasks::ExportTextForTarget(MainFrameParentWindow.ToSharedRef(), LocalizationTarget.Get(), AbsoluteFolderPath); diff --git a/Source/TolgeeProvider/Private/TolgeeProviderLocalizationServiceOperations.cpp b/Source/TolgeeProvider/Private/TolgeeProviderLocalizationServiceOperations.cpp index 931fdb1..b664a1f 100644 --- a/Source/TolgeeProvider/Private/TolgeeProviderLocalizationServiceOperations.cpp +++ b/Source/TolgeeProvider/Private/TolgeeProviderLocalizationServiceOperations.cpp @@ -63,6 +63,13 @@ bool FTolgeeProviderUploadFileWorker::Execute(FTolgeeProviderLocalizationService const UTolgeeEditorSettings* ProviderSettings = GetDefault(); const FTolgeePerTargetSettings* ProjectSettings = ProviderSettings->PerTargetSettings.Find(TargetGuid); + if (!ProjectSettings) + { + InCommand.ErrorMessages.Add(FString::Printf(TEXT("Project not configured for %s"), *TargetGuid.ToString())); + InCommand.bCommandSuccessful = false; + return InCommand.bCommandSuccessful; + } + const FString Url = FString::Printf(TEXT("%s/v2/projects/%s/single-step-import"), *ProviderSettings->GetBaseUrl(), *ProjectSettings->ProjectId); FHttpRequestRef HttpRequest = FHttpModule::Get().CreateRequest();