From 879ae39f353ce64d05839a79341dfb390cee12eb Mon Sep 17 00:00:00 2001 From: Scott Carlton Date: Wed, 30 Nov 2016 09:04:04 -0800 Subject: [PATCH] Extract localizable strings from dotnet-publish (#4801) * Extract localizable strings from dotnet-publish * Added $ to interpolated strings * Update Program.cs --- .../dotnet-publish/LocalizableStrings.cs | 33 +++++++++++++++++++ src/dotnet/commands/dotnet-publish/Program.cs | 19 +++++------ 2 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 src/dotnet/commands/dotnet-publish/LocalizableStrings.cs diff --git a/src/dotnet/commands/dotnet-publish/LocalizableStrings.cs b/src/dotnet/commands/dotnet-publish/LocalizableStrings.cs new file mode 100644 index 000000000..d9e466dd9 --- /dev/null +++ b/src/dotnet/commands/dotnet-publish/LocalizableStrings.cs @@ -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"; + } +} diff --git a/src/dotnet/commands/dotnet-publish/Program.cs b/src/dotnet/commands/dotnet-publish/Program.cs index c1c93b22c..d517f87a4 100644 --- a/src/dotnet/commands/dotnet-publish/Program.cs +++ b/src/dotnet/commands/dotnet-publish/Program.cs @@ -15,34 +15,33 @@ namespace Microsoft.DotNet.Tools.Publish CommandLineApplication app = new CommandLineApplication(throwOnUnexpectedArg: false); app.Name = "dotnet publish"; - app.FullName = ".NET Publisher"; - app.Description = "Publisher for the .NET Platform"; + app.FullName = LocalizableStrings.AppFullName; + app.Description = LocalizableStrings.AppDescription; app.AllowArgumentSeparator = true; app.ArgumentSeparatorHelpText = HelpMessageStrings.MSBuildAdditionalArgsHelpText; app.HelpOption("-h|--help"); - CommandArgument projectArgument = app.Argument("", - "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."); + CommandArgument projectArgument = app.Argument($"<{LocalizableStrings.ProjectArgument}>", + LocalizableStrings.ProjectArgDescription); CommandOption frameworkOption = app.Option( - "-f|--framework ", "Target framework to publish for", + $"-f|--framework <{LocalizableStrings.FrameworkOption}>", LocalizableStrings.FrameworkOptionDescription, CommandOptionType.SingleValue); CommandOption runtimeOption = app.Option( - "-r|--runtime ", "Target runtime to publish for. The default is to publish a portable application.", + $"-r|--runtime <{LocalizableStrings.RuntimeOption}>", LocalizableStrings.RuntimeOptionDescription, CommandOptionType.SingleValue); CommandOption outputOption = app.Option( - "-o|--output ", "Path in which to publish the app", + $"-o|--output <{LocalizableStrings.OutputOption}>", LocalizableStrings.OutputOptionDescription, CommandOptionType.SingleValue); CommandOption configurationOption = app.Option( - "-c|--configuration ", "Configuration under which to build", + $"-c|--configuration <{LocalizableStrings.ConfigurationOption}>", LocalizableStrings.ConfigurationOptionDescription, CommandOptionType.SingleValue); CommandOption versionSuffixOption = app.Option( - "--version-suffix ", "Defines the value for the $(VersionSuffix) property in the project", + $"--version-suffix <{LocalizableStrings.VersionSuffixOption}>", LocalizableStrings.VersionSuffixOptionDescription, CommandOptionType.SingleValue); CommandOption verbosityOption = MSBuildForwardingApp.AddVerbosityOption(app);