You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
==========================
MAJOR FEATURES + CHANGES
==========================
#lockdown Nick.Penwarden
Change 2903938 on 2016/03/10 by Frank.Gigliotti
Added an instance ID to FAnimMontageInstance
#CodeReview Laurent.Delayen
#RB Laurent.Delayen
#Tests PIE
Change 2903745 on 2016/03/10 by Wes.Hunt
Update Oodle TPS
#rb none
#tests none
#codereview:john.pollard
Change 2903689 on 2016/03/10 by Uriel.Doyon
New "LogHeroMaterials" console command, displaying the current state of materials and textures on the character hero.
#rb marcus.wasmer
#codereview marcus.wassmer
#tests editor, playing PC games, trying the new command
Change 2903669 on 2016/03/10 by Aaron.McLeran
OR-17180 Make stat soundcues and stat soundwaves NOT display zero volume sounds
- Change only effects debug stat commands for audio guys
#rb none
#tests played paragon with new debug stat commands, confirms doesn't show zero-volume sounds
Change 2903625 on 2016/03/10 by John.Pollard
XB1 Oodle SDK
#rb none
#tests none
#codereview Jeff.Campeau
Change 2903577 on 2016/03/10 by Ben.Marsh
Remaking latest build scripts from //UE4/Main @ 2900980.
Change 2903560 on 2016/03/10 by Ben.Marsh
Initial version of BuildGraph scripts - used to create build processes in UE4 which can be run locally or in parallel across a build farm (assuming synchronization and resource allocation implemented by a separate system). Intended to supersede GUBP.
Build graphs are declared using an XML script using syntax similar to MSBuild, ANT or NAnt, and consist of the following components:
* Tasks: Building blocks which can be executed as part of the build process. Many predefined tasks are provided (<Cook>, <Compile>, <Copy>, <Stage>, <Log>, <PakFile>, etc...), and additional tasks may be added be declaring classes derived from AutomationTool.CustomTask in other UAT modules.
* Nodes: A named sequence of tasks which is executed to produce outputs. Nodes may have input dependencies on other nodes before they can be executed. Declared with the <Node> element in scripts.
* Agent Groups: A set of nodes nodes which is executed on the same machine if running as part of a build system. Has no effect when building locally. Declared with the <Group> element in scripts.
* Triggers: Container for groups which should only be executed when explicitly triggered (using the -Trigger=<Name> or -SkipTriggers command line argument). Declared with the <Trigger> element in scripts.
* Notifiers: Specifies email recipients for failures in one or more nodes, whether they should receive notifications on warnings, and so on.
Properties can be passed in to a script on the command line, or set procedurally with the <Property Name="Foo" Value="Bar"/> syntax. Properties referenced with the $(Property Name) notation are valid within all strings, and will be expanded as macros when the script is read. If a property name is not set explicitly, it defaults to the contents of an environment variable with the same name.
Local properties, which only affect the scope of the containing XML element (node, group, etc...) are declared with the <Local Name="Foo" Value="Bar"/> element, and will override a similarly named global property for the local property's scope.
Any elements can be conditionally defined via the "If" attribute, and are largely identical to MSBuild conditions. Literals in conditions may be quoted with single (') or double (") quotes, or an unquoted sequence of letters, digits and underscore characters. All literals are considered identical regardless of how they are declared, and are considered case-insensitive for comparisons (so true equals 'True', equals "TRUE"). Available operators are "==", "!=", "And", "Or", "!", "(...)", "Exists(...)" and "HasTrailingSlash(...)". A full grammar is written up in Condition.cs.
File manipulation is done using wildcards and tags. Any attribute that accepts a list of files may consist of: a Perforce-style wildcard (matching any number of "...", "*" and "?" patterns in any location), a full path name, or a reference to a tagged collection of files, denoted by prefixing with a '#' character. Files may be added to a tag set using the <Tag> Task, which also allows performing set union/difference style operations. Each node can declare multiple outputs in the form of a list of named tags, which other nodes can then depend on.
Build graphs may be executed in parallel as part build system. To do so, the initial graph configuration is generated by running with the -Export=<Filename> argument (producing a JSON file listing the nodes and dependencies to execute). Each participating agent should be synced to the same changelist, and UAT should be re-run with the appropriate -Node=<Name> argument. Outputs from different nodes are transferred between agents via shared storage, typically a network share, the path to which can be specified on the command line using the -SharedStorageDir=<Path> argument. Note that the allocation of machines, and coordination between them, is assumed to be managed by an external system.
A schema for the known set of tasks can be generated by running UAT with the "-Schema=<FileName>" option. Generating a schema and referencing it from a BuildGraph script allows Visual Studio to validate and auto-complete elements as you type.
#rb none
#codereview Marc.Audy, Wes.Hunt, Matthew.Griffin, Richard.Fawcett
#tests local only so far, but not part of any build process yet
Change 2903539 on 2016/03/10 by John.Pollard
Improve replay playback debugging of character movement
#rb none
#tests replays
Change 2903526 on 2016/03/10 by Ben.Marsh
Remake changes from //UE4/Main without integration history, to add support for BuildGraph tasks.
#rb none
#tests none
Change 2903512 on 2016/03/10 by Dan.Youhon
Modify minimum Duration values for JumpForce and MoveToForce ability tasks so that having minimum Duration values doesn't trigger check()s
#rb None
#tests Compiles
Change 2903474 on 2016/03/10 by Marc.Audy
Fix crash if ChildActor is null
#rb None
#tests None
Change 2903314 on 2016/03/10 by Marc.Audy
Fix ParentComponent not being persisted and fixup content that was saved in the window it was broken
#rb James.Golding
#tests Selection of child actors works as expected
#jira UE-28201
Change 2903298 on 2016/03/10 by Simon.Tovey
Disabling the trails optimization.
#tests none
#rb none
#codereview Olaf.Piesche
Change 2903124 on 2016/03/10 by Robert.Manuszewski
Small refactor to pak signing to help with exe protection
#rb none
#tests none
[CL 2907678 by Andrew Grant in Main branch]
1028 lines
37 KiB
C++
1028 lines
37 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "LocalizationPrivatePCH.h"
|
|
#include "LocalizationConfigurationScript.h"
|
|
#include "LocalizationTargetTypes.h"
|
|
#include "LocalizationSettings.h"
|
|
|
|
namespace
|
|
{
|
|
FString GetConfigDir(const ULocalizationTarget* const Target)
|
|
{
|
|
return Target->IsMemberOfEngineTargetSet() ? FPaths::EngineConfigDir() : FPaths::GameConfigDir();
|
|
}
|
|
|
|
FString GetContentDir(const ULocalizationTarget* const Target)
|
|
{
|
|
return Target->IsMemberOfEngineTargetSet() ? FPaths::EngineContentDir() : FPaths::GameContentDir();
|
|
}
|
|
}
|
|
|
|
namespace LocalizationConfigurationScript
|
|
{
|
|
FString MakePathRelativeForCommandletProcess(const FString& Path, const bool IsUsingProjectFile)
|
|
{
|
|
FString Result = Path;
|
|
const FString ProjectDir = !IsUsingProjectFile ? FPaths::EngineDir() : FPaths::GameDir();
|
|
if (!FPaths::MakePathRelativeTo(Result, *ProjectDir))
|
|
{
|
|
Result = FPaths::ConvertRelativePathToFull(Path);
|
|
}
|
|
return Result;
|
|
}
|
|
|
|
FString GetConfigDirectory(const ULocalizationTarget* const Target)
|
|
{
|
|
return GetConfigDir(Target) / TEXT("Localization");
|
|
}
|
|
|
|
FString GetDataDirectory(const ULocalizationTarget* const Target)
|
|
{
|
|
return GetContentDir(Target) / TEXT("Localization") / Target->Settings.Name;
|
|
}
|
|
|
|
TArray<FString> GetConfigPaths(const ULocalizationTarget* const Target)
|
|
{
|
|
TArray<FString> Result;
|
|
Result.Add(GetGatherTextConfigPath(Target));
|
|
Result.Add(GetImportTextConfigPath(Target));
|
|
Result.Add(GetExportTextConfigPath(Target));
|
|
Result.Add(GetImportDialogueScriptConfigPath(Target));
|
|
Result.Add(GetExportDialogueScriptConfigPath(Target));
|
|
Result.Add(GetImportDialogueConfigPath(Target));
|
|
Result.Add(GetWordCountReportConfigPath(Target));
|
|
return Result;
|
|
}
|
|
|
|
void GenerateAllConfigFiles(const ULocalizationTarget* const Target)
|
|
{
|
|
GenerateGatherTextConfigFile(Target).Write(GetGatherTextConfigPath(Target));
|
|
GenerateImportTextConfigFile(Target).Write(GetImportTextConfigPath(Target));
|
|
GenerateExportTextConfigFile(Target).Write(GetExportTextConfigPath(Target));
|
|
GenerateImportDialogueScriptConfigFile(Target).Write(GetImportDialogueScriptConfigPath(Target));
|
|
GenerateExportDialogueScriptConfigFile(Target).Write(GetExportDialogueScriptConfigPath(Target));
|
|
GenerateImportDialogueConfigFile(Target).Write(GetImportDialogueConfigPath(Target));
|
|
GenerateWordCountReportConfigFile(Target).Write(GetWordCountReportConfigPath(Target));
|
|
}
|
|
|
|
TArray<FString> GetOutputFilePaths(const ULocalizationTarget* const Target)
|
|
{
|
|
TArray<FString> Result;
|
|
|
|
// Culture agnostic paths
|
|
Result.Add(GetManifestPath(Target));
|
|
Result.Add(GetWordCountCSVPath(Target));
|
|
Result.Add(GetConflictReportPath(Target));
|
|
Result.Add(GetDataDirectory(Target));
|
|
|
|
// Culture specific paths
|
|
for (const FCultureStatistics& Culture : Target->Settings.SupportedCulturesStatistics)
|
|
{
|
|
Result.Add(GetArchivePath(Target, Culture.CultureName));
|
|
Result.Add(GetDefaultPOPath(Target, Culture.CultureName));
|
|
Result.Add(GetDefaultDialogueScriptPath(Target, Culture.CultureName));
|
|
Result.Add(GetLocResPath(Target, Culture.CultureName));
|
|
}
|
|
|
|
return Result;
|
|
}
|
|
|
|
FString GetManifestFileName(const ULocalizationTarget* const Target)
|
|
{
|
|
return FString::Printf(TEXT("%s.manifest"), *Target->Settings.Name);
|
|
}
|
|
|
|
FString GetManifestPath(const ULocalizationTarget* const Target)
|
|
{
|
|
return GetDataDirectory(Target) / GetManifestFileName(Target);
|
|
}
|
|
|
|
FString GetArchiveFileName(const ULocalizationTarget* const Target)
|
|
{
|
|
return FString::Printf(TEXT("%s.archive"), *Target->Settings.Name);
|
|
}
|
|
|
|
FString GetArchivePath(const ULocalizationTarget* const Target, const FString& CultureName)
|
|
{
|
|
return GetDataDirectory(Target) / CultureName / GetArchiveFileName(Target);
|
|
}
|
|
|
|
FString GetDefaultPOFileName(const ULocalizationTarget* const Target)
|
|
{
|
|
return FString::Printf(TEXT("%s.po"), *Target->Settings.Name);
|
|
}
|
|
|
|
FString GetDefaultPOPath(const ULocalizationTarget* const Target, const FString& CultureName)
|
|
{
|
|
return GetDataDirectory(Target) / CultureName / GetDefaultPOFileName(Target);
|
|
}
|
|
|
|
FString GetDefaultDialogueScriptFileName(const ULocalizationTarget* const Target)
|
|
{
|
|
return FString::Printf(TEXT("%sDialogue.csv"), *Target->Settings.Name);
|
|
}
|
|
|
|
FString GetDefaultDialogueScriptPath(const ULocalizationTarget* const Target, const FString& CultureName)
|
|
{
|
|
return GetDataDirectory(Target) / CultureName / GetDefaultDialogueScriptFileName(Target);
|
|
}
|
|
|
|
FString GetLocResFileName(const ULocalizationTarget* const Target)
|
|
{
|
|
return FString::Printf(TEXT("%s.locres"), *Target->Settings.Name);
|
|
}
|
|
|
|
FString GetLocResPath(const ULocalizationTarget* const Target, const FString& CultureName)
|
|
{
|
|
return GetDataDirectory(Target) / CultureName / GetLocResFileName(Target);
|
|
}
|
|
|
|
FString GetWordCountCSVFileName(const ULocalizationTarget* const Target)
|
|
{
|
|
return FString::Printf(TEXT("%s.csv"), *Target->Settings.Name);
|
|
}
|
|
|
|
FString GetWordCountCSVPath(const ULocalizationTarget* const Target)
|
|
{
|
|
return GetDataDirectory(Target) / GetWordCountCSVFileName(Target);
|
|
}
|
|
|
|
FString GetConflictReportFileName(const ULocalizationTarget* const Target)
|
|
{
|
|
return FString::Printf(TEXT("%s_Conflicts.txt"), *Target->Settings.Name);
|
|
}
|
|
|
|
FString GetConflictReportPath(const ULocalizationTarget* const Target)
|
|
{
|
|
return GetDataDirectory(Target) / GetConflictReportFileName(Target);
|
|
}
|
|
|
|
FLocalizationConfigurationScript GenerateGatherTextConfigFile(const ULocalizationTarget* const Target)
|
|
{
|
|
FLocalizationConfigurationScript Script;
|
|
|
|
const FString ConfigDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetConfigDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
const FString ContentDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetContentDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
|
|
// CommonSettings
|
|
{
|
|
FConfigSection& ConfigSection = Script.CommonSettings();
|
|
|
|
const ULocalizationTargetSet* const LocalizationTargetSet = GetDefault<ULocalizationTargetSet>(ULocalizationTargetSet::StaticClass());
|
|
for (const FGuid& TargetDependencyGuid : Target->Settings.TargetDependencies)
|
|
{
|
|
TArray<ULocalizationTarget*> AllLocalizationTargets;
|
|
ULocalizationTargetSet* EngineTargetSet = ULocalizationSettings::GetEngineTargetSet();
|
|
if (EngineTargetSet != LocalizationTargetSet)
|
|
{
|
|
AllLocalizationTargets.Append(EngineTargetSet->TargetObjects);
|
|
}
|
|
AllLocalizationTargets.Append(LocalizationTargetSet->TargetObjects);
|
|
|
|
ULocalizationTarget* const * OtherTarget = AllLocalizationTargets.FindByPredicate([&TargetDependencyGuid](ULocalizationTarget* const InOtherTarget)->bool{return InOtherTarget->Settings.Guid == TargetDependencyGuid;});
|
|
if (OtherTarget)
|
|
{
|
|
ConfigSection.Add( TEXT("ManifestDependencies"), MakePathRelativeForCommandletProcess(GetManifestPath(*OtherTarget), !Target->IsMemberOfEngineTargetSet()) );
|
|
}
|
|
}
|
|
|
|
for (const FFilePath& Path : Target->Settings.AdditionalManifestDependencies)
|
|
{
|
|
ConfigSection.Add( TEXT("ManifestDependencies"), MakePathRelativeForCommandletProcess(Path.FilePath, !Target->IsMemberOfEngineTargetSet()) );
|
|
}
|
|
|
|
for (const FString& ModuleName : Target->Settings.RequiredModuleNames)
|
|
{
|
|
ConfigSection.Add( TEXT("ModulesToPreload"), ModuleName );
|
|
}
|
|
|
|
const FString SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add( TEXT("SourcePath"), SourcePath );
|
|
const FString DestinationPath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add( TEXT("DestinationPath"), DestinationPath );
|
|
|
|
ConfigSection.Add( TEXT("ManifestName"), GetManifestFileName(Target) );
|
|
ConfigSection.Add( TEXT("ArchiveName"), GetArchiveFileName(Target) );
|
|
|
|
if (Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex))
|
|
{
|
|
ConfigSection.Add( TEXT("NativeCulture"), Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName );
|
|
}
|
|
for (const FCultureStatistics& CultureStatistics : Target->Settings.SupportedCulturesStatistics)
|
|
{
|
|
ConfigSection.Add( TEXT("CulturesToGenerate"), CultureStatistics.CultureName );
|
|
}
|
|
}
|
|
|
|
uint32 GatherTextStepIndex = 0;
|
|
// GatherTextFromSource
|
|
if (Target->Settings.GatherFromTextFiles.IsEnabled)
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(GatherTextStepIndex++);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("GatherTextFromSource") );
|
|
|
|
// Include Paths
|
|
for (const auto& IncludePath : Target->Settings.GatherFromTextFiles.SearchDirectories)
|
|
{
|
|
ConfigSection.Add( TEXT("SearchDirectoryPaths"), IncludePath.Path );
|
|
}
|
|
|
|
// Exclude Paths
|
|
ConfigSection.Add( TEXT("ExcludePathFilters"), TEXT("Config/Localization/*") );
|
|
for (const auto& ExcludePath : Target->Settings.GatherFromTextFiles.ExcludePathWildcards)
|
|
{
|
|
ConfigSection.Add( TEXT("ExcludePathFilters"), ExcludePath.Pattern );
|
|
}
|
|
|
|
// Source File Search Filters
|
|
for (const auto& FileExtension : Target->Settings.GatherFromTextFiles.FileExtensions)
|
|
{
|
|
ConfigSection.Add( TEXT("FileNameFilters"), FString::Printf( TEXT("*.%s"), *FileExtension.Pattern) );
|
|
}
|
|
|
|
ConfigSection.Add( TEXT("ShouldGatherFromEditorOnlyData"), Target->Settings.GatherFromTextFiles.ShouldGatherFromEditorOnlyData ? TEXT("true") : TEXT("false") );
|
|
}
|
|
|
|
// GatherTextFromAssets
|
|
if (Target->Settings.GatherFromPackages.IsEnabled)
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(GatherTextStepIndex++);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("GatherTextFromAssets") );
|
|
|
|
// Include Paths
|
|
for (const auto& IncludePath : Target->Settings.GatherFromPackages.IncludePathWildcards)
|
|
{
|
|
ConfigSection.Add( TEXT("IncludePathFilters"), IncludePath.Pattern );
|
|
}
|
|
|
|
// Exclude Paths
|
|
ConfigSection.Add( TEXT("ExcludePathFilters"), TEXT("Content/Localization/*") );
|
|
for (const auto& ExcludePath : Target->Settings.GatherFromPackages.ExcludePathWildcards)
|
|
{
|
|
ConfigSection.Add( TEXT("ExcludePathFilters"), ExcludePath.Pattern );
|
|
}
|
|
|
|
// Package Extensions
|
|
for (const auto& FileExtension : Target->Settings.GatherFromPackages.FileExtensions)
|
|
{
|
|
ConfigSection.Add( TEXT("PackageFileNameFilters"), FString::Printf( TEXT("*.%s"), *FileExtension.Pattern) );
|
|
}
|
|
|
|
ConfigSection.Add( TEXT("ShouldGatherFromEditorOnlyData"), Target->Settings.GatherFromPackages.ShouldGatherFromEditorOnlyData ? TEXT("true") : TEXT("false") );
|
|
ConfigSection.Add( TEXT("SkipGatherCache"), Target->Settings.GatherFromPackages.SkipGatherCache ? TEXT("true") : TEXT("false") );
|
|
}
|
|
|
|
// GatherTextFromMetadata
|
|
if (Target->Settings.GatherFromMetaData.IsEnabled)
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(GatherTextStepIndex++);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("GatherTextFromMetadata") );
|
|
|
|
// Include Paths
|
|
for (const auto& IncludePath : Target->Settings.GatherFromMetaData.IncludePathWildcards)
|
|
{
|
|
ConfigSection.Add( TEXT("IncludePathFilters"), IncludePath.Pattern );
|
|
}
|
|
|
|
// Exclude Paths
|
|
for (const auto& ExcludePath : Target->Settings.GatherFromMetaData.ExcludePathWildcards)
|
|
{
|
|
ConfigSection.Add( TEXT("ExcludePathFilters"), ExcludePath.Pattern );
|
|
}
|
|
|
|
// Package Extensions
|
|
for (const FMetaDataKeyGatherSpecification& Specification : Target->Settings.GatherFromMetaData.KeySpecifications)
|
|
{
|
|
ConfigSection.Add( TEXT("InputKeys"), Specification.MetaDataKey.Name );
|
|
ConfigSection.Add( TEXT("OutputNamespaces"), Specification.TextNamespace );
|
|
ConfigSection.Add( TEXT("OutputKeys"), FString::Printf(TEXT("\"%s\""), *Specification.TextKeyPattern.Pattern) );
|
|
}
|
|
|
|
ConfigSection.Add( TEXT("ShouldGatherFromEditorOnlyData"), Target->Settings.GatherFromMetaData.ShouldGatherFromEditorOnlyData ? TEXT("true") : TEXT("false") );
|
|
}
|
|
|
|
// GenerateGatherManifest
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(GatherTextStepIndex++);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("GenerateGatherManifest") );
|
|
}
|
|
|
|
// GenerateGatherArchive
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(GatherTextStepIndex++);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("GenerateGatherArchive") );
|
|
}
|
|
|
|
// GenerateTextLocalizationReport
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(GatherTextStepIndex++);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("GenerateTextLocalizationReport") );
|
|
|
|
ConfigSection.Add( TEXT("bWordCountReport"), TEXT("true") );
|
|
ConfigSection.Add( TEXT("WordCountReportName"), GetWordCountCSVFileName(Target) );
|
|
|
|
ConfigSection.Add( TEXT("bConflictReport"), TEXT("true") );
|
|
ConfigSection.Add( TEXT("ConflictReportName"), GetConflictReportFileName(Target) );
|
|
}
|
|
|
|
Script.Dirty = true;
|
|
|
|
return Script;
|
|
}
|
|
|
|
FString GetGatherTextConfigPath(const ULocalizationTarget* const Target)
|
|
{
|
|
return GetConfigDirectory(Target) / FString::Printf(TEXT("%s_Gather.ini"), *(Target->Settings.Name));
|
|
}
|
|
|
|
FLocalizationConfigurationScript GenerateImportTextConfigFile(const ULocalizationTarget* const Target, const TOptional<FString> CultureName, const TOptional<FString> ImportPathOverride)
|
|
{
|
|
FLocalizationConfigurationScript Script;
|
|
|
|
const FString ContentDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetContentDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
|
|
// CommonSettings
|
|
{
|
|
FConfigSection& ConfigSection = Script.CommonSettings();
|
|
|
|
FString SourcePath;
|
|
// Overriding output path changes the source directory for the PO file.
|
|
if (ImportPathOverride.IsSet())
|
|
{
|
|
// The output path for a specific culture is a file path.
|
|
if (CultureName.IsSet())
|
|
{
|
|
SourcePath = MakePathRelativeForCommandletProcess( FPaths::GetPath(ImportPathOverride.GetValue()), !Target->IsMemberOfEngineTargetSet() );
|
|
}
|
|
// Otherwise, it is a directory path.
|
|
else
|
|
{
|
|
SourcePath = MakePathRelativeForCommandletProcess( ImportPathOverride.GetValue(), !Target->IsMemberOfEngineTargetSet() );
|
|
}
|
|
}
|
|
// Use the default PO file's directory path.
|
|
else
|
|
{
|
|
SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
}
|
|
ConfigSection.Add( TEXT("SourcePath"), SourcePath );
|
|
|
|
const FString DestinationPath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add( TEXT("DestinationPath"), DestinationPath );
|
|
|
|
if (Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex))
|
|
{
|
|
ConfigSection.Add( TEXT("NativeCulture"), Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName );
|
|
}
|
|
|
|
const auto& AddCultureToGenerate = [&](const int32 Index)
|
|
{
|
|
ConfigSection.Add( TEXT("CulturesToGenerate"), Target->Settings.SupportedCulturesStatistics[Index].CultureName );
|
|
};
|
|
|
|
// Import for a specific culture.
|
|
if (CultureName.IsSet())
|
|
{
|
|
ConfigSection.Add( TEXT("CulturesToGenerate"), CultureName.GetValue() );
|
|
}
|
|
// Import for all cultures.
|
|
else
|
|
{
|
|
for (const FCultureStatistics& CultureStatistics : Target->Settings.SupportedCulturesStatistics)
|
|
{
|
|
ConfigSection.Add( TEXT("CulturesToGenerate"), CultureStatistics.CultureName );
|
|
}
|
|
}
|
|
|
|
// Do not use culture subdirectories if importing a single culture from a specific directory.
|
|
if (CultureName.IsSet() && ImportPathOverride.IsSet())
|
|
{
|
|
ConfigSection.Add( TEXT("bUseCultureDirectory"), "false" );
|
|
}
|
|
|
|
ConfigSection.Add( TEXT("ManifestName"), GetManifestFileName(Target) );
|
|
ConfigSection.Add( TEXT("ArchiveName"), GetArchiveFileName(Target) );
|
|
|
|
FString POFileName;
|
|
// The import path for a specific culture is a file path.
|
|
if (CultureName.IsSet() && ImportPathOverride.IsSet())
|
|
{
|
|
POFileName = FPaths::GetCleanFilename( ImportPathOverride.GetValue() );
|
|
}
|
|
// Use the default PO file's name.
|
|
else
|
|
{
|
|
POFileName = GetDefaultPOFileName( Target );
|
|
}
|
|
ConfigSection.Add( TEXT("PortableObjectName"), POFileName );
|
|
}
|
|
|
|
// GatherTextStep0 - InternationalizationExport
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(0);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("InternationalizationExport") );
|
|
|
|
ConfigSection.Add( TEXT("bImportLoc"), TEXT("true") );
|
|
}
|
|
|
|
Script.Dirty = true;
|
|
|
|
return Script;
|
|
}
|
|
|
|
FString GetImportTextConfigPath(const ULocalizationTarget* const Target, const TOptional<FString> CultureName)
|
|
{
|
|
const FString ConfigFileDirectory = GetConfigDirectory(Target);
|
|
FString ConfigFilePath;
|
|
if (CultureName.IsSet())
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf( TEXT("%s_Import_%s.ini"), *Target->Settings.Name, *CultureName.GetValue() );
|
|
}
|
|
else
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf( TEXT("%s_Import.ini"), *Target->Settings.Name );
|
|
}
|
|
return ConfigFilePath;
|
|
}
|
|
|
|
FLocalizationConfigurationScript GenerateExportTextConfigFile(const ULocalizationTarget* const Target, const TOptional<FString> CultureName, const TOptional<FString> ExportPathOverride)
|
|
{
|
|
FLocalizationConfigurationScript Script;
|
|
|
|
const FString ContentDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetContentDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
|
|
// CommonSettings
|
|
{
|
|
FConfigSection& ConfigSection = Script.CommonSettings();
|
|
|
|
const FString SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add( TEXT("SourcePath"), SourcePath );
|
|
|
|
FString DestinationPath;
|
|
// Overriding export path changes the destination directory for the PO file.
|
|
if (ExportPathOverride.IsSet())
|
|
{
|
|
// The output path for a specific culture is a file path.
|
|
if (CultureName.IsSet())
|
|
{
|
|
DestinationPath = MakePathRelativeForCommandletProcess( FPaths::GetPath(ExportPathOverride.GetValue()), !Target->IsMemberOfEngineTargetSet() );
|
|
}
|
|
// Otherwise, it is a directory path.
|
|
else
|
|
{
|
|
DestinationPath = MakePathRelativeForCommandletProcess( ExportPathOverride.GetValue(), !Target->IsMemberOfEngineTargetSet() );
|
|
}
|
|
}
|
|
// Use the default PO file's directory path.
|
|
else
|
|
{
|
|
DestinationPath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
}
|
|
ConfigSection.Add( TEXT("DestinationPath"), DestinationPath );
|
|
|
|
if (Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex))
|
|
{
|
|
ConfigSection.Add( TEXT("NativeCulture"), Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName );
|
|
}
|
|
|
|
const auto& AddCultureToGenerate = [&](const int32 Index)
|
|
{
|
|
ConfigSection.Add( TEXT("CulturesToGenerate"), Target->Settings.SupportedCulturesStatistics[Index].CultureName );
|
|
};
|
|
|
|
// Export for a specific culture.
|
|
if (CultureName.IsSet())
|
|
{
|
|
const int32 CultureIndex = Target->Settings.SupportedCulturesStatistics.IndexOfByPredicate([CultureName](const FCultureStatistics& Culture) { return Culture.CultureName == CultureName.GetValue(); });
|
|
AddCultureToGenerate(CultureIndex);
|
|
}
|
|
// Export for all cultures.
|
|
else
|
|
{
|
|
for (int32 CultureIndex = 0; CultureIndex < Target->Settings.SupportedCulturesStatistics.Num(); ++CultureIndex)
|
|
{
|
|
AddCultureToGenerate(CultureIndex);
|
|
}
|
|
}
|
|
|
|
// Do not use culture subdirectories if exporting a single culture to a specific directory.
|
|
if (CultureName.IsSet() && ExportPathOverride.IsSet())
|
|
{
|
|
ConfigSection.Add( TEXT("bUseCultureDirectory"), "false" );
|
|
}
|
|
|
|
ConfigSection.Add( TEXT("ManifestName"), GetManifestFileName(Target) );
|
|
ConfigSection.Add( TEXT("ArchiveName"), GetArchiveFileName(Target) );
|
|
|
|
FString POFileName;
|
|
// The export path for a specific culture is a file path.
|
|
if (CultureName.IsSet() && ExportPathOverride.IsSet())
|
|
{
|
|
POFileName = FPaths::GetCleanFilename( ExportPathOverride.GetValue() );
|
|
}
|
|
// Use the default PO file's name.
|
|
else
|
|
{
|
|
POFileName = GetDefaultPOFileName(Target);
|
|
}
|
|
ConfigSection.Add( TEXT("PortableObjectName"), POFileName );
|
|
}
|
|
|
|
// GatherTextStep0 - InternationalizationExport
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(0);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("InternationalizationExport") );
|
|
|
|
ConfigSection.Add(TEXT("bExportLoc"), TEXT("true"));
|
|
|
|
// Export-specific settings.
|
|
{
|
|
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.Dirty = true;
|
|
|
|
return Script;
|
|
}
|
|
|
|
FString GetExportTextConfigPath(const ULocalizationTarget* const Target, const TOptional<FString> CultureName)
|
|
{
|
|
const FString ConfigFileDirectory = GetConfigDirectory(Target);
|
|
FString ConfigFilePath;
|
|
if (CultureName.IsSet())
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf( TEXT("%s_Export_%s.ini"), *Target->Settings.Name, *CultureName.GetValue() );
|
|
}
|
|
else
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf( TEXT("%s_Export.ini"), *Target->Settings.Name );
|
|
}
|
|
return ConfigFilePath;
|
|
}
|
|
|
|
FLocalizationConfigurationScript GenerateImportDialogueScriptConfigFile(const ULocalizationTarget* const Target, const TOptional<FString> CultureName, const TOptional<FString> ImportPathOverride)
|
|
{
|
|
FLocalizationConfigurationScript Script;
|
|
|
|
const FString ContentDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetContentDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
|
|
// CommonSettings
|
|
{
|
|
FConfigSection& ConfigSection = Script.CommonSettings();
|
|
|
|
FString SourcePath;
|
|
// Overriding import path changes the source directory for the dialogue script file.
|
|
if (ImportPathOverride.IsSet())
|
|
{
|
|
// The output path for a specific culture is a file path.
|
|
if (CultureName.IsSet())
|
|
{
|
|
SourcePath = MakePathRelativeForCommandletProcess(FPaths::GetPath(ImportPathOverride.GetValue()), !Target->IsMemberOfEngineTargetSet());
|
|
}
|
|
// Otherwise, it is a directory path.
|
|
else
|
|
{
|
|
SourcePath = MakePathRelativeForCommandletProcess(ImportPathOverride.GetValue(), !Target->IsMemberOfEngineTargetSet());
|
|
}
|
|
}
|
|
// Use the default dialogue script file's directory path.
|
|
else
|
|
{
|
|
SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
}
|
|
ConfigSection.Add(TEXT("SourcePath"), SourcePath);
|
|
|
|
const FString DestinationPath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add(TEXT("DestinationPath"), DestinationPath);
|
|
|
|
if (Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex))
|
|
{
|
|
ConfigSection.Add(TEXT("NativeCulture"), Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName);
|
|
}
|
|
|
|
const auto& AddCultureToGenerate = [&](const int32 Index)
|
|
{
|
|
ConfigSection.Add(TEXT("CulturesToGenerate"), Target->Settings.SupportedCulturesStatistics[Index].CultureName);
|
|
};
|
|
|
|
// Import for a specific culture.
|
|
if (CultureName.IsSet())
|
|
{
|
|
ConfigSection.Add(TEXT("CulturesToGenerate"), CultureName.GetValue());
|
|
}
|
|
// Import for all cultures.
|
|
else
|
|
{
|
|
for (const FCultureStatistics& CultureStatistics : Target->Settings.SupportedCulturesStatistics)
|
|
{
|
|
ConfigSection.Add(TEXT("CulturesToGenerate"), CultureStatistics.CultureName);
|
|
}
|
|
}
|
|
|
|
// Do not use culture subdirectories if importing a single culture from a specific directory.
|
|
if (CultureName.IsSet() && ImportPathOverride.IsSet())
|
|
{
|
|
ConfigSection.Add(TEXT("bUseCultureDirectory"), "false");
|
|
}
|
|
|
|
ConfigSection.Add(TEXT("ManifestName"), GetManifestFileName(Target));
|
|
ConfigSection.Add(TEXT("ArchiveName"), GetArchiveFileName(Target));
|
|
|
|
FString DialogueScriptFileName;
|
|
// The import path for a specific culture is a file path.
|
|
if (CultureName.IsSet() && ImportPathOverride.IsSet())
|
|
{
|
|
DialogueScriptFileName = FPaths::GetCleanFilename(ImportPathOverride.GetValue());
|
|
}
|
|
// Use the default PO file's name.
|
|
else
|
|
{
|
|
DialogueScriptFileName = GetDefaultDialogueScriptFileName(Target);
|
|
}
|
|
ConfigSection.Add(TEXT("DialogueScriptName"), DialogueScriptFileName);
|
|
}
|
|
|
|
// GatherTextStep0 - ImportDialogueScript
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(0);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add(TEXT("CommandletClass"), TEXT("ImportDialogueScript"));
|
|
}
|
|
|
|
Script.Dirty = true;
|
|
|
|
return Script;
|
|
}
|
|
|
|
FString GetImportDialogueScriptConfigPath(const ULocalizationTarget* const Target, const TOptional<FString> CultureName)
|
|
{
|
|
const FString ConfigFileDirectory = GetConfigDirectory(Target);
|
|
FString ConfigFilePath;
|
|
if (CultureName.IsSet())
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf(TEXT("%s_ImportDialogueScript_%s.ini"), *Target->Settings.Name, *CultureName.GetValue());
|
|
}
|
|
else
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf(TEXT("%s_ImportDialogueScript.ini"), *Target->Settings.Name);
|
|
}
|
|
return ConfigFilePath;
|
|
}
|
|
|
|
FLocalizationConfigurationScript GenerateExportDialogueScriptConfigFile(const ULocalizationTarget* const Target, const TOptional<FString> CultureName, const TOptional<FString> ExportPathOverride)
|
|
{
|
|
FLocalizationConfigurationScript Script;
|
|
|
|
const FString ContentDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetContentDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
|
|
// CommonSettings
|
|
{
|
|
FConfigSection& ConfigSection = Script.CommonSettings();
|
|
|
|
const FString SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add(TEXT("SourcePath"), SourcePath);
|
|
|
|
FString DestinationPath;
|
|
// Overriding export path changes the destination directory for the dialogue script file.
|
|
if (ExportPathOverride.IsSet())
|
|
{
|
|
// The output path for a specific culture is a file path.
|
|
if (CultureName.IsSet())
|
|
{
|
|
DestinationPath = MakePathRelativeForCommandletProcess(FPaths::GetPath(ExportPathOverride.GetValue()), !Target->IsMemberOfEngineTargetSet());
|
|
}
|
|
// Otherwise, it is a directory path.
|
|
else
|
|
{
|
|
DestinationPath = MakePathRelativeForCommandletProcess(ExportPathOverride.GetValue(), !Target->IsMemberOfEngineTargetSet());
|
|
}
|
|
}
|
|
// Use the default dialogue script file's directory path.
|
|
else
|
|
{
|
|
DestinationPath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
}
|
|
ConfigSection.Add(TEXT("DestinationPath"), DestinationPath);
|
|
|
|
if (Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex))
|
|
{
|
|
ConfigSection.Add(TEXT("NativeCulture"), Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName);
|
|
}
|
|
|
|
const auto& AddCultureToGenerate = [&](const int32 Index)
|
|
{
|
|
ConfigSection.Add(TEXT("CulturesToGenerate"), Target->Settings.SupportedCulturesStatistics[Index].CultureName);
|
|
};
|
|
|
|
// Export for a specific culture.
|
|
if (CultureName.IsSet())
|
|
{
|
|
const int32 CultureIndex = Target->Settings.SupportedCulturesStatistics.IndexOfByPredicate([CultureName](const FCultureStatistics& Culture) { return Culture.CultureName == CultureName.GetValue(); });
|
|
AddCultureToGenerate(CultureIndex);
|
|
}
|
|
// Export for all cultures.
|
|
else
|
|
{
|
|
for (int32 CultureIndex = 0; CultureIndex < Target->Settings.SupportedCulturesStatistics.Num(); ++CultureIndex)
|
|
{
|
|
AddCultureToGenerate(CultureIndex);
|
|
}
|
|
}
|
|
|
|
// Do not use culture subdirectories if exporting a single culture to a specific directory.
|
|
if (CultureName.IsSet() && ExportPathOverride.IsSet())
|
|
{
|
|
ConfigSection.Add(TEXT("bUseCultureDirectory"), "false");
|
|
}
|
|
|
|
ConfigSection.Add(TEXT("ManifestName"), GetManifestFileName(Target));
|
|
ConfigSection.Add(TEXT("ArchiveName"), GetArchiveFileName(Target));
|
|
|
|
FString DialogueScriptFileName;
|
|
// The export path for a specific culture is a file path.
|
|
if (CultureName.IsSet() && ExportPathOverride.IsSet())
|
|
{
|
|
DialogueScriptFileName = FPaths::GetCleanFilename(ExportPathOverride.GetValue());
|
|
}
|
|
// Use the default PO file's name.
|
|
else
|
|
{
|
|
DialogueScriptFileName = GetDefaultDialogueScriptFileName(Target);
|
|
}
|
|
ConfigSection.Add(TEXT("DialogueScriptName"), DialogueScriptFileName);
|
|
}
|
|
|
|
// GatherTextStep0 - ExportDialogueScript
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(0);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add(TEXT("CommandletClass"), TEXT("ExportDialogueScript"));
|
|
}
|
|
|
|
Script.Dirty = true;
|
|
|
|
return Script;
|
|
}
|
|
|
|
FString GetExportDialogueScriptConfigPath(const ULocalizationTarget* const Target, const TOptional<FString> CultureName)
|
|
{
|
|
const FString ConfigFileDirectory = GetConfigDirectory(Target);
|
|
FString ConfigFilePath;
|
|
if (CultureName.IsSet())
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf(TEXT("%s_ExportDialogueScript_%s.ini"), *Target->Settings.Name, *CultureName.GetValue());
|
|
}
|
|
else
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf(TEXT("%s_ExportDialogueScript.ini"), *Target->Settings.Name);
|
|
}
|
|
return ConfigFilePath;
|
|
}
|
|
|
|
FLocalizationConfigurationScript GenerateImportDialogueConfigFile(const ULocalizationTarget* const Target, const TOptional<FString> CultureName)
|
|
{
|
|
FLocalizationConfigurationScript Script;
|
|
|
|
const FString ContentDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetContentDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
|
|
// CommonSettings
|
|
{
|
|
FConfigSection& ConfigSection = Script.CommonSettings();
|
|
|
|
const FString SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add(TEXT("SourcePath"), SourcePath);
|
|
|
|
ConfigSection.Add(TEXT("ManifestName"), GetManifestFileName(Target));
|
|
ConfigSection.Add(TEXT("ArchiveName"), GetArchiveFileName(Target));
|
|
|
|
if (Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex))
|
|
{
|
|
ConfigSection.Add(TEXT("NativeCulture"), Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName);
|
|
}
|
|
|
|
const auto& AddCultureToGenerate = [&](const int32 Index)
|
|
{
|
|
ConfigSection.Add(TEXT("CulturesToGenerate"), Target->Settings.SupportedCulturesStatistics[Index].CultureName);
|
|
};
|
|
|
|
if (CultureName.IsSet())
|
|
{
|
|
const int32 CultureIndex = Target->Settings.SupportedCulturesStatistics.IndexOfByPredicate([CultureName](const FCultureStatistics& Culture) { return Culture.CultureName == CultureName.GetValue(); });
|
|
AddCultureToGenerate(CultureIndex);
|
|
}
|
|
else
|
|
{
|
|
for (int32 CultureIndex = 0; CultureIndex < Target->Settings.SupportedCulturesStatistics.Num(); ++CultureIndex)
|
|
{
|
|
AddCultureToGenerate(CultureIndex);
|
|
}
|
|
}
|
|
}
|
|
|
|
// GatherTextStep0 - ImportLocalizedDialogue
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(0);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add(TEXT("CommandletClass"), TEXT("ImportLocalizedDialogue"));
|
|
|
|
ConfigSection.Add(TEXT("RawAudioPath"), Target->Settings.ImportDialogueSettings.RawAudioPath.Path);
|
|
ConfigSection.Add(TEXT("ImportedDialogueFolder"), Target->Settings.ImportDialogueSettings.ImportedDialogueFolder);
|
|
ConfigSection.Add(TEXT("bImportNativeAsSource"), Target->Settings.ImportDialogueSettings.bImportNativeAsSource ? TEXT("true") : TEXT("false"));
|
|
}
|
|
|
|
Script.Dirty = true;
|
|
|
|
return Script;
|
|
}
|
|
|
|
FString GetImportDialogueConfigPath(const ULocalizationTarget* const Target, const TOptional<FString> CultureName)
|
|
{
|
|
const FString ConfigFileDirectory = GetConfigDirectory(Target);
|
|
FString ConfigFilePath;
|
|
if (CultureName.IsSet())
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf(TEXT("%s_ImportDialogue_%s.ini"), *Target->Settings.Name, *CultureName.GetValue());
|
|
}
|
|
else
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf(TEXT("%s_ImportDialogue.ini"), *Target->Settings.Name);
|
|
}
|
|
return ConfigFilePath;
|
|
}
|
|
|
|
FLocalizationConfigurationScript GenerateWordCountReportConfigFile(const ULocalizationTarget* const Target)
|
|
{
|
|
FLocalizationConfigurationScript Script;
|
|
|
|
const FString ContentDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetContentDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
|
|
// CommonSettings
|
|
{
|
|
FConfigSection& ConfigSection = Script.CommonSettings();
|
|
|
|
const FString SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add( TEXT("SourcePath"), SourcePath );
|
|
const FString DestinationPath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add( TEXT("DestinationPath"), DestinationPath );
|
|
|
|
ConfigSection.Add( TEXT("ManifestName"), GetManifestFileName(Target) );
|
|
ConfigSection.Add( TEXT("ArchiveName"), GetArchiveFileName(Target) );
|
|
|
|
for (const FCultureStatistics& CultureStatistics : Target->Settings.SupportedCulturesStatistics)
|
|
{
|
|
ConfigSection.Add( TEXT("CulturesToGenerate"), CultureStatistics.CultureName );
|
|
}
|
|
}
|
|
|
|
// GatherTextStep0 - GenerateTextLocalizationReport
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(0);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("GenerateTextLocalizationReport") );
|
|
|
|
ConfigSection.Add( TEXT("bWordCountReport"), TEXT("true") );
|
|
|
|
ConfigSection.Add( TEXT("WordCountReportName"), GetWordCountCSVFileName(Target) );
|
|
}
|
|
|
|
Script.Dirty = true;
|
|
|
|
return Script;
|
|
}
|
|
|
|
FString GetWordCountReportConfigPath(const ULocalizationTarget* const Target)
|
|
{
|
|
return GetConfigDirectory(Target) / FString::Printf(TEXT("%s_GenerateReports.ini"), *Target->Settings.Name);
|
|
}
|
|
|
|
FLocalizationConfigurationScript GenerateCompileTextConfigFile(const ULocalizationTarget* const Target, const TOptional<FString> CultureName)
|
|
{
|
|
FLocalizationConfigurationScript Script;
|
|
|
|
const FString ContentDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetContentDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
|
|
// CommonSettings
|
|
{
|
|
FConfigSection& ConfigSection = Script.CommonSettings();
|
|
|
|
const FString SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add( TEXT("SourcePath"), SourcePath );
|
|
const FString DestinationPath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add( TEXT("DestinationPath"), DestinationPath );
|
|
|
|
ConfigSection.Add( TEXT("ManifestName"), GetManifestFileName(Target) );
|
|
ConfigSection.Add( TEXT("ResourceName"), GetLocResFileName(Target) );
|
|
|
|
if (Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex))
|
|
{
|
|
ConfigSection.Add( TEXT("NativeCulture"), Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName );
|
|
}
|
|
|
|
const auto& AddCultureToGenerate = [&](const int32 Index)
|
|
{
|
|
ConfigSection.Add( TEXT("CulturesToGenerate"), Target->Settings.SupportedCulturesStatistics[Index].CultureName );
|
|
};
|
|
|
|
// Compile a specific culture.
|
|
if (CultureName.IsSet())
|
|
{
|
|
const int32 CultureIndex = Target->Settings.SupportedCulturesStatistics.IndexOfByPredicate([CultureName](const FCultureStatistics& Culture) { return Culture.CultureName == CultureName.GetValue(); });
|
|
AddCultureToGenerate(CultureIndex);
|
|
}
|
|
// Compile all cultures.
|
|
else
|
|
{
|
|
for (int32 CultureIndex = 0; CultureIndex < Target->Settings.SupportedCulturesStatistics.Num(); ++CultureIndex)
|
|
{
|
|
AddCultureToGenerate(CultureIndex);
|
|
}
|
|
}
|
|
}
|
|
|
|
// GatherTextStep0 - GenerateTextLocalizationResource
|
|
{
|
|
FConfigSection& ConfigSection = Script.GatherTextStep(0);
|
|
|
|
// CommandletClass
|
|
ConfigSection.Add( TEXT("CommandletClass"), TEXT("GenerateTextLocalizationResource") );
|
|
}
|
|
|
|
Script.Dirty = true;
|
|
|
|
return Script;
|
|
}
|
|
|
|
FString GetCompileTextConfigPath(const ULocalizationTarget* const Target, const TOptional<FString> CultureName)
|
|
{
|
|
const FString ConfigFileDirectory = GetConfigDirectory(Target);
|
|
FString ConfigFilePath;
|
|
if (CultureName.IsSet())
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf( TEXT("%s_Compile_%s.ini"), *Target->Settings.Name, *CultureName.GetValue() );
|
|
}
|
|
else
|
|
{
|
|
ConfigFilePath = ConfigFileDirectory / FString::Printf( TEXT("%s_Compile.ini"), *Target->Settings.Name );
|
|
}
|
|
return ConfigFilePath;
|
|
}
|
|
|
|
FLocalizationConfigurationScript GenerateRegenerateResourcesConfigFile(const ULocalizationTarget* const Target)
|
|
{
|
|
FLocalizationConfigurationScript Script;
|
|
|
|
const FString ContentDirRelativeToGameDir = MakePathRelativeForCommandletProcess(GetContentDir(Target), !Target->IsMemberOfEngineTargetSet());
|
|
|
|
// RegenerateResources
|
|
{
|
|
FConfigSection& ConfigSection = Script.FindOrAdd("RegenerateResources");;
|
|
|
|
if (Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex))
|
|
{
|
|
ConfigSection.Add(TEXT("NativeCulture"), Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName);
|
|
}
|
|
|
|
const FString SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add(TEXT("SourcePath"), SourcePath);
|
|
const FString DestinationPath = ContentDirRelativeToGameDir / TEXT("Localization") / Target->Settings.Name;
|
|
ConfigSection.Add(TEXT("DestinationPath"), DestinationPath);
|
|
|
|
ConfigSection.Add(TEXT("ManifestName"), GetManifestFileName(Target));
|
|
|
|
ConfigSection.Add(TEXT("ResourceName"), GetLocResFileName(Target));
|
|
|
|
}
|
|
|
|
Script.Dirty = true;
|
|
|
|
return Script;
|
|
}
|
|
|
|
FString GetRegenerateResourcesConfigPath(const ULocalizationTarget* const Target)
|
|
{
|
|
return GetConfigDirectory(Target) / FString::Printf(TEXT("Regenerate%s.ini"), *(Target->Settings.Name));
|
|
}
|
|
|
|
} |