Extract localizable strings from dotnet-publish (#4801)

* Extract localizable strings from dotnet-publish

* Added $ to interpolated strings

* Update Program.cs
This commit is contained in:
Scott Carlton 2016-11-30 09:04:04 -08:00 committed by Piotr Puszkiewicz
parent f49e29711f
commit 879ae39f35
2 changed files with 42 additions and 10 deletions

View file

@ -0,0 +1,33 @@
namespace Microsoft.DotNet.Tools.Publish
{
internal class LocalizableStrings
{
public const string AppFullName = ".NET Publisher";
public const string AppDescription = "Publisher for the .NET Platform";
public const string ProjectArgument = "PROJECT";
public const string ProjectArgDescription = "The MSBuild project file to publish. If a project file is not specified, MSBuild searches the current working directory for a file that has a file extension that ends in `proj` and uses that file.";
public const string FrameworkOption = "FRAMEWORK";
public const string FrameworkOptionDescription = "Target framework to publish for";
public const string RuntimeOption = "RUNTIME_IDENTIFIER";
public const string RuntimeOptionDescription = "Target runtime to publish for. The default is to publish a portable application.";
public const string OutputOption = "OUTPUT_DIR";
public const string OutputOptionDescription = "Path in which to publish the app";
public const string ConfigurationOption = "CONFIGURATION";
public const string ConfigurationOptionDescription = "Configuration under which to build";
public const string VersionSuffixOption = "VERSION_SUFFIX";
public const string VersionSuffixOptionDescription = "Defines the value for the $(VersionSuffix) property in the project";
}
}

View file

@ -15,34 +15,33 @@ namespace Microsoft.DotNet.Tools.Publish
CommandLineApplication app = new CommandLineApplication(throwOnUnexpectedArg: false); CommandLineApplication app = new CommandLineApplication(throwOnUnexpectedArg: false);
app.Name = "dotnet publish"; app.Name = "dotnet publish";
app.FullName = ".NET Publisher"; app.FullName = LocalizableStrings.AppFullName;
app.Description = "Publisher for the .NET Platform"; app.Description = LocalizableStrings.AppDescription;
app.AllowArgumentSeparator = true; app.AllowArgumentSeparator = true;
app.ArgumentSeparatorHelpText = HelpMessageStrings.MSBuildAdditionalArgsHelpText; app.ArgumentSeparatorHelpText = HelpMessageStrings.MSBuildAdditionalArgsHelpText;
app.HelpOption("-h|--help"); app.HelpOption("-h|--help");
CommandArgument projectArgument = app.Argument("<PROJECT>", CommandArgument projectArgument = app.Argument($"<{LocalizableStrings.ProjectArgument}>",
"The MSBuild project file to publish. If a project file is not specified, MSBuild searches the current" + LocalizableStrings.ProjectArgDescription);
" working directory for a file that has a file extension that ends in `proj` and uses that file.");
CommandOption frameworkOption = app.Option( CommandOption frameworkOption = app.Option(
"-f|--framework <FRAMEWORK>", "Target framework to publish for", $"-f|--framework <{LocalizableStrings.FrameworkOption}>", LocalizableStrings.FrameworkOptionDescription,
CommandOptionType.SingleValue); CommandOptionType.SingleValue);
CommandOption runtimeOption = app.Option( CommandOption runtimeOption = app.Option(
"-r|--runtime <RUNTIME_IDENTIFIER>", "Target runtime to publish for. The default is to publish a portable application.", $"-r|--runtime <{LocalizableStrings.RuntimeOption}>", LocalizableStrings.RuntimeOptionDescription,
CommandOptionType.SingleValue); CommandOptionType.SingleValue);
CommandOption outputOption = app.Option( CommandOption outputOption = app.Option(
"-o|--output <OUTPUT_DIR>", "Path in which to publish the app", $"-o|--output <{LocalizableStrings.OutputOption}>", LocalizableStrings.OutputOptionDescription,
CommandOptionType.SingleValue); CommandOptionType.SingleValue);
CommandOption configurationOption = app.Option( CommandOption configurationOption = app.Option(
"-c|--configuration <CONFIGURATION>", "Configuration under which to build", $"-c|--configuration <{LocalizableStrings.ConfigurationOption}>", LocalizableStrings.ConfigurationOptionDescription,
CommandOptionType.SingleValue); CommandOptionType.SingleValue);
CommandOption versionSuffixOption = app.Option( CommandOption versionSuffixOption = app.Option(
"--version-suffix <VERSION_SUFFIX>", "Defines the value for the $(VersionSuffix) property in the project", $"--version-suffix <{LocalizableStrings.VersionSuffixOption}>", LocalizableStrings.VersionSuffixOptionDescription,
CommandOptionType.SingleValue); CommandOptionType.SingleValue);
CommandOption verbosityOption = MSBuildForwardingApp.AddVerbosityOption(app); CommandOption verbosityOption = MSBuildForwardingApp.AddVerbosityOption(app);