FLocTextHelper

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

Windows
MacOS
Linux

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

Name Description

Public function

FLocTextHelper

(
    TSharedPtr< ILocFileNotifies > InLo...,
    const ELocTextPlatformSplitMode InP...
)

Construct an empty helper.

Public function

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

Name Description

Public function

void

 

AddConflict

(
    const FLocKey& InNamespace,
    const FLocKey& InKey,
    const TSharedPtr< FLocMetadataObjec...,
    const FLocItem& InSource,
    const FString& InSourceLocation
)

Add a new conflict entry.

Public function

bool

 

AddDependency

(
    const FString& InDependencyFilePat...,
    FText* OutError
)

Attempt to add a manifest dependency.

Public function

bool

 

AddSourceText

(
    const FLocKey& InNamespace,
    const FLocItem& InSource,
    const FManifestContext& InContext,
    const FString* InDescription
)

Add a new source text entry to the manifest.

Public function

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.

Public function

bool

 

AddTranslation

(
    const FString& InCulture,
    const TSharedRef< FArchiveEntry >&...
)

Add a new translation to the given archive.

Public function Const

void

 

EnumerateSourceTexts

(
    const FEnumerateSourceTextsFuncPtr ...,
    const bool InCheckDependencies
)

Public function Const

void

 

EnumerateTranslations

(
    const FString& InCulture,
    const FEnumerateTranslationsFuncPtr...,
    const bool InCheckDependencies
)

Public function Const

TSharedPtr< ...

 

FindDependencyEntry

(
    const FLocKey& InNamespace,
    const FLocKey& InKey,
    const FString* InSourceText,
    FString* OutDependencyFilePath
)

Find an dependency entry using its namespace and key.

Public function Const

TSharedPtr< ...

 

FindDependencyEntry

(
    const FLocKey& InNamespace,
    const FManifestContext& InContext,
    FString* OutDependencyFilePath
)

Find an existing dependency entry using its namespace and context.

Public function Static

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.

Public function Const

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.

Public function Const

TSharedPtr< ...

 

FindSourceText

(
    const FLocKey& InNamespace,
    const FLocKey& InKey,
    const FString* InSourceText
)

Find an existing source text entry using its namespace and key.

Public function Const

TSharedPtr< ...

 

FindSourceText

(
    const FLocKey& InNamespace,
    const FManifestContext& InContext
)

Find an existing source text entry using its namespace and context.

Public function Const

TSharedPtr< ...

 

FindTranslation

(
    const FString& InCulture,
    const FLocKey& InNamespace,
    const FLocKey& InKey,
    const TSharedPtr< FLocMetadataObjec...
)

Find an existing translation entry from its source text.

Public function Const

TArray< FStr...

 

GetAllCultures

(
    const bool bSingleCultureMode
)

Public function Const

FString

 

GetConflictReport()

Get a conflict report that can be easily saved as a report summary.

Public function Const

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).

Public function Const

const TArray...

 

GetForeignCultures()

Public function Const

TSharedPtr< ...

 

GetLocFileNotifies()

Public function Const

const FStrin...

 

GetNativeCulture()

Public function Const

ELocTextPlat...

 

GetPlatformSplitMode()

How are we splitting localization data per-platform?

Public function Const

const TArray...

 

GetPlatformsToSplit()

Get the platforms names that should be split, based on the active split mode.

Public function Const

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).

Public function Const

const FStrin...

 

GetTargetName()

Public function Const

const FStrin...

 

GetTargetPath()

Public function Const

FLocTextWord...

 

GetWordCountReport

(
    const FDateTime& InTimestamp,
    const TCHAR* InBaseReportFileP...
)

Get a word count report for the current state of the manifest and archives.

Public function Const

bool

 

HasArchive

(
    const FString& InCulture
)

Check to see whether we've loaded the given archive (native or foreign).

Public function Const

bool

 

HasForeignArchive

(
    const FString& InCulture
)

Check to see whether we've loaded the given foreign archive.

Public function Const

bool

 

HasManifest()

Check to see whether we've loaded the manifest.

Public function Const

bool

 

HasNativeArchive()

Check to see whether we've loaded the native archive.

Public function

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.

Public function

bool

 

LoadAll

(
    const ELocTextHelperLoadFlags InLoa...,
    FText* OutError
)

Attempt to load (or create) the manifest and all archive files specified during construction.

Public function

bool

 

LoadAllArchives

(
    const ELocTextHelperLoadFlags InLoa...,
    FText* OutError
)

Attempt to load (or create) all archive files.

Public function

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.

Public function

bool

 

LoadArchive

(
    const FString& InCulture,
    const ELocTextHelperLoadFlags InLoa...,
    FText* OutError
)

Attempt to load (or create) an archive file (native or foreign).

Public function

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.

Public function

bool

 

LoadForeignArchive

(
    const FString& InCulture,
    const ELocTextHelperLoadFlags InLoa...,
    FText* OutError
)

Attempt to load (or create) a foreign archive file.

Public function

bool

 

LoadManifest

(
    const ELocTextHelperLoadFlags InLoa...,
    FText* OutError
)

Attempt to load (or create) the manifest file.

Public function

bool

 

LoadManifest

(
    const FString& InManifestFilePath,
    const ELocTextHelperLoadFlags InLoa...,
    FText* OutError
)

Attempt to load (or create) the manifest file from the given file path.

Public function

bool

 

LoadNativeArchive

(
    const ELocTextHelperLoadFlags InLoa...,
    FText* OutError
)

Attempt to load (or create) the native archive file.

Public function

bool

 

LoadNativeArchive

(
    const FString& InArchiveFilePath,
    const ELocTextHelperLoadFlags InLoa...,
    FText* OutError
)

Attempt to load (or create) the native archive file from the given file path.

Public function Static

FString

 

SanitizeLogOutput

(
    const FString& InString
)

Sanitize any output from the given string that may cause the build machine to generate erroneous errors.

Public function Const

bool

 

SaveAll

(
    FText* OutError
)

Attempt to save the manifest and all archive files specified during construction.

Public function Const

bool

 

SaveAllArchives

(
    FText* OutError
)

Attempt to save all (native and foreign) archive files.

Public function Const

bool

 

SaveArchive

(
    const FString& InCulture,
    FText* OutError
)

Attempt to save an archive file (native or foreign).

Public function Const

bool

 

SaveArchive

(
    const FString& InCulture,
    const FString& InArchiveFilePath,
    FText* OutError
)

Attempt to save an archive file (native or foreign) to the given file path.

Public function Const

bool

 

SaveConflictReport

(
    const FString& InReportFilePath,
    FText* OutError
)

Save the conflict report summary to disk.

Public function Const

bool

 

SaveForeignArchive

(
    const FString& InCulture,
    FText* OutError
)

Attempt to save a foreign archive file.

Public function Const

bool

 

SaveForeignArchive

(
    const FString& InCulture,
    const FString& InArchiveFilePath,
    FText* OutError
)

Attempt to save a foreign archive file to the given file path.

Public function Const

bool

 

SaveManifest

(
    const FString& InManifestFilePath,
    FText* OutError
)

Attempt to save the manifest file to the given file path.

Public function Const

bool

 

SaveManifest

(
    FText* OutError
)

Attempt to save the manifest file.

Public function Const

bool

 

SaveNativeArchive

(
    FText* OutError
)

Attempt to save the native archive file.

Public function Const

bool

 

SaveNativeArchive

(
    const FString& InArchiveFilePath,
    FText* OutError
)

Attempt to save the native archive file to the given file path.

Public function Const

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.

Public function Const

bool

 

ShouldSplitPlatformData()

Are we splitting localization data per-platform?

Public function

void

 

TrimArchive

(
    const FString& InCulture
)

Trim the given archive by remove any entries that no longer exist in the manifest.

Public function

void

 

TrimManifest()

Trim the currently loaded manifest by remove all dependency entries from it.

Public function

void

 

UpdateSourceText

(
    const TSharedRef< FManifestEntry > ...,
    TSharedRef< FManifestEntry >& InNe...
)

Update an existing source text entry in the manifest.

Public function

void

 

UpdateTranslation

(
    const FString& InCulture,
    const TSharedRef< FArchiveEntry >&...,
    const TSharedRef< FArchiveEntry >&...
)

Update an existing translation in the given archive.

Public function

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.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss