Merge pull request #5618 from jonsequitur/remove-incorrect-localizations
Remove incorrect localizations
This commit is contained in:
commit
d3d6bdebd1
11 changed files with 49 additions and 73 deletions
|
@ -48,6 +48,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
};
|
||||
|
||||
public static readonly string MSBUILD_EXE_PATH = "MSBUILD_EXE_PATH";
|
||||
public static readonly string MSBuildExtensionsPath = "MSBuildExtensionsPath";
|
||||
|
||||
public static readonly string ProjectArgumentName = "<PROJECT>";
|
||||
public static readonly string SolutionArgumentName = "<SLN_FILE>";
|
||||
|
|
|
@ -385,11 +385,11 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
if (cmd != this && cmd.Arguments.Any())
|
||||
{
|
||||
var args = string.Join(" ", cmd.Arguments.Select(arg => arg.Name));
|
||||
headerBuilder.Insert(usagePrefixLength, string.Format(LocalizableStrings.UsageItemWithArgs, cmd.Name, args));
|
||||
headerBuilder.Insert(usagePrefixLength, string.Format(" {0} {1}", cmd.Name, args));
|
||||
}
|
||||
else
|
||||
{
|
||||
headerBuilder.Insert(usagePrefixLength, string.Format(LocalizableStrings.UsageItemWithoutArgs, cmd.Name));
|
||||
headerBuilder.Insert(usagePrefixLength, string.Format(" {0}", cmd.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
|
||||
if (target != null)
|
||||
{
|
||||
headerBuilder.AppendFormat(LocalizableStrings.CommandItem, commandName);
|
||||
headerBuilder.AppendFormat(" {0}", commandName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -444,11 +444,10 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
{
|
||||
if (cmd.Arguments.Any())
|
||||
{
|
||||
var outputFormat = LocalizableStrings.UsageArgumentItem;
|
||||
foreach (var arg in cmd.Arguments)
|
||||
{
|
||||
argumentsBuilder.AppendFormat(
|
||||
outputFormat,
|
||||
" {0}{1}",
|
||||
arg.Name.PadRight(maxArgLen + 2),
|
||||
arg.Description);
|
||||
argumentsBuilder.AppendLine();
|
||||
|
@ -463,7 +462,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
optionsBuilder.AppendLine();
|
||||
optionsBuilder.AppendLine(LocalizableStrings.UsageOptionsHeader);
|
||||
var maxOptLen = MaxOptionTemplateLength(target.Options);
|
||||
var outputFormat = string.Format(LocalizableStrings.UsageOptionsItem, maxOptLen + 2);
|
||||
var outputFormat = string.Format(" {{0, -{0}}}{{1}}", maxOptLen + 2);
|
||||
foreach (var opt in target.Options)
|
||||
{
|
||||
optionsBuilder.AppendFormat(outputFormat, opt.Template, opt.Description);
|
||||
|
@ -478,7 +477,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
commandsBuilder.AppendLine();
|
||||
commandsBuilder.AppendLine(LocalizableStrings.UsageCommandsHeader);
|
||||
var maxCmdLen = MaxCommandLength(target.Commands);
|
||||
var outputFormat = string.Format(LocalizableStrings.UsageCommandsItem, maxCmdLen + 2);
|
||||
var outputFormat = string.Format(" {{0, -{0}}}{{1}}", maxCmdLen + 2);
|
||||
foreach (var cmd in target.Commands.OrderBy(c => c.Name))
|
||||
{
|
||||
commandsBuilder.AppendFormat(outputFormat, cmd.Name, cmd.Description);
|
||||
|
@ -508,7 +507,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
{
|
||||
argumentSeparatorBuilder.AppendLine();
|
||||
argumentSeparatorBuilder.AppendLine(LocalizableStrings.UsageCommandsAdditionalArgsHeader);
|
||||
argumentSeparatorBuilder.AppendLine(String.Format(LocalizableStrings.UsageCommandsAdditionalArgsItem, target.ArgumentSeparatorHelpText));
|
||||
argumentSeparatorBuilder.AppendLine(String.Format(" {0}", target.ArgumentSeparatorHelpText));
|
||||
argumentSeparatorBuilder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +534,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
|
||||
public string GetFullNameAndVersion()
|
||||
{
|
||||
return ShortVersionGetter == null ? FullName : string.Format(LocalizableStrings.ShortVersionTemplate, FullName, ShortVersionGetter());
|
||||
return ShortVersionGetter == null ? FullName : string.Format("{0} {1}", FullName, ShortVersionGetter());
|
||||
}
|
||||
|
||||
public void ShowRootCommandFullNameAndVersion()
|
||||
|
|
|
@ -20,28 +20,18 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
|
||||
public const string UsageHeader = "Usage:";
|
||||
|
||||
public const string UsageItemWithoutArgs = " {0}";
|
||||
|
||||
public const string UsageItemWithArgs = " {0} {1}";
|
||||
|
||||
public const string UsageArgumentsToken = " [arguments]";
|
||||
|
||||
public const string UsageArgumentsHeader = "Arguments:";
|
||||
|
||||
public const string UsageArgumentItem = " {0}{1}";
|
||||
|
||||
public const string UsageOptionsToken = " [options]";
|
||||
|
||||
public const string UsageOptionsHeader = "Options:";
|
||||
|
||||
public const string UsageOptionsItem = " {{0, -{0}}}{{1}}";
|
||||
|
||||
public const string UsageCommandToken = " [command]";
|
||||
|
||||
public const string UsageCommandsHeader = "Commands:";
|
||||
|
||||
public const string UsageCommandsItem = " {{0, -{0}}}{{1}}";
|
||||
|
||||
public const string UsageCommandsDetailHelp = "Use \"{0} [command] --help\" for more information about a command.";
|
||||
|
||||
public const string UsageCommandArgs = " [args]";
|
||||
|
@ -50,12 +40,6 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
|
||||
public const string UsageCommandsAdditionalArgsHeader = "Additional Arguments:";
|
||||
|
||||
public const string UsageCommandsAdditionalArgsItem = " {0}";
|
||||
|
||||
public const string CommandItem = " {0}";
|
||||
|
||||
public const string ShortVersionTemplate = "{0} {1}";
|
||||
|
||||
public const string InvalidTemplateError = "Invalid template pattern '{0}'";
|
||||
|
||||
public const string MSBuildAdditionalArgsHelpText = "Any extra options that should be passed to MSBuild. See 'dotnet msbuild -h' for available options.";
|
||||
|
|
|
@ -46,8 +46,8 @@ namespace Microsoft.DotNet.Tools.Add.PackageReference
|
|||
|
||||
command._versionOption = command.Option(
|
||||
$"-v|--version <{LocalizableStrings.CmdVersion}>",
|
||||
LocalizableStrings.CmdVersionDescription,
|
||||
CommandOptionType.SingleValue);
|
||||
description: LocalizableStrings.CmdVersionDescription,
|
||||
optionType: CommandOptionType.SingleValue);
|
||||
|
||||
command._frameworkOption = command.Option(
|
||||
$"-f|--framework <{LocalizableStrings.CmdFramework}>",
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
namespace Microsoft.DotNet.Tools.RestoreProjectJson
|
||||
{
|
||||
internal class LocalizableStrings
|
||||
{
|
||||
public const string AddMinimal = "minimal";
|
||||
|
||||
public const string AddRestore = "restore";
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.Tools;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.RestoreProjectJson
|
||||
{
|
||||
|
@ -13,9 +12,9 @@ namespace Microsoft.DotNet.Tools.RestoreProjectJson
|
|||
if (!args.Any(s => s.Equals("--verbosity", StringComparison.OrdinalIgnoreCase) || s.Equals("-v", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
prefixArgs.Add("--verbosity");
|
||||
prefixArgs.Add(LocalizableStrings.AddMinimal);
|
||||
prefixArgs.Add("minimal");
|
||||
}
|
||||
prefixArgs.Add(LocalizableStrings.AddRestore);
|
||||
prefixArgs.Add("restore");
|
||||
|
||||
var nugetApp = new NuGetForwardingApp(Enumerable.Concat(prefixArgs, args));
|
||||
|
||||
|
|
|
@ -16,15 +16,7 @@
|
|||
|
||||
public const string RunCommandException = "The build failed. Please fix the build errors and run again.";
|
||||
|
||||
public const string RunCommandMSBuildExtensionsPath = "MSBuildExtensionsPath";
|
||||
|
||||
public const string RunCommandConfiguration = "Configuration";
|
||||
|
||||
public const string RunCommandTargetFramework = "TargetFramework";
|
||||
|
||||
public const string RunCommandProjectInstance = "RunCommand";
|
||||
|
||||
public const string RunCommandOutputType = "OutputType";
|
||||
public const string RunCommandExceptionUnableToRun = "Unable to run your project\nPlease ensure you have a runnable project type and ensure '{0}' supports this project.\nThe current {1} is '{2}'";
|
||||
|
||||
public const string RunCommandExceptionUnableToRun1 = "Unable to run your project.";
|
||||
|
||||
|
@ -32,10 +24,6 @@
|
|||
|
||||
public const string RunCommandExceptionUnableToRun3 = "The current OutputType is ";
|
||||
|
||||
public const string RunCommandRunArguments = "RunArguments";
|
||||
|
||||
public const string RunCommandRunWorkingDirectory = "RunWorkingDirectory";
|
||||
|
||||
public const string RunCommandInvalidOperationException1 = "Couldn't find a project to run. Ensure a project exists in ";
|
||||
|
||||
public const string RunCommandInvalidOperationException2 = "Or pass the path to the project using --project";
|
||||
|
|
|
@ -67,36 +67,38 @@ namespace Microsoft.DotNet.Tools.Run
|
|||
|
||||
private ICommand GetRunCommand()
|
||||
{
|
||||
Dictionary<string, string> globalProperties = new Dictionary<string, string>()
|
||||
var globalProperties = new Dictionary<string, string>
|
||||
{
|
||||
{ LocalizableStrings.RunCommandMSBuildExtensionsPath, AppContext.BaseDirectory }
|
||||
{ Constants.MSBuildExtensionsPath, AppContext.BaseDirectory }
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Configuration))
|
||||
{
|
||||
globalProperties.Add(LocalizableStrings.RunCommandConfiguration, Configuration);
|
||||
globalProperties.Add("Configuration", Configuration);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Framework))
|
||||
{
|
||||
globalProperties.Add(LocalizableStrings.RunCommandTargetFramework, Framework);
|
||||
globalProperties.Add("TargetFramework", Framework);
|
||||
}
|
||||
|
||||
ProjectInstance projectInstance = new ProjectInstance(Project, globalProperties, null);
|
||||
|
||||
string runProgram = projectInstance.GetPropertyValue(LocalizableStrings.RunCommandProjectInstance);
|
||||
string runProgram = projectInstance.GetPropertyValue("RunCommand");
|
||||
if (string.IsNullOrEmpty(runProgram))
|
||||
{
|
||||
string outputType = projectInstance.GetPropertyValue(LocalizableStrings.RunCommandOutputType);
|
||||
string outputType = projectInstance.GetPropertyValue("OutputType");
|
||||
|
||||
throw new GracefulException(string.Join(Environment.NewLine,
|
||||
LocalizableStrings.RunCommandExceptionUnableToRun1,
|
||||
LocalizableStrings.RunCommandExceptionUnableToRun2,
|
||||
$"{LocalizableStrings.RunCommandExceptionUnableToRun3}'{outputType}'."));
|
||||
throw new GracefulException(
|
||||
string.Format(
|
||||
LocalizableStrings.RunCommandExceptionUnableToRun,
|
||||
"dotnet run",
|
||||
"OutputType",
|
||||
outputType));
|
||||
}
|
||||
|
||||
string runArguments = projectInstance.GetPropertyValue(LocalizableStrings.RunCommandRunArguments);
|
||||
string runWorkingDirectory = projectInstance.GetPropertyValue(LocalizableStrings.RunCommandRunWorkingDirectory);
|
||||
string runArguments = projectInstance.GetPropertyValue("RunArguments");
|
||||
string runWorkingDirectory = projectInstance.GetPropertyValue("RunWorkingDirectory");
|
||||
|
||||
string fullArguments = runArguments;
|
||||
if (_args.Any())
|
||||
|
@ -119,16 +121,15 @@ namespace Microsoft.DotNet.Tools.Run
|
|||
|
||||
if (projectFiles.Length == 0)
|
||||
{
|
||||
var project = "--project";
|
||||
|
||||
throw new InvalidOperationException(
|
||||
$"{LocalizableStrings.RunCommandInvalidOperationException1} {directory}." + Environment.NewLine +
|
||||
LocalizableStrings.RunCommandInvalidOperationException2)
|
||||
.DisplayAsError();
|
||||
$"Couldn't find a project to run. Ensure a project exists in {directory}, or pass the path to the project using {project}");
|
||||
}
|
||||
else if (projectFiles.Length > 1)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"{LocalizableStrings.RunCommandInvalidOperationException3}'{directory}'{LocalizableStrings.RunCommandInvalidOperationException4}")
|
||||
.DisplayAsError();
|
||||
$"Specify which project file to use because {directory} contains more than one project file.");
|
||||
}
|
||||
|
||||
Project = projectFiles[0];
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Tools.Sln
|
|||
public const string AppHelpText = "Projects to add or to remove from the solution.";
|
||||
|
||||
public const string AddAppFullName = ".NET Add project(s) to a solution file Command";
|
||||
public const string AddSubcommandHelpText = "Add a specified project(s) to the solution.";
|
||||
public const string AddSubcommandHelpText = "Add one or more specified projects to the solution.";
|
||||
|
||||
public const string RemoveAppFullName = ".NET Remove project(s) from a solution file Command";
|
||||
public const string RemoveSubcommandHelpText = "Remove the specified project(s) from the solution. The project is not impacted.";
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
public const string CmdArgProject = "PROJECT";
|
||||
|
||||
public const string CmdArgDescription = "The project to test, defaults to the current directory.";
|
||||
public const string CmdArgDescription = "The project to test. Defaults to the current directory.";
|
||||
|
||||
public const string CmdSettingsFile = "SETTINGS_FILE";
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
public const string CmdConfiguration = "CONFIGURATION";
|
||||
|
||||
public const string CmdConfigDescription = "Configuration to use for building the project. Default for most projects is \"Debug\".";
|
||||
public const string CmdConfigDescription = "Configuration to use for building the project. Default for most projects is \"Debug\".";
|
||||
|
||||
public const string CmdFramework = "FRAMEWORK";
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ using System;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Sln.Add.Tests
|
||||
{
|
||||
|
@ -25,8 +26,14 @@ Options:
|
|||
-h|--help Show help information
|
||||
|
||||
Additional Arguments:
|
||||
Add a specified project(s) to the solution.
|
||||
Add one or more specified projects to the solution.
|
||||
";
|
||||
private ITestOutputHelper _output;
|
||||
|
||||
public GivenDotnetSlnAdd(ITestOutputHelper output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
|
||||
private const string ExpectedSlnFileAfterAddingLibProj = @"
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
|
@ -269,6 +276,12 @@ EndGlobal
|
|||
.ExecuteWithCapturedOutput(@"sln App.sln add");
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().Be("You must specify at least one project to add.");
|
||||
|
||||
_output.WriteLine("[STD OUT]");
|
||||
_output.WriteLine(cmd.StdOut);
|
||||
_output.WriteLine("[HelpText]");
|
||||
_output.WriteLine(HelpText);
|
||||
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue