You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Introduced the experimental LocalizationTargetEditor UAT command. This command allows users to create, update, delete and query localization targets in the Engine or project. The LocalizationTargetEditor UAT command is set up to have a series of sub-commands which can be executed with different parameters. This allows the LocalizationTargetEditor to be extensible to users for specialized localization target operations. - Introduced the LocalizationTargetCommand abstract base class. This class is what all othe LocalizationTargetEditor sub-commands should be drived from. A scan of all sub-classes of LocalizationTargetCommand will be scanned for to determine all available localization target commands. - Introduced the PluginLocalizationTargetCommand abstract base class. All commands to be operated on plugins should derive from this class. - Introduced the NewPluginLocalizationTarget sub-command which will create localization config files for plugins and make the necessary updates to .uplugin files. All plugins under a provided directory can be operated on at a time to batch create the necessary localization config files. - The NewPluginLocalizationTarget sub-command has perforce integration and can automatically add/check out all files that have been created/edited. - Introduced a number of classes to encapsulate all the data in the various localization config files. This allows for generation of localization config files from code. - Introduced the LocalizationConfigFileBuilder and LocalizationConfigFileGenerator base classes. These classes and their sub-classes are used to generate localization config files in the correct format provided the config file data. Current support is only for modular localization config files. However, the LocalizationConfigFileBuilder can also be used to generate Monolithic localization config files if necessary.also #rb: Jamie.Dale #jira: UE-194872, UE-194873, UE-194874, #test Used the NewPluginLocalizationTarget sub-command to generate a number of plugins. The generated localization config files yield correct localization gather results and the plugin .locres file was successfully loaded at runtime to display the correct localized text. [CL 28424727 by leon huang in ue5-main branch]
116 lines
7.1 KiB
C#
116 lines
7.1 KiB
C#
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace EpicGames.Localization
|
|
{
|
|
public class LocalizationConfigFileGeneratorParams
|
|
{
|
|
public string LocalizationTargetName { get; set; } = "";
|
|
public string LocalizationTargetRootDirectory { get; set; } = "";
|
|
}
|
|
|
|
public abstract class LocalizationConfigFileGenerator
|
|
{
|
|
public static LocalizationConfigFileGenerator GetGeneratorForFileFormat(LocalizationConfigFileFormat fileFormat)
|
|
{
|
|
switch (fileFormat)
|
|
{
|
|
case LocalizationConfigFileFormat.Modular:
|
|
return new ModularLocalizationConfigFileGenerator();
|
|
default:
|
|
throw new NotImplementedException("File format is not yet supported.");
|
|
}
|
|
}
|
|
|
|
public abstract List<LocalizationConfigFile> GenerateDefaultSettingsConfigFiles(LocalizationConfigFileGeneratorParams generatorParams);
|
|
|
|
}
|
|
|
|
public class ModularLocalizationConfigFileGenerator : LocalizationConfigFileGenerator
|
|
{
|
|
public override List<LocalizationConfigFile> GenerateDefaultSettingsConfigFiles(LocalizationConfigFileGeneratorParams generatorParams)
|
|
{
|
|
List<LocalizationConfigFile> configFiles = new List<LocalizationConfigFile>();
|
|
configFiles.Add(GenerateLocalizationGatherConfigFile(generatorParams));
|
|
configFiles.Add(GenerateLocalizationExportConfigFile(generatorParams));
|
|
configFiles.Add(GenerateLocalizationImportConfigFile(generatorParams));
|
|
configFiles.Add(GenerateLocalizationCompileConfigFile(generatorParams));
|
|
configFiles.Add(GenerateLocalizationGenerateReportsConfigFile(generatorParams));
|
|
return configFiles;
|
|
}
|
|
|
|
private LocalizationConfigFile GenerateLocalizationGatherConfigFile(LocalizationConfigFileGeneratorParams generatorParam)
|
|
{
|
|
CommonSettingsParams commonSettings = CommonSettingsParams.CreateDefault(generatorParam.LocalizationTargetName, generatorParam.LocalizationTargetRootDirectory);
|
|
LocalizationConfigFileBuilder builder = new LocalizationConfigFileBuilder(generatorParam.LocalizationTargetName + ModularLocalizationConfigFileSuffixes.GatherSuffix + LocalizationFileExtensions.ModularLocalizationConfigFileExtension);
|
|
builder.AddCommonSettingsSection(commonSettings);
|
|
|
|
GatherTextFromSourceParams gatherTextFromSourceParams = GatherTextFromSourceParams.CreateDefault(generatorParam.LocalizationTargetName, generatorParam.LocalizationTargetRootDirectory);
|
|
builder.AddGatherTextFromSourceSection(gatherTextFromSourceParams);
|
|
|
|
GatherTextFromAssetsParams gatherTextFromAssetsParams = GatherTextFromAssetsParams.CreateDefault(generatorParam.LocalizationTargetName, generatorParam.LocalizationTargetRootDirectory);
|
|
builder.AddGatherTextFromAssetsSection(gatherTextFromAssetsParams);
|
|
|
|
GenerateGatherManifestParams generateGatherManifestParams = GenerateGatherManifestParams.CreateDefault(generatorParam.LocalizationTargetName, generatorParam.LocalizationTargetRootDirectory);
|
|
builder.AddGenerateGatherManifestSection(generateGatherManifestParams);
|
|
|
|
GenerateGatherArchiveParams generateGatherArchiveParams = GenerateGatherArchiveParams.CreateDefault(generatorParam.LocalizationTargetName, generatorParam.LocalizationTargetRootDirectory);
|
|
builder.AddGenerateGatherArchiveSection( generateGatherArchiveParams);
|
|
|
|
GenerateTextLocalizationReportParams generateTextLocalizationReportParams = GenerateTextLocalizationReportParams.CreateDefault(generatorParam.LocalizationTargetName, generatorParam.LocalizationTargetRootDirectory);
|
|
builder.AddGenerateTextLocalizationReportSection(generateTextLocalizationReportParams);
|
|
|
|
return builder.Get();
|
|
}
|
|
|
|
private LocalizationConfigFile GenerateLocalizationExportConfigFile(LocalizationConfigFileGeneratorParams generatorParams)
|
|
{
|
|
CommonSettingsParams commonSettings = CommonSettingsParams.CreateDefault(generatorParams.LocalizationTargetName, generatorParams.LocalizationTargetRootDirectory);
|
|
LocalizationConfigFileBuilder builder = new LocalizationConfigFileBuilder(generatorParams.LocalizationTargetName + ModularLocalizationConfigFileSuffixes.ExportSuffix + LocalizationFileExtensions.ModularLocalizationConfigFileExtension);
|
|
builder.AddCommonSettingsSection(commonSettings);
|
|
|
|
ExportPortableObjectFilesParams exportParams = ExportPortableObjectFilesParams.CreateDefault(generatorParams.LocalizationTargetName, generatorParams.LocalizationTargetRootDirectory);
|
|
builder.AddExportPortableObjectFilesSection(exportParams);
|
|
return builder.Get();
|
|
}
|
|
|
|
private LocalizationConfigFile GenerateLocalizationImportConfigFile(LocalizationConfigFileGeneratorParams generatorParams)
|
|
{
|
|
CommonSettingsParams commonSettings = CommonSettingsParams.CreateDefault(generatorParams.LocalizationTargetName, generatorParams.LocalizationTargetRootDirectory);
|
|
LocalizationConfigFileBuilder builder = new LocalizationConfigFileBuilder(generatorParams.LocalizationTargetName + ModularLocalizationConfigFileSuffixes.ImportSuffix + LocalizationFileExtensions.ModularLocalizationConfigFileExtension);
|
|
builder.AddCommonSettingsSection(commonSettings);
|
|
|
|
ImportPortableObjectFilesParams importParams = ImportPortableObjectFilesParams.CreateDefault(generatorParams.LocalizationTargetName, generatorParams.LocalizationTargetRootDirectory);
|
|
builder.AddImportPortableObjectFilesSection(importParams);
|
|
return builder.Get();
|
|
}
|
|
|
|
private LocalizationConfigFile GenerateLocalizationCompileConfigFile(LocalizationConfigFileGeneratorParams generatorParams)
|
|
{
|
|
CommonSettingsParams commonSettings = CommonSettingsParams.CreateDefault(generatorParams.LocalizationTargetName, generatorParams.LocalizationTargetRootDirectory);
|
|
LocalizationConfigFileBuilder builder = new LocalizationConfigFileBuilder(generatorParams.LocalizationTargetName + ModularLocalizationConfigFileSuffixes.CompileSuffix + LocalizationFileExtensions.ModularLocalizationConfigFileExtension);
|
|
builder.AddCommonSettingsSection(commonSettings);
|
|
|
|
GenerateTextLocalizationResourceParams generateTextLocalizationResourceParams = GenerateTextLocalizationResourceParams.CreateDefault(generatorParams.LocalizationTargetName, generatorParams.LocalizationTargetRootDirectory);
|
|
builder.AddGenerateTextLocalizationResourceSection(generateTextLocalizationResourceParams);
|
|
return builder.Get();
|
|
}
|
|
|
|
private LocalizationConfigFile GenerateLocalizationGenerateReportsConfigFile(LocalizationConfigFileGeneratorParams generatorParams)
|
|
{
|
|
CommonSettingsParams commonSettings = CommonSettingsParams.CreateDefault(generatorParams.LocalizationTargetName, generatorParams.LocalizationTargetRootDirectory);
|
|
LocalizationConfigFileBuilder builder = new LocalizationConfigFileBuilder(generatorParams.LocalizationTargetName + ModularLocalizationConfigFileSuffixes.GenerateReportsSuffix + LocalizationFileExtensions.ModularLocalizationConfigFileExtension);
|
|
builder.AddCommonSettingsSection(commonSettings);
|
|
|
|
GenerateTextLocalizationReportParams reportParams = GenerateTextLocalizationReportParams.CreateDefault(generatorParams.LocalizationTargetName, generatorParams.LocalizationTargetRootDirectory);
|
|
// We don't need the conflict report
|
|
reportParams.bConflictReport = false;
|
|
reportParams.ConflictReportName = "";
|
|
builder.AddGenerateTextLocalizationReportSection(reportParams);
|
|
return builder.Get();
|
|
}
|
|
}
|
|
}
|
|
|