Files

55 lines
2.3 KiB
C#
Raw Permalink Normal View History

Localization: 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]
2023-10-03 14:44:56 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Text;
using AutomationTool;
using Microsoft.Extensions.Logging;
namespace EpicGames.Localization
{
[Help("Allows users to create, update, delete or query localization targets for the Engine or projects. This command has sub-commands and more info for each command can be retrieved with the -Info flag.")]
[Help("Command", "The sub-command you want to run. For a full list of valid command, use LocalizationTargetEditor -Info")]
[Help("Info", "An optional flag that can be passed to any sub-command. It will print out help text for the command and its associated parameters.")]
class LocalizationTargetEditor : BuildCommand
{
public override void ExecuteBuild()
{
LocalizationTargetCommand.Initialize(this);
string commandName = ParseParamValue("Command");
if (String.IsNullOrEmpty(commandName))
{
if (ParseParam("Info"))
{
StringBuilder helpTextBuilder = new StringBuilder();
helpTextBuilder.AppendLine("The Localization Target Editor is a means for you to create new localization targets. Use this command to create, edit, delete or query localization targets for projects, plugisn and platforms.");
helpTextBuilder.AppendLine("Below are all available commands under the Localization Target Editor. Add the -Info flag after any of these commands for more information.");
foreach (LocalizationTargetCommand helpCommand in LocalizationTargetCommand.GetAllCommands())
{
helpTextBuilder.AppendLine($"{helpCommand.Name}");
}
Logger.LogInformation($"{helpTextBuilder.ToString()}");
return;
}
}
LocalizationTargetCommand command = LocalizationTargetCommand.GetLocalizationTargetCommandFromName(commandName);
if (command is null)
{
Logger.LogError($"{commandName} is not a supported localization target command.");
return;
}
// If there's the -Info flag, we just display the help text and exit
// We have to use -Info as -Help is handled globally via UAT
if (ParseParam("Info"))
{
command.PrintHelpText();
return;
}
Logger.LogInformation($"Starting execution of '{command.Name}' localization target editor command.");
if (!command.Execute())
{
Logger.LogError($"Localization Target Editor '{command.Name}' failed.");
}
}
}
}