ShouldGatherFromEditorOnlyData

ShouldGatherFromEditorOnlyData

#Overview

name: ShouldGatherFromEditorOnlyData

The value of this variable can be defined or overridden in .ini config files. 23 .ini config files referencing this setting variable.

It is referenced in 18 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShouldGatherFromEditorOnlyData is to control whether editor-only data should be included in the localization gathering process. This variable is used in Unreal Engine’s localization system to determine if text marked as editor-only should be collected for translation.

The Unreal Engine subsystems that rely on this setting variable are primarily within the Localization module and the UnrealEd module. Specifically, it is used in the following areas:

  1. Localization Configuration Script generation
  2. Text gathering from text files
  3. Text gathering from packages
  4. Text gathering from metadata
  5. Text gathering from source code

The value of this variable is typically set in configuration files and can be modified through the Unreal Editor’s Project Settings or directly in the configuration files.

This variable interacts with other localization-related variables and settings, such as IsEnabled, ShouldExcludeDerivedClasses, and SkipGatherCache.

Developers must be aware that:

  1. This setting is primarily useful for localizing Unreal Engine itself, rather than for most game projects.
  2. Enabling this option may significantly increase the amount of text gathered for localization, which could impact performance and translation costs.
  3. Editor-only text is typically not needed for shipping games, so this should be used cautiously.

Best practices when using this variable include:

  1. Keep it disabled for most game projects unless there’s a specific need for editor-only text localization.
  2. When localizing Unreal Engine itself or creating editor plugins that need localization, enable this option.
  3. Be mindful of the performance impact when enabling this option, especially for large projects.
  4. Regularly review and clean up editor-only text to ensure only necessary content is being localized.
  5. Use it in conjunction with other localization settings to fine-tune the gathering process for your specific needs.

#Setting Variables

#References In INI files

<Workspace>/Engine/Config/Localization/Category.ini:40, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:39, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Editor.ini:49, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Editor.ini:84, section: [GatherTextStep2]
<Workspace>/Engine/Config/Localization/EditorTutorials.ini:40, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:45, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/Engine.ini:62, section: [GatherTextStep1]
<Workspace>/Engine/Config/Localization/Keywords.ini:35, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/PropertyNames.ini:40, section: [GatherTextStep0]
<Workspace>/Engine/Config/Localization/ToolTips.ini:43, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/Android/OnlineSubsystemGooglePlay/Config/Localization/OnlineSubsystemGooglePlay.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/IOS/OnlineSubsystemIOS/Config/Localization/OnlineSubsystemIOS.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineFramework/Config/Localization/OnlineFramework.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystem/Config/Localization/OnlineSubsystem.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemAmazon/Config/Localization/OnlineSubsystemAmazon.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Config/Localization/OnlineSubsystemFacebook.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemOculus/Config/Localization/OnlineSubsystemOculus.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemSteam/Config/Localization/OnlineSubsystemSteam.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Config/Localization/OnlineSubsystemUtils.ini:33, section: [GatherTextStep0]
<Workspace>/Engine/Plugins/Runtime/HTTPChunkInstaller/Config/Localization/HTTPChunkInstaller.ini:33, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/EngineOverrides_Gather.ini:34, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/Game_Gather.ini:40, section: [GatherTextStep0]
<Workspace>/Projects/Lyra/Config/Localization/Game_Gather.ini:55, section: [GatherTextStep1]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:352

Scope (from outer to inner):

file
namespace    LocalizationConfigurationScript
function     FLocalizationConfigurationScript GenerateGatherTextConfigFile

Source code excerpt:

			}

			ConfigSection.Add( TEXT("ShouldGatherFromEditorOnlyData"), Target->Settings.GatherFromTextFiles.ShouldGatherFromEditorOnlyData ? TEXT("true") : TEXT("false") );
			
			Script.AddGatherTextStep(GatherTextStepIndex++, MoveTemp(ConfigSection));
		}

		// GatherTextFromAssets
		if (Target->Settings.GatherFromPackages.IsEnabled)

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:399

Scope (from outer to inner):

file
namespace    LocalizationConfigurationScript
function     FLocalizationConfigurationScript GenerateGatherTextConfigFile

Source code excerpt:

			ConfigSection.Add(TEXT("ShouldExcludeDerivedClasses"), Target->Settings.GatherFromPackages.ShouldExcludeDerivedClasses ? TEXT("true") : TEXT("false"));

			ConfigSection.Add( TEXT("ShouldGatherFromEditorOnlyData"), Target->Settings.GatherFromPackages.ShouldGatherFromEditorOnlyData ? TEXT("true") : TEXT("false") );
			ConfigSection.Add( TEXT("SkipGatherCache"), Target->Settings.GatherFromPackages.SkipGatherCache ? TEXT("true") : TEXT("false") );

			Script.AddGatherTextStep(GatherTextStepIndex++, MoveTemp(ConfigSection));
		}

		// GatherTextFromMetadata

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:453

Scope (from outer to inner):

file
namespace    LocalizationConfigurationScript
function     FLocalizationConfigurationScript GenerateGatherTextConfigFile

Source code excerpt:

			}

			ConfigSection.Add( TEXT("ShouldGatherFromEditorOnlyData"), Target->Settings.GatherFromMetaData.ShouldGatherFromEditorOnlyData ? TEXT("true") : TEXT("false") );

			Script.AddGatherTextStep(GatherTextStepIndex++, MoveTemp(ConfigSection));
		}

		// GenerateGatherManifest
		{

#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:119

Scope (from outer to inner):

file
function     FGatherTextFromTextFilesConfiguration

Source code excerpt:

		: IsEnabled(true)
		, FileExtensions(GetDefaultTextFileExtensions())
		, ShouldGatherFromEditorOnlyData(false)
	{
	}

	/* If enabled, text from text files will be gathered according to this configuration. */
	UPROPERTY(config, EditAnywhere, Category = "Execution")
	bool IsEnabled;

#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:141

Scope: file

Source code excerpt:

	/* If enabled, data that is specified as editor-only may be processed for gathering. */
	UPROPERTY(config, EditAnywhere, Category = "Filter")
	bool ShouldGatherFromEditorOnlyData;

	LOCALIZATION_API bool Validate(const bool bIsEngineTarget, FText& OutError) const;
};


USTRUCT()

#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:158

Scope (from outer to inner):

file
function     FGatherTextFromPackagesConfiguration

Source code excerpt:

		, FileExtensions(GetDefaultPackageFileExtensions())
		, ShouldExcludeDerivedClasses(false)
		, ShouldGatherFromEditorOnlyData(false)
		, SkipGatherCache(false)
	{
		{
			FGatherTextExcludePath L10NPath;
			L10NPath.Pattern = TEXT("Content/L10N/*");
			ExcludePathWildcards.Add(L10NPath);

#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:198

Scope: file

Source code excerpt:

	/* If enabled, data that is specified as editor-only may be processed for gathering. */
	UPROPERTY(config, EditAnywhere, Category = "Gather Text")
	bool ShouldGatherFromEditorOnlyData;

	/* Should we ignore the cached text in the package header and perform a full package load instead? */
	UPROPERTY(config, EditAnywhere, Category = "Gather Text", AdvancedDisplay)
	bool SkipGatherCache;

	LOCALIZATION_API bool Validate(const bool bIsEngineTarget, FText& OutError) const;

#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:261

Scope (from outer to inner):

file
function     FGatherTextFromMetaDataConfiguration

Source code excerpt:

	FGatherTextFromMetaDataConfiguration()
		: IsEnabled(false)
		, ShouldGatherFromEditorOnlyData(false)
	{
	}

	/* If enabled, metadata will be gathered according to this configuration. */
	UPROPERTY(config, EditAnywhere, Category = "Execution")
	bool IsEnabled;

#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:299

Scope: file

Source code excerpt:

	/* If enabled, data that is specified as editor-only may be processed for gathering. */
	UPROPERTY(config, EditAnywhere, Category = "Filter")
	bool ShouldGatherFromEditorOnlyData;

	LOCALIZATION_API bool Validate(const bool bIsEngineTarget, FText& OutError) const;
};

USTRUCT()
struct FLocalizationExportingSettings

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Commandlets/GatherTextFromMetadataCommandlet.h:47

Scope (from outer to inner):

file
class        class UGatherTextFromMetaDataCommandlet : public UGatherTextCommandletBase

Source code excerpt:


private:
	bool ShouldGatherFromEditorOnlyData;

	struct FFieldClassFilter
	{
		explicit FFieldClassFilter(const FFieldClass* InFieldClass)
			: FieldClass(InFieldClass)
			, ObjectClass(nullptr)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Commandlets/GatherTextFromSourceCommandlet.h:175

Scope (from outer to inner):

file
class        class UGatherTextFromSourceCommandlet : public UGatherTextCommandletBase

Source code excerpt:


		//Should editor-only data be included in this gather?
		bool ShouldGatherFromEditorOnlyData;

		//Discovered string table data from all files
		TMap<FName, FParsedStringTable> ParsedStringTables;

		TArray<FString> TextLines;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Commandlets/GatherTextFromSourceCommandlet.h:196

Scope (from outer to inner):

file
class        class UGatherTextFromSourceCommandlet : public UGatherTextCommandletBase
function     FSourceFileParseContext

Source code excerpt:

			, WithinNamespaceDefineLineNumber(INDEX_NONE)
			, WithinStartingLine(nullptr)
			, ShouldGatherFromEditorOnlyData(false)
			, MacroBlockStack()
			, CachedEditorOnlyDefineState()
			, OwnerCommandlet(InOwnerCommandlet)
		{
			check(OwnerCommandlet);
		}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:127

Scope (from outer to inner):

file
function     int32 UGatherTextFromMetaDataCommandlet::Main

Source code excerpt:


	// Get whether we should gather editor-only data. Typically only useful for the localization of UE itself.
	if (!GetBoolFromConfig(*SectionName, TEXT("ShouldGatherFromEditorOnlyData"), ShouldGatherFromEditorOnlyData, GatherTextConfigPath))
	{
		ShouldGatherFromEditorOnlyData = false;
	}

	// FieldTypesToInclude/FieldTypesToExclude
	{
		auto GetFieldTypesArrayFromConfig = [this, &SectionName, &GatherTextConfigPath](const TCHAR* InConfigKey, TArray<FFieldClassFilter>& OutFieldTypes)
		{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:432

Scope (from outer to inner):

file
function     bool UGatherTextFromMetaDataCommandlet::ShouldGatherFromField

Source code excerpt:

	};

	return (!bIsEditorOnly || ShouldGatherFromEditorOnlyData) && ShouldGatherFieldByType() && ShouldGatherFieldByOwnerType();
}

template <typename FieldType>
void UGatherTextFromMetaDataCommandlet::GatherTextFromFieldImpl(FieldType* Field, const FGatherParameters& Arguments, const FName InPlatformName)
{
	for (int32 i = 0; i < Arguments.InputKeys.Num(); ++i)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:307

Scope (from outer to inner):

file
function     int32 UGatherTextFromSourceCommandlet::Main

Source code excerpt:


	// Get whether we should gather editor-only data. Typically only useful for the localization of UE itself.
	if (!GetBoolFromConfig(*SectionName, TEXT("ShouldGatherFromEditorOnlyData"), ParseCtxt.ShouldGatherFromEditorOnlyData, GatherTextConfigPath))
	{
		ParseCtxt.ShouldGatherFromEditorOnlyData = false;
	}

	// Parse all source files for macros and add entries to SourceParsedEntries
	for ( FString& SourceFile : FilesToProcess)
	{
		ParseCtxt.Filename = SourceFile;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:364

Scope (from outer to inner):

file
function     int32 UGatherTextFromSourceCommandlet::Main

Source code excerpt:

			for (const auto& ParsedStringTableEntryPair : ParsedStringTablePair.Value.TableEntries)
			{
				if (!ParsedStringTableEntryPair.Value.bIsEditorOnly || ParseCtxt.ShouldGatherFromEditorOnlyData)
				{
					FManifestContext SourceContext;
					SourceContext.Key = ParsedStringTableEntryPair.Key;
					SourceContext.SourceLocation = ParsedStringTableEntryPair.Value.SourceLocation.ToString();
					SourceContext.PlatformName = ParsedStringTableEntryPair.Value.PlatformName;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:377

Scope (from outer to inner):

file
function     int32 UGatherTextFromSourceCommandlet::Main

Source code excerpt:

						for (const auto& ParsedMetaDataPair : *ParsedMetaDataMap)
						{
							if (!ParsedMetaDataPair.Value.bIsEditorOnly || ParseCtxt.ShouldGatherFromEditorOnlyData)
							{
								SourceContext.InfoMetadataObj->SetStringField(ParsedMetaDataPair.Key.ToString(), ParsedMetaDataPair.Value.MetaData);
							}
						}
					}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromSourceCommandlet.cpp:1156

Scope (from outer to inner):

file
function     bool UGatherTextFromSourceCommandlet::FSourceFileParseContext::AddManifestText

Source code excerpt:

	const bool bIsEditorOnly = EvaluateEditorOnlyDefineState() == EEditorOnlyDefineState::Defined;

	if (!bIsEditorOnly || ShouldGatherFromEditorOnlyData)
	{
		const FString EntryDescription = FString::Printf(TEXT("%s macro"), *Token);
		return OwnerCommandlet->GatherManifestHelper->AddSourceText(InNamespace, FLocItem(SourceText), Context, &EntryDescription);
	}

	return false;