ShouldAddSourceLocationsAsComments
ShouldAddSourceLocationsAsComments
#Overview
name: ShouldAddSourceLocationsAsComments
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShouldAddSourceLocationsAsComments is to control whether source locations should be added as comments in PO (Portable Object) files during the localization export process in Unreal Engine 5.
This setting variable is primarily used by the Localization module of Unreal Engine 5. It is part of the FLocalizationExportingSettings struct, which is used to configure the export settings for localization targets.
The value of this variable is typically set through the Unreal Engine editor interface, where it appears as a configurable option in the localization settings. It can also be set programmatically when creating or modifying localization targets.
This variable interacts with other localization export settings, such as ShouldPersistCommentsOnExport and CollapseMode, which are part of the same FLocalizationExportingSettings struct.
Developers must be aware that enabling this option can increase the size of the exported PO files, as it adds additional comment lines for each entry. However, it can be extremely useful for debugging and tracing the origin of localized strings.
Best practices when using this variable include:
- Enable it during development and testing phases to help with debugging and tracing.
- Consider disabling it for final production builds to reduce file sizes, unless the additional information is necessary for your localization workflow.
- Use it in conjunction with other localization settings to create a comprehensive export configuration that suits your project’s needs.
- Be consistent in its usage across all localization targets in your project to maintain uniformity in your localization files.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/Localization/EngineOverrides_Export.ini:31, section: [GatherTextStep0]
- INI Section:
GatherTextStep0
- Raw value:
true
- Is Array:
False
Location: <Workspace>/Projects/Lyra/Config/Localization/Game_Export.ini:31, section: [GatherTextStep0]
- INI Section:
GatherTextStep0
- Raw value:
true
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:738
Scope (from outer to inner):
file
namespace LocalizationConfigurationScript
function FLocalizationConfigurationScript GenerateExportTextConfigFile
Source code excerpt:
ConfigSection.Add(TEXT("ShouldPersistCommentsOnExport"), Target->Settings.ExportSettings.ShouldPersistCommentsOnExport ? TEXT("true") : TEXT("false"));
ConfigSection.Add(TEXT("ShouldAddSourceLocationsAsComments"), Target->Settings.ExportSettings.ShouldAddSourceLocationsAsComments ? TEXT("true") : TEXT("false"));
}
Script.AddGatherTextStep(0, MoveTemp(ConfigSection));
}
Script.Dirty = true;
#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:313
Scope (from outer to inner):
file
function FLocalizationExportingSettings
Source code excerpt:
, POFormat(EPortableObjectFormat::Unreal)
, ShouldPersistCommentsOnExport(false)
, ShouldAddSourceLocationsAsComments(true)
{
}
/* How should we collapse down text when exporting to PO? */
UPROPERTY(config, EditAnywhere, Category = "Collapsing", AdvancedDisplay)
ELocalizedTextCollapseMode CollapseMode;
#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:331
Scope: file
Source code excerpt:
/* Should source locations be added to PO file entries as comments? Useful if a third party service doesn't expose PO file reference comments, which typically store the source location. */
UPROPERTY(config, EditAnywhere, Category = "Comments")
bool ShouldAddSourceLocationsAsComments;
};
USTRUCT()
struct FLocalizationCompilationSettings
{
GENERATED_BODY()