FLocTextHelper

High-level access to the non-compiled localization resources (manifests and archives) in a way that abstracts some of their quirks.

Unreal Engine C++ API Reference > Developer > Localization

References

   
Module Localization
Header /Engine/Source/Developer/Localization/Public/LocTextHelper.h
Include #include "LocTextHelper.h"

Syntax

class FLocTextHelper  

Remarks

High-level access to the non-compiled localization resources (manifests and archives) in a way that abstracts some of their quirks. Each instance gives access to a single localization target consisting of a single manifest and several archives (a native archive, and one for each foreign culture).

Constructors

Type Name Description
  FLocTextHelper ( FString InTargetName, TSharedPtr< ILocFileNotifies > InLo..., const ELocTextPlatformSplitMode InP... ) Construct an empty helper.
  FLocTextHelper ( FString InTargetPath, FString InManifestName, FString InArchiveName, FString InNativeCulture, TArray< FString > InForeignCultures, TSharedPtr< ILocFileNotifies > InLo..., const ELocTextPlatformSplitMode InP... ) Construct a helper for the given target information.

Functions

Type Name Description
void AddConflict ( const FLocKey& InNamespace, const FLocKey& InKey, const TSharedPtr< FLocMetadataObjec..., const FLocItem& InSource, const FString& InSourceLocation ) Add a new conflict entry.
bool AddDependency ( const FString& InDependencyFilePat..., FText* OutError ) Attempt to add a manifest dependency.
bool AddSourceText ( const FLocKey& InNamespace, const FLocItem& InSource, const FManifestContext& InContext, const FString* InDescription ) Add a new source text entry to the manifest.
bool AddTranslation ( const FString& InCulture, const FLocKey& InNamespace, const FLocKey& InKey, const TSharedPtr< FLocMetadataObjec..., const FLocItem& InSource, const FLocItem& InTranslation, const bool InOptional ) Add a new translation to the given archive.
bool AddTranslation ( const FString& InCulture, const TSharedRef< FArchiveEntry >&... ) Add a new translation to the given archive.
void EnumerateSourceTexts ( const FEnumerateSourceTextsFuncPtr ..., const bool InCheckDependencies )  
void EnumerateTranslations ( const FString& InCulture, const FEnumerateTranslationsFuncPtr..., const bool InCheckDependencies )  
TSharedPtr< ... FindDependencyEntry ( const FLocKey& InNamespace, const FLocKey& InKey, const FString* InSourceText, FString* OutDependencyFilePath ) Find an dependency entry using its namespace and key.
TSharedPtr< ... FindDependencyEntry ( const FLocKey& InNamespace, const FManifestContext& InContext, FString* OutDependencyFilePath ) Find an existing dependency entry using its namespace and context.
bool FindKeysForLegacyTranslation ( const TSharedRef< const FInternatio..., const TSharedPtr< const FInternatio..., const FLocKey& InNamespace, const FString& InSource, const TSharedPtr< FLocMetadataObjec..., TArray< FLocKey >& OutKeys ) Given a manifest and (optional) native archive, try and find all the keys that the source string should use by checking the manifest.
bool FindKeysForLegacyTranslation ( const FString& InCulture, const FLocKey& InNamespace, const FString& InSource, const TSharedPtr< FLocMetadataObjec..., TArray< FLocKey >& OutKeys ) Given a culture, try and find all the keys that the source string should use by checking the manifest.
TSharedPtr< ... FindSourceText ( const FLocKey& InNamespace, const FLocKey& InKey, const FString* InSourceText ) Find an existing source text entry using its namespace and key.
TSharedPtr< ... FindSourceText ( const FLocKey& InNamespace, const FManifestContext& InContext ) Find an existing source text entry using its namespace and context.
TSharedPtr< ... FindTranslation ( const FString& InCulture, const FLocKey& InNamespace, const FLocKey& InKey, const TSharedPtr< FLocMetadataObjec... ) Find an existing translation entry from its source text.
TArray< FStr... GetAllCultures ( const bool bSingleCultureMode )  
FString GetConflictReport () Get a conflict report that can be easily saved as a report summary.
const FStrin... GetCopyrightNotice ()  
void GetExportText ( const FString& InCulture, const FLocKey& InNamespace, const FLocKey& InKey, const TSharedPtr< FLocMetadataObjec..., const ELocTextExportSourceMethod In..., const FLocItem& InSource, FLocItem& OutSource, FLocItem& OutTranslation ) Given some source text, work out which text should be exported (eg, when exporting to PO).
const TArray... GetForeignCultures ()  
TSharedPtr< ... GetLocFileNotifies ()  
const FStrin... GetNativeCulture ()  
ELocTextPlat... GetPlatformSplitMode () How are we splitting localization data per-platform?
const TArray... GetPlatformsToSplit () Get the platforms names that should be split, based on the active split mode.
void GetRuntimeText ( const FString& InCulture, const FLocKey& InNamespace, const FLocKey& InKey, const TSharedPtr< FLocMetadataObjec..., const ELocTextExportSourceMethod In..., const FLocItem& InSource, FLocItem& OutTranslation, const bool bSkipSourceCheck ) Given some source text, work out which text is our current "best" translation (eg, when compiling to LocRes).
const FStrin... GetTargetName ()  
const FStrin... GetTargetPath ()  
FLocTextWord... GetWordCountReport ( const FDateTime& InTimestamp, const TCHAR* InBaseReportFileP... ) Get a word count report for the current state of the manifest and archives.
bool HasArchive ( const FString& InCulture ) Check to see whether we've loaded the given archive (native or foreign).
bool HasForeignArchive ( const FString& InCulture ) Check to see whether we've loaded the given foreign archive.
bool HasManifest () Check to see whether we've loaded the manifest.
bool HasNativeArchive () Check to see whether we've loaded the native archive.
bool ImportTranslation ( const FString& InCulture, const FLocKey& InNamespace, const FLocKey& InKey, const TSharedPtr< FLocMetadataObjec..., const FLocItem& InSource, const FLocItem& InTranslation, const bool InOptional ) Import a previously exported translation (generated using GetExportText) back into the archive.
bool LoadAll ( const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) the manifest and all archive files specified during construction.
bool LoadAllArchives ( const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) all archive files.
bool LoadArchive ( const FString& InCulture, const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) an archive file (native or foreign).
bool LoadArchive ( const FString& InCulture, const FString& InArchiveFilePath, const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) an foreign file (native or foreign) from the given file path.
bool LoadForeignArchive ( const FString& InCulture, const FString& InArchiveFilePath, const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) a foreign archive file from the given file path.
bool LoadForeignArchive ( const FString& InCulture, const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) a foreign archive file.
bool LoadManifest ( const FString& InManifestFilePath, const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) the manifest file from the given file path.
bool LoadManifest ( const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) the manifest file.
bool LoadNativeArchive ( const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) the native archive file.
bool LoadNativeArchive ( const FString& InArchiveFilePath, const ELocTextHelperLoadFlags InLoa..., FText* OutError ) Attempt to load (or create) the native archive file from the given file path.
FString SanitizeLogOutput ( FStringView InString ) Sanitize any output from the given string that may cause the build machine to generate erroneous errors.
FString SanitizeLogOutput ( FString&& InString ) Sanitize any output from the given string that may cause the build machine to generate erroneous errors.
bool SaveAll ( FText* OutError ) Attempt to save the manifest and all archive files specified during construction.
bool SaveAllArchives ( FText* OutError ) Attempt to save all (native and foreign) archive files.
bool SaveArchive ( const FString& InCulture, FText* OutError ) Attempt to save an archive file (native or foreign).
bool SaveArchive ( const FString& InCulture, const FString& InArchiveFilePath, FText* OutError ) Attempt to save an archive file (native or foreign) to the given file path.
bool SaveConflictReport ( const FString& InReportFilePath, EConflictReportFormat InConflictRep..., FText* OutError ) Save the conflict report summary to disk.
bool SaveForeignArchive ( const FString& InCulture, const FString& InArchiveFilePath, FText* OutError ) Attempt to save a foreign archive file to the given file path.
bool SaveForeignArchive ( const FString& InCulture, FText* OutError ) Attempt to save a foreign archive file.
bool SaveManifest ( const FString& InManifestFilePath, FText* OutError ) Attempt to save the manifest file to the given file path.
bool SaveManifest ( FText* OutError ) Attempt to save the manifest file.
bool SaveNativeArchive ( FText* OutError ) Attempt to save the native archive file.
bool SaveNativeArchive ( const FString& InArchiveFilePath, FText* OutError ) Attempt to save the native archive file to the given file path.
bool SaveWordCountReport ( const FDateTime& InTimestamp, const FString& InReportFilePath, FText* OutError ) Save the word count report for the current state of the manifest and archives to disk.
bool SerializeManifestToJson ( TSharedRef< FJsonObject > JsonObjec... ) Attempt to serialize the entire manifest to an input json object
void SetCopyrightNotice ( const FString& InCopyrightNotice ) Set the optional copyright notice to insert into files that support it.
bool ShouldSplitPlatformData () Are we splitting localization data per-platform?
void TrimArchive ( const FString& InCulture ) Trim the given archive by remove any entries that no longer exist in the manifest.
void TrimManifest () Trim the currently loaded manifest by remove all dependency entries from it.
void UpdateSourceText ( const TSharedRef< FManifestEntry > ..., TSharedRef< FManifestEntry >& InNe... ) Update an existing source text entry in the manifest.
void UpdateTranslation ( const FString& InCulture, const TSharedRef< FArchiveEntry >&..., const TSharedRef< FArchiveEntry >&... ) Update an existing translation in the given archive.
bool UpdateTranslation ( const FString& InCulture, const FLocKey& InNamespace, const FLocKey& InKey, const TSharedPtr< FLocMetadataObjec..., const FLocItem& InSource, const FLocItem& InTranslation ) Update an existing translation in the given archive.

Typedefs

Name Description
FEnumerateSourceTextsFuncPtr Enumerate all the source texts in the manifest, optionally skipping those entries from a dependent manifest.
FEnumerateTranslationsFuncPtr Enumerate all the translations for the given culture.

Ask questions and help your peers Developer Forums

Write your own tutorials or read those from others Learning Library