From 02c730304ebc77afa6f2ceb0a7c791991e4720fc Mon Sep 17 00:00:00 2001 From: Kevin B Date: Sun, 18 Apr 2021 08:14:30 -0700 Subject: [PATCH] Localizing remaining string resources (#1257) * Renamed ValidationMessages * WIP more strings localized * Localizing string resources --- .../Invocation/TypoCorrectionTests.cs | 18 +-- ...nTests.cs => ResourceLocalizationTests.cs} | 14 +- src/System.CommandLine/ArgumentArity.cs | 4 +- src/System.CommandLine/ArgumentExtensions.cs | 16 +-- .../FailedArgumentTypeConversionResult.cs | 20 ++- .../Builder/CommandLineBuilder.cs | 4 +- .../Builder/CommandLineBuilderExtensions.cs | 24 ++-- .../CommandLineConfiguration.cs | 10 +- .../Invocation/TypoCorrection.cs | 11 +- src/System.CommandLine/OptionExtensions.cs | 6 +- src/System.CommandLine/Parsing/ParseResult.cs | 2 +- .../Parsing/ParseResultVisitor.cs | 4 +- .../Parsing/StringExtensions.cs | 4 +- .../Parsing/SymbolResult.cs | 10 +- .../Properties/Resources.Designer.cs | 133 ++++++++++++++++-- .../Properties/Resources.resx | 43 ++++++ .../Properties/xlf/Resources.cs.xlf | 74 ++++++++++ .../Properties/xlf/Resources.de.xlf | 74 ++++++++++ .../Properties/xlf/Resources.es.xlf | 74 ++++++++++ .../Properties/xlf/Resources.fr.xlf | 74 ++++++++++ .../Properties/xlf/Resources.it.xlf | 74 ++++++++++ .../Properties/xlf/Resources.ja.xlf | 74 ++++++++++ .../Properties/xlf/Resources.ko.xlf | 74 ++++++++++ .../Properties/xlf/Resources.pl.xlf | 74 ++++++++++ .../Properties/xlf/Resources.pt-BR.xlf | 74 ++++++++++ .../Properties/xlf/Resources.ru.xlf | 74 ++++++++++ .../Properties/xlf/Resources.tr.xlf | 74 ++++++++++ .../Properties/xlf/Resources.zh-Hans.xlf | 74 ++++++++++ .../Properties/xlf/Resources.zh-Hant.xlf | 74 ++++++++++ src/System.CommandLine/Resources.cs | 36 +++++ 30 files changed, 1236 insertions(+), 85 deletions(-) rename src/System.CommandLine.Tests/{ValidationMessageLocalizationTests.cs => ResourceLocalizationTests.cs} (85%) diff --git a/src/System.CommandLine.Tests/Invocation/TypoCorrectionTests.cs b/src/System.CommandLine.Tests/Invocation/TypoCorrectionTests.cs index 1c1dd40c41..e1b88d499f 100644 --- a/src/System.CommandLine.Tests/Invocation/TypoCorrectionTests.cs +++ b/src/System.CommandLine.Tests/Invocation/TypoCorrectionTests.cs @@ -1,10 +1,10 @@ -using System.CommandLine.Builder; -using System.CommandLine.Invocation; +using FluentAssertions; +using System.CommandLine.Builder; using System.CommandLine.IO; using System.CommandLine.Parsing; using System.Threading.Tasks; -using FluentAssertions; using Xunit; +using static System.Environment; namespace System.CommandLine.Tests.Invocation { @@ -27,7 +27,7 @@ public async Task When_option_is_mistyped_it_is_suggested() await result.InvokeAsync(_console); - _console.Out.ToString().Should().Contain("'niof' was not matched. Did you mean 'info'?"); + _console.Out.ToString().Should().Contain($"'niof' was not matched. Did you mean one of the following?{NewLine}info"); } [Fact] @@ -63,7 +63,7 @@ public async Task When_command_is_mistyped_it_is_suggested() await result.InvokeAsync(_console); - _console.Out.ToString().Should().Contain("'sertor' was not matched. Did you mean 'restore'?"); + _console.Out.ToString().Should().Contain($"'sertor' was not matched. Did you mean one of the following?{NewLine}restore"); } [Fact] @@ -82,7 +82,7 @@ public async Task When_there_are_multiple_matches_it_picks_the_best_matches() await result.InvokeAsync(_console); - _console.Out.ToString().Should().Contain("'een' was not matched. Did you mean 'seen', or 'been'?"); + _console.Out.ToString().Should().Contain($"'een' was not matched. Did you mean one of the following?{NewLine}seen{NewLine}been"); } [Fact] @@ -100,7 +100,7 @@ public async Task Hidden_commands_are_not_suggested() await result.InvokeAsync(_console); - _console.Out.ToString().Should().Contain("'een' was not matched. Did you mean 'been'?"); + _console.Out.ToString().Should().Contain($"'een' was not matched. Did you mean one of the following?{NewLine}been"); } [Fact] @@ -134,7 +134,7 @@ public async Task Hidden_options_are_not_suggested() await result.InvokeAsync(_console); - _console.Out.ToString().Should().Contain("'een' was not matched. Did you mean 'been'?"); + _console.Out.ToString().Should().Contain($"'een' was not matched. Did you mean one of the following?{NewLine}been"); } [Fact] @@ -150,7 +150,7 @@ public async Task Suggestions_favor_matches_with_prefix() await result.InvokeAsync(_console); - _console.Out.ToString().Should().Contain("'-all' was not matched. Did you mean '-call'?"); + _console.Out.ToString().Should().Contain($"'-all' was not matched. Did you mean one of the following?{NewLine}-call"); } } } diff --git a/src/System.CommandLine.Tests/ValidationMessageLocalizationTests.cs b/src/System.CommandLine.Tests/ResourceLocalizationTests.cs similarity index 85% rename from src/System.CommandLine.Tests/ValidationMessageLocalizationTests.cs rename to src/System.CommandLine.Tests/ResourceLocalizationTests.cs index 9a7c7ab4c6..4ab9c17921 100644 --- a/src/System.CommandLine.Tests/ValidationMessageLocalizationTests.cs +++ b/src/System.CommandLine.Tests/ResourceLocalizationTests.cs @@ -10,12 +10,12 @@ namespace System.CommandLine.Tests { - public class ValidationMessageLocalizationTests + public class ResourceLocalizationTests { [Fact] public void Default_validation_messages_can_be_replaced_in_order_to_add_localization_support() { - var messages = new FakeValidationMessages("the-message"); + var messages = new FakeResources("the-message"); var command = new Command("the-command") { @@ -24,7 +24,7 @@ public void Default_validation_messages_can_be_replaced_in_order_to_add_localiza Arity = ArgumentArity.ExactlyOne } }; - var parser = new Parser(new CommandLineConfiguration(new[] { command }, validationMessages: messages)); + var parser = new Parser(new CommandLineConfiguration(new[] { command }, resources: messages)); var result = parser.Parse("the-command"); result.Errors @@ -36,7 +36,7 @@ public void Default_validation_messages_can_be_replaced_in_order_to_add_localiza [Fact] public void Default_validation_messages_can_be_replaced_using_CommandLineBuilder_in_order_to_add_localization_support() { - var messages = new FakeValidationMessages("the-message"); + var messages = new FakeResources("the-message"); var parser = new CommandLineBuilder(new Command("the-command") { @@ -45,7 +45,7 @@ public void Default_validation_messages_can_be_replaced_using_CommandLineBuilder Arity = ArgumentArity.ExactlyOne } }) - .UseValidationMessages(messages) + .UseResources(messages) .Build(); var result = parser.Parse("the-command"); @@ -56,11 +56,11 @@ public void Default_validation_messages_can_be_replaced_using_CommandLineBuilder .Contain("the-message"); } - public class FakeValidationMessages : Resources + public class FakeResources : Resources { private readonly string message; - public FakeValidationMessages(string message) + public FakeResources(string message) { this.message = message; } diff --git a/src/System.CommandLine/ArgumentArity.cs b/src/System.CommandLine/ArgumentArity.cs index 36c67d5fda..4f16c54e7e 100644 --- a/src/System.CommandLine/ArgumentArity.cs +++ b/src/System.CommandLine/ArgumentArity.cs @@ -71,14 +71,14 @@ public ArgumentArity(int minimumNumberOfValues, int maximumNumberOfValues) return new MissingArgumentConversionResult( argument, - symbolResult.ValidationMessages.RequiredArgumentMissing(symbolResult)); + symbolResult.Resources.RequiredArgumentMissing(symbolResult)); } if (tokenCount > maximumNumberOfValues) { return new TooManyArgumentsConversionResult( argument, - symbolResult!.ValidationMessages.ExpectsOneArgument(symbolResult)); + symbolResult!.Resources.ExpectsOneArgument(symbolResult)); } return null; diff --git a/src/System.CommandLine/ArgumentExtensions.cs b/src/System.CommandLine/ArgumentExtensions.cs index 24bb3fe3c5..08d05ad8d4 100644 --- a/src/System.CommandLine/ArgumentExtensions.cs +++ b/src/System.CommandLine/ArgumentExtensions.cs @@ -48,7 +48,7 @@ public static Argument ExistingOnly(this Argument argument) symbol.Tokens .Select(t => t.Value) .Where(filePath => !File.Exists(filePath)) - .Select(symbol.ValidationMessages.FileDoesNotExist) + .Select(symbol.Resources.FileDoesNotExist) .FirstOrDefault()); return argument; } @@ -59,7 +59,7 @@ public static Argument ExistingOnly(this Argument symbol.Tokens .Select(t => t.Value) .Where(filePath => !Directory.Exists(filePath)) - .Select(symbol.ValidationMessages.DirectoryDoesNotExist) + .Select(symbol.Resources.DirectoryDoesNotExist) .FirstOrDefault()); return argument; } @@ -70,7 +70,7 @@ public static Argument ExistingOnly(this Argument t.Value) .Where(filePath => !Directory.Exists(filePath) && !File.Exists(filePath)) - .Select(symbol.ValidationMessages.FileOrDirectoryDoesNotExist) + .Select(symbol.Resources.FileOrDirectoryDoesNotExist) .FirstOrDefault()); return argument; } @@ -84,7 +84,7 @@ public static Argument ExistingOnly(this Argument argument) a => a.Tokens .Select(t => t.Value) .Where(filePath => !File.Exists(filePath)) - .Select(a.ValidationMessages.FileDoesNotExist) + .Select(a.Resources.FileDoesNotExist) .FirstOrDefault()); } else if (typeof(IEnumerable).IsAssignableFrom(typeof(T))) @@ -93,7 +93,7 @@ public static Argument ExistingOnly(this Argument argument) a => a.Tokens .Select(t => t.Value) .Where(filePath => !Directory.Exists(filePath)) - .Select(a.ValidationMessages.DirectoryDoesNotExist) + .Select(a.Resources.DirectoryDoesNotExist) .FirstOrDefault()); } else @@ -102,7 +102,7 @@ public static Argument ExistingOnly(this Argument argument) a => a.Tokens .Select(t => t.Value) .Where(filePath => !Directory.Exists(filePath) && !File.Exists(filePath)) - .Select(a.ValidationMessages.FileOrDirectoryDoesNotExist) + .Select(a.Resources.FileOrDirectoryDoesNotExist) .FirstOrDefault()); } @@ -127,7 +127,7 @@ public static TArgument LegalFilePathsOnly( if (invalidCharactersIndex >= 0) { - return symbol.ValidationMessages.InvalidCharactersInPath(token.Value[invalidCharactersIndex]); + return symbol.Resources.InvalidCharactersInPath(token.Value[invalidCharactersIndex]); } } @@ -152,7 +152,7 @@ public static TArgument LegalFileNamesOnly( if (invalidCharactersIndex >= 0) { - return symbol.ValidationMessages.InvalidCharactersInFileName(token.Value[invalidCharactersIndex]); + return symbol.Resources.InvalidCharactersInFileName(token.Value[invalidCharactersIndex]); } } diff --git a/src/System.CommandLine/Binding/FailedArgumentTypeConversionResult.cs b/src/System.CommandLine/Binding/FailedArgumentTypeConversionResult.cs index 48463bb793..4dec848dee 100644 --- a/src/System.CommandLine/Binding/FailedArgumentTypeConversionResult.cs +++ b/src/System.CommandLine/Binding/FailedArgumentTypeConversionResult.cs @@ -23,23 +23,19 @@ private static string FormatErrorMessage( if (argument is Argument a && a.Parents.Count == 1) { - // TODO: (FailedArgumentTypeConversionResult) localize - var firstParent = (IIdentifierSymbol) a.Parents[0]; - - var symbolType = - firstParent switch { - ICommand _ => "command", - IOption _ => "option", - _ => null - }; - var alias = firstParent.Aliases.First(); - return $"Cannot parse argument '{value}' for {symbolType} '{alias}' as expected type {expectedType}."; + switch(firstParent) + { + case ICommand _: + return Resources.Instance.ArgumentConversionCannotParseForCommand(value, alias, expectedType); + case IOption _: + return Resources.Instance.ArgumentConversionCannotParseForOption(value, alias, expectedType); + } } - return $"Cannot parse argument '{value}' as expected type {expectedType}."; + return Resources.Instance.ArgumentConversionCannotParse(value, expectedType); } } } diff --git a/src/System.CommandLine/Builder/CommandLineBuilder.cs b/src/System.CommandLine/Builder/CommandLineBuilder.cs index bc98704a05..b0183e3565 100644 --- a/src/System.CommandLine/Builder/CommandLineBuilder.cs +++ b/src/System.CommandLine/Builder/CommandLineBuilder.cs @@ -30,7 +30,7 @@ public CommandLineBuilder(Command? rootCommand = null) internal HelpOption? HelpOption { get; set; } - internal Resources? ValidationMessages { get; set; } + internal Resources? Resources { get; set; } public Parser Build() { @@ -41,7 +41,7 @@ public Parser Build() new[] { rootCommand }, enablePosixBundling: EnablePosixBundling, enableDirectives: EnableDirectives, - validationMessages: ValidationMessages, + resources: Resources, responseFileHandling: ResponseFileHandling, middlewarePipeline: _middlewareList.OrderBy(m => m.order) .Select(m => m.middleware) diff --git a/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs b/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs index ebc545bbe5..db73085a3f 100644 --- a/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs +++ b/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs @@ -189,11 +189,11 @@ await feature.EnsureRegistered(async () => await dotnetSuggestProcess.CompleteAsync(); - return $"{dotnetSuggestProcess.StartInfo.FileName} exited with code {dotnetSuggestProcess.ExitCode}{NewLine}OUT:{NewLine}{stdOut}{NewLine}ERR:{NewLine}{stdErr}"; + return Resources.Instance.DotnetSuggestExitMessage(dotnetSuggestProcess.StartInfo.FileName, dotnetSuggestProcess.ExitCode, stdOut.ToString(), stdErr.ToString()); } catch (Exception exception) { - return $"Exception during registration:{NewLine}{exception}"; + return Resources.Instance.DotnetSuggestExceptionOccurred(exception); } finally { @@ -222,9 +222,7 @@ public static CommandLineBuilder UseDebugDirective( string debuggableProcessNames = GetEnvironmentVariable(environmentVariableName); if (string.IsNullOrWhiteSpace(debuggableProcessNames)) { - context.Console.Error.WriteLine("Debug directive specified, but no process names are listed as allowed for debug."); - context.Console.Error.WriteLine($"Add your process name to the '{environmentVariableName}' environment variable."); - context.Console.Error.WriteLine($"The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{environmentVariableName}={process.ProcessName}'"); + context.Console.Error.WriteLine(Resources.Instance.DebugDirectiveExecutableNotSpecified(environmentVariableName, process.ProcessName)); context.ExitCode = errorExitCode ?? 1; return; } @@ -234,9 +232,7 @@ public static CommandLineBuilder UseDebugDirective( if (processNames.Contains(process.ProcessName, StringComparer.Ordinal)) { var processId = process.Id; - - context.Console.Out.WriteLine($"Attach your debugger to process {processId} ({process.ProcessName})."); - var startTime = DateTime.Now; + context.Console.Out.WriteLine(Resources.Instance.DebugDirectiveAttachToProcess(processId, process.ProcessName)); while (!Debugger.IsAttached) { await Task.Delay(500); @@ -244,7 +240,7 @@ public static CommandLineBuilder UseDebugDirective( } else { - context.Console.Error.WriteLine($"Process name '{process.ProcessName}' is not included in the list of debuggable process names in the {environmentVariableName} environment variable ('{debuggableProcessNames}')"); + context.Console.Error.WriteLine(Resources.Instance.DebugDirectiveProcessNotIncludedInEnvironmentVariable(process.ProcessName, environmentVariableName, debuggableProcessNames)); context.ExitCode = errorExitCode ?? 1; return; } @@ -325,7 +321,7 @@ void Default(Exception exception, InvocationContext context) context.Console.ResetTerminalForegroundColor(); context.Console.SetTerminalForegroundRed(); - context.Console.Error.Write("Unhandled exception: "); + context.Console.Error.Write(Resources.Instance.ExceptionHandlerHeader()); context.Console.Error.WriteLine(exception.ToString()); context.Console.ResetTerminalForegroundColor(); @@ -506,11 +502,11 @@ public static CommandLineBuilder UseTypoCorrections( return builder; } - public static CommandLineBuilder UseValidationMessages( + public static CommandLineBuilder UseResources( this CommandLineBuilder builder, Resources validationMessages) { - builder.ValidationMessages = validationMessages; + builder.Resources = validationMessages; return builder; } @@ -527,12 +523,12 @@ public static CommandLineBuilder UseVersionOption( var versionOption = new Option( "--version", - description: "Show version information", + description: Resources.Instance.VersionOptionDescription(), parseArgument: result => { if (result.FindResultFor(command)?.Children.Count > 1) { - result.ErrorMessage = "--version option cannot be combined with other arguments."; + result.ErrorMessage = Resources.Instance.VersionOptionCannotBeCombinedWithOtherArguments("--version"); return false; } diff --git a/src/System.CommandLine/CommandLineConfiguration.cs b/src/System.CommandLine/CommandLineConfiguration.cs index f43f4aad9b..e95500dc42 100644 --- a/src/System.CommandLine/CommandLineConfiguration.cs +++ b/src/System.CommandLine/CommandLineConfiguration.cs @@ -25,7 +25,7 @@ public class CommandLineConfiguration /// The symbols to parse. /// true to enable POSIX bundling; otherwise, false. /// true to enable directive parsing; otherwise, false. - /// Provide custom validation messages. + /// Provide custom validation messages. /// One of the enumeration values that specifies how response files (.rsp) are handled. /// Provide a custom middleware pipeline. /// Provide a custom help builder. @@ -35,7 +35,7 @@ public CommandLineConfiguration( IReadOnlyList symbols, bool enablePosixBundling = true, bool enableDirectives = true, - Resources? validationMessages = null, + Resources? resources = null, ResponseFileHandling responseFileHandling = ResponseFileHandling.ParseArgsAsLineSeparated, IReadOnlyCollection? middlewarePipeline = null, Func? helpBuilderFactory = null, @@ -83,7 +83,7 @@ public CommandLineConfiguration( EnablePosixBundling = enablePosixBundling; EnableDirectives = enableDirectives; - ValidationMessages = validationMessages ?? Resources.Instance; + Resources = resources ?? Resources.Instance; ResponseFileHandling = responseFileHandling; Middleware = middlewarePipeline ?? new List(); HelpBuilderFactory = helpBuilderFactory ?? (context => @@ -146,9 +146,9 @@ private void AddGlobalOptionsToChildren(Command parentCommand) public bool EnablePosixBundling { get; } /// - /// Gets the validation messages. + /// Gets the localizable resources. /// - public Resources ValidationMessages { get; } + public Resources Resources { get; } internal Func HelpBuilderFactory { get; } diff --git a/src/System.CommandLine/Invocation/TypoCorrection.cs b/src/System.CommandLine/Invocation/TypoCorrection.cs index c3890ad9ea..09ef1a4bb6 100644 --- a/src/System.CommandLine/Invocation/TypoCorrection.cs +++ b/src/System.CommandLine/Invocation/TypoCorrection.cs @@ -27,11 +27,14 @@ public void ProvideSuggestions(ParseResult result, IConsole console) for (var i = 0; i < result.UnmatchedTokens.Count; i++) { var token = result.UnmatchedTokens[i]; - string suggestions = string.Join(", or ", GetPossibleTokens(result.CommandResult.Command, token).Select(x => $"'{x}'")); - - if (suggestions.Length > 0) + var suggestions = GetPossibleTokens(result.CommandResult.Command, token).ToList(); + if (suggestions.Count > 0) { - console.Out.WriteLine($"'{token}' was not matched. Did you mean {suggestions}?"); + console.Out.WriteLine(Resources.Instance.SuggestionsTokenNotMatched(token)); + foreach(string suggestion in suggestions) + { + console.Out.WriteLine(suggestion); + } } } } diff --git a/src/System.CommandLine/OptionExtensions.cs b/src/System.CommandLine/OptionExtensions.cs index 4e455c6efe..a3e58b3021 100644 --- a/src/System.CommandLine/OptionExtensions.cs +++ b/src/System.CommandLine/OptionExtensions.cs @@ -49,7 +49,7 @@ public static Option ExistingOnly(this Option option) a.Tokens .Select(t => t.Value) .Where(filePath => !File.Exists(filePath)) - .Select(a.ValidationMessages.FileDoesNotExist) + .Select(a.Resources.FileDoesNotExist) .FirstOrDefault()); return option; @@ -62,7 +62,7 @@ public static Option ExistingOnly(this Option opti a.Tokens .Select(t => t.Value) .Where(filePath => !Directory.Exists(filePath)) - .Select(a.ValidationMessages.DirectoryDoesNotExist) + .Select(a.Resources.DirectoryDoesNotExist) .FirstOrDefault()); return option; @@ -75,7 +75,7 @@ public static Option ExistingOnly(this Option op a.Tokens .Select(t => t.Value) .Where(filePath => !Directory.Exists(filePath) && !File.Exists(filePath)) - .Select(a.ValidationMessages.FileOrDirectoryDoesNotExist) + .Select(a.Resources.FileOrDirectoryDoesNotExist) .FirstOrDefault()); return option; diff --git a/src/System.CommandLine/Parsing/ParseResult.cs b/src/System.CommandLine/Parsing/ParseResult.cs index 8a6955cda1..560667b03a 100644 --- a/src/System.CommandLine/Parsing/ParseResult.cs +++ b/src/System.CommandLine/Parsing/ParseResult.cs @@ -61,7 +61,7 @@ internal ParseResult( for (var i = 0; i < unmatchedTokens.Count; i++) { var token = unmatchedTokens[i]; - _errors.Add(new ParseError(parser.Configuration.ValidationMessages.UnrecognizedCommandOrArgument(token.Value))); + _errors.Add(new ParseError(parser.Configuration.Resources.UnrecognizedCommandOrArgument(token.Value))); } } } diff --git a/src/System.CommandLine/Parsing/ParseResultVisitor.cs b/src/System.CommandLine/Parsing/ParseResultVisitor.cs index 8dca42cb05..ece4ae4add 100644 --- a/src/System.CommandLine/Parsing/ParseResultVisitor.cs +++ b/src/System.CommandLine/Parsing/ParseResultVisitor.cs @@ -52,7 +52,7 @@ protected override void VisitRootCommandNode(RootCommandNode rootCommandNode) _rootCommandResult = new RootCommandResult( rootCommandNode.Command, rootCommandNode.Token); - _rootCommandResult.ValidationMessages = _parser.Configuration.ValidationMessages; + _rootCommandResult.Resources = _parser.Configuration.Resources; _innermostCommandResult = _rootCommandResult; } @@ -290,7 +290,7 @@ private void ValidateCommandHandler() _errors.Insert( 0, new ParseError( - _innermostCommandResult.ValidationMessages.RequiredCommandWasNotProvided(), + _innermostCommandResult.Resources.RequiredCommandWasNotProvided(), _innermostCommandResult)); } diff --git a/src/System.CommandLine/Parsing/StringExtensions.cs b/src/System.CommandLine/Parsing/StringExtensions.cs index b8c6e306ce..24298f0d09 100644 --- a/src/System.CommandLine/Parsing/StringExtensions.cs +++ b/src/System.CommandLine/Parsing/StringExtensions.cs @@ -346,7 +346,7 @@ void ReadResponseFile(string filePath, int i) } catch (FileNotFoundException) { - var message = configuration.ValidationMessages + var message = configuration.Resources .ResponseFileNotFound(filePath); errorList.Add( @@ -354,7 +354,7 @@ void ReadResponseFile(string filePath, int i) } catch (IOException e) { - var message = configuration.ValidationMessages + var message = configuration.Resources .ErrorReadingResponseFile(filePath, e); errorList.Add( diff --git a/src/System.CommandLine/Parsing/SymbolResult.cs b/src/System.CommandLine/Parsing/SymbolResult.cs index 526a4f8a2d..db4264ceb3 100644 --- a/src/System.CommandLine/Parsing/SymbolResult.cs +++ b/src/System.CommandLine/Parsing/SymbolResult.cs @@ -8,7 +8,7 @@ namespace System.CommandLine.Parsing public abstract class SymbolResult { private protected readonly List _tokens = new List(); - private Resources? _validationMessages; + private Resources? _resources; private readonly Dictionary _defaultArgumentValues = new Dictionary(); private protected SymbolResult( @@ -53,10 +53,10 @@ internal int MaximumArgumentCapacity() return value; } - protected internal Resources ValidationMessages + protected internal Resources Resources { - get => _validationMessages ??= Parent?.ValidationMessages ?? Resources.Instance; - set => _validationMessages = value; + get => _resources ??= Parent?.Resources ?? Resources.Instance; + set => _resources = value; } internal void AddToken(Token token) => _tokens.Add(token); @@ -92,7 +92,7 @@ internal ArgumentResult GetOrCreateDefaultArgumentResult(Argument argument) => if (!argument.AllowedValues.Contains(token.Value)) { return new ParseError( - ValidationMessages + Resources .UnrecognizedArgument(token.Value, argument.AllowedValues), this); } diff --git a/src/System.CommandLine/Properties/Resources.Designer.cs b/src/System.CommandLine/Properties/Resources.Designer.cs index 4cb36de33c..d8050b55b7 100644 --- a/src/System.CommandLine/Properties/Resources.Designer.cs +++ b/src/System.CommandLine/Properties/Resources.Designer.cs @@ -60,6 +60,33 @@ internal Resources() { } } + /// + /// Looks up a localized string similar to Cannot parse argument '{0}' as expected type {1}.. + /// + internal static string ArgumentConversionCannotParse { + get { + return ResourceManager.GetString("ArgumentConversionCannotParse", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot parse argument '{0}' for command '{1}' as expected type {2}.. + /// + internal static string ArgumentConversionCannotParseForCommand { + get { + return ResourceManager.GetString("ArgumentConversionCannotParseForCommand", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot parse argument '{0}' for option '{1}' as expected type {2}.. + /// + internal static string ArgumentConversionCannotParseForOption { + get { + return ResourceManager.GetString("ArgumentConversionCannotParseForOption", resourceCulture); + } + } + /// /// Looks up a localized string similar to Command '{0}' expects no more than {1} arguments, but {2} were provided.. /// @@ -96,6 +123,35 @@ internal static string CommandRequiredArgumentMissing { } } + /// + /// Looks up a localized string similar to Attach your debugger to process {0} ({1}).. + /// + internal static string DebugDirectiveAttachToProcess { + get { + return ResourceManager.GetString("DebugDirectiveAttachToProcess", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Debug directive specified, but no process names are listed as allowed for debug. + ///Add your process name to the '{0}' environment variable. + ///The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'. + /// + internal static string DebugDirectiveExecutableNotSpecified { + get { + return ResourceManager.GetString("DebugDirectiveExecutableNotSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}'). + /// + internal static string DebugDirectiveProcessNotIncludedInEnvironmentVariable { + get { + return ResourceManager.GetString("DebugDirectiveProcessNotIncludedInEnvironmentVariable", resourceCulture); + } + } + /// /// Looks up a localized string similar to Directory does not exist: {0}. /// @@ -105,6 +161,29 @@ internal static string DirectoryDoesNotExist { } } + /// + /// Looks up a localized string similar to Exception during registration: + ///{0}. + /// + internal static string DotnetSuggestExceptionOccurred { + get { + return ResourceManager.GetString("DotnetSuggestExceptionOccurred", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} exited with code {1} + ///OUT: + ///{2} + ///ERR: + ///{3}. + /// + internal static string DotnetSuggestExitMessage { + get { + return ResourceManager.GetString("DotnetSuggestExitMessage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Error reading response file '{0}': {1}. /// @@ -114,6 +193,15 @@ internal static string ErrorReadingResponseFile { } } + /// + /// Looks up a localized string similar to Unhandled exception: . + /// + internal static string ExceptionHandlerHeader { + get { + return ResourceManager.GetString("ExceptionHandlerHeader", resourceCulture); + } + } + /// /// Looks up a localized string similar to File does not exist: {0}. /// @@ -186,15 +274,6 @@ internal static string HelpOptionDescription { } } - /// - /// Looks up a localized string similar to Character not allowed in a file name: {0}. - /// - internal static string InvalidCharactersInFileName { - get { - return ResourceManager.GetString("InvalidCharactersInFileName", resourceCulture); - } - } - /// /// Looks up a localized string similar to (REQUIRED). /// @@ -249,6 +328,15 @@ internal static string HelpUsageTile { } } + /// + /// Looks up a localized string similar to Character not allowed in a file name: {0}. + /// + internal static string InvalidCharactersInFileName { + get { + return ResourceManager.GetString("InvalidCharactersInFileName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Character not allowed in a path: {0}. /// @@ -312,6 +400,15 @@ internal static string ResponseFileNotFound { } } + /// + /// Looks up a localized string similar to '{0}' was not matched. Did you mean one of the following?. + /// + internal static string SuggestionsTokenNotMatched { + get { + return ResourceManager.GetString("SuggestionsTokenNotMatched", resourceCulture); + } + } + /// /// Looks up a localized string similar to Argument '{0}' not recognized. Must be one of:{1}. /// @@ -329,5 +426,23 @@ internal static string UnrecognizedCommandOrArgument { return ResourceManager.GetString("UnrecognizedCommandOrArgument", resourceCulture); } } + + /// + /// Looks up a localized string similar to {0} option cannot be combined with other arguments.. + /// + internal static string VersionOptionCannotBeCombinedWithOtherArguments { + get { + return ResourceManager.GetString("VersionOptionCannotBeCombinedWithOtherArguments", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Show version information. + /// + internal static string VersionOptionDescription { + get { + return ResourceManager.GetString("VersionOptionDescription", resourceCulture); + } + } } } diff --git a/src/System.CommandLine/Properties/Resources.resx b/src/System.CommandLine/Properties/Resources.resx index 6d1211e6e8..6d4a45d666 100644 --- a/src/System.CommandLine/Properties/Resources.resx +++ b/src/System.CommandLine/Properties/Resources.resx @@ -207,4 +207,47 @@ Commands: + + Attach your debugger to process {0} ({1}). + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + + Unhandled exception: + + + '{0}' was not matched. Did you mean one of the following? + + + {0} option cannot be combined with other arguments. + + + Show version information + + + Cannot parse argument '{0}' as expected type {1}. + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + + Exception during registration: +{0} + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.cs.xlf b/src/System.CommandLine/Properties/xlf/Resources.cs.xlf index 405190a322..206fa5677d 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.cs.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.cs.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.de.xlf b/src/System.CommandLine/Properties/xlf/Resources.de.xlf index 4c6eaf88b6..7256081f54 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.de.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.de.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.es.xlf b/src/System.CommandLine/Properties/xlf/Resources.es.xlf index d1f47ad523..d09d2079f8 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.es.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.es.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.fr.xlf b/src/System.CommandLine/Properties/xlf/Resources.fr.xlf index a8f96ae484..0c79aa62e0 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.fr.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.fr.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.it.xlf b/src/System.CommandLine/Properties/xlf/Resources.it.xlf index bde4c86039..e33bfb9598 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.it.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.it.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.ja.xlf b/src/System.CommandLine/Properties/xlf/Resources.ja.xlf index 5be4c85e55..5cdc16dd03 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ja.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ja.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.ko.xlf b/src/System.CommandLine/Properties/xlf/Resources.ko.xlf index 3d840d376e..ddb5222e7b 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ko.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ko.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.pl.xlf b/src/System.CommandLine/Properties/xlf/Resources.pl.xlf index a5816ac357..60079de275 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.pl.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.pl.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf b/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf index abe3151759..2edc11e872 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.ru.xlf b/src/System.CommandLine/Properties/xlf/Resources.ru.xlf index 3a46385743..0a016f3239 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ru.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ru.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.tr.xlf b/src/System.CommandLine/Properties/xlf/Resources.tr.xlf index 848e7a89fd..656eac859d 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.tr.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.tr.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf b/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf index 473b4274f2..703a2d116c 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf b/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf index e50c2d169c..9e2b5ceb50 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf @@ -2,6 +2,21 @@ + + Cannot parse argument '{0}' as expected type {1}. + Cannot parse argument '{0}' as expected type {1}. + + + + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + Cannot parse argument '{0}' for command '{1}' as expected type {2}. + + + + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + Cannot parse argument '{0}' for option '{1}' as expected type {2}. + + Command '{0}' expects no more than {1} arguments, but {2} were provided. Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -22,16 +37,60 @@ Required argument missing for command: {0} + + Attach your debugger to process {0} ({1}). + Attach your debugger to process {0} ({1}). + + + + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + Debug directive specified, but no process names are listed as allowed for debug. +Add your process name to the '{0}' environment variable. +The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}' + + + + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}') + + Directory does not exist: {0} Directory does not exist: {0} + + Exception during registration: +{0} + Exception during registration: +{0} + + + + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + {0} exited with code {1} +OUT: +{2} +ERR: +{3} + + Error reading response file '{0}': {1} Error reading response file '{0}': {1} + + Unhandled exception: + Unhandled exception: + + File does not exist: {0} File does not exist: {0} @@ -142,6 +201,11 @@ Response file not found '{0}' + + '{0}' was not matched. Did you mean one of the following? + '{0}' was not matched. Did you mean one of the following? + + Argument '{0}' not recognized. Must be one of:{1} Argument '{0}' not recognized. Must be one of:{1} @@ -152,6 +216,16 @@ Unrecognized command or argument '{0}' + + {0} option cannot be combined with other arguments. + {0} option cannot be combined with other arguments. + + + + Show version information + Show version information + + \ No newline at end of file diff --git a/src/System.CommandLine/Resources.cs b/src/System.CommandLine/Resources.cs index e2e9c0136c..a99a24851d 100644 --- a/src/System.CommandLine/Resources.cs +++ b/src/System.CommandLine/Resources.cs @@ -105,6 +105,42 @@ public virtual string HelpAdditionalArgumentsTitle() => public virtual string HelpAdditionalArgumentsDescription() => GetResourceString(Properties.Resources.HelpAdditionalArgumentsDescription); + public virtual string SuggestionsTokenNotMatched(string token) + => GetResourceString(Properties.Resources.SuggestionsTokenNotMatched, token); + + public virtual string VersionOptionDescription() + => GetResourceString(Properties.Resources.VersionOptionDescription); + + public virtual string VersionOptionCannotBeCombinedWithOtherArguments(string optionAlias) + => GetResourceString(Properties.Resources.VersionOptionCannotBeCombinedWithOtherArguments, optionAlias); + + public virtual string ExceptionHandlerHeader() + => GetResourceString(Properties.Resources.ExceptionHandlerHeader); + + public virtual string DebugDirectiveExecutableNotSpecified(string environmentVariableName, string processName) + => GetResourceString(Properties.Resources.DebugDirectiveExecutableNotSpecified, environmentVariableName, processName); + + public virtual string DebugDirectiveAttachToProcess(int processId, string processName) + => GetResourceString(Properties.Resources.DebugDirectiveAttachToProcess, processId, processName); + + public virtual string DebugDirectiveProcessNotIncludedInEnvironmentVariable(string processName, string environmentVariableName, string processNames) + => GetResourceString(Properties.Resources.DebugDirectiveProcessNotIncludedInEnvironmentVariable, processName, environmentVariableName, processNames); + + public virtual string DotnetSuggestExceptionOccurred(Exception exception) + => GetResourceString(Properties.Resources.DotnetSuggestExceptionOccurred, exception); + + public virtual string DotnetSuggestExitMessage(string dotnetSuggestName, int exitCode, string standardOut, string standardError) + => GetResourceString(Properties.Resources.DotnetSuggestExitMessage, dotnetSuggestName, exitCode, standardOut, standardError); + + public virtual string ArgumentConversionCannotParse(string value, Type expectedType) + => GetResourceString(Properties.Resources.ArgumentConversionCannotParse, value, expectedType); + + public virtual string ArgumentConversionCannotParseForCommand(string value, string commandAlias, Type expectedType) + => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForCommand, value, commandAlias, expectedType); + + public virtual string ArgumentConversionCannotParseForOption(string value, string optionAlias, Type expectedType) + => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForOption, value, optionAlias, expectedType); + protected virtual string GetResourceString(string resourceString, params object[] formatArguments) { if (resourceString is null)