Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Source/TolgeeProvider/Private/TolgeeLocalizationProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <Interfaces/IMainFrameModule.h>
#include <LocalizationCommandletTasks.h>
#include <LocalizationTargetTypes.h>
#include <LocalizationSettings.h>

#include "TolgeeProviderLocalizationServiceCommand.h"
#include "TolgeeProviderLocalizationServiceWorker.h"
Expand Down Expand Up @@ -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<IMainFrameModule>(TEXT("MainFrame"));
const TSharedPtr<SWindow>& MainFrameParentWindow = MainFrameModule.GetParentWindow();
LocalizationCommandletTasks::ExportTextForTarget(MainFrameParentWindow.ToSharedRef(), LocalizationTarget.Get(), AbsoluteFolderPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ bool FTolgeeProviderUploadFileWorker::Execute(FTolgeeProviderLocalizationService

const UTolgeeEditorSettings* ProviderSettings = GetDefault<UTolgeeEditorSettings>();
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();
Expand Down
Loading