From 1339e19b94c411ba3432d79e0731514b0c15a43d Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 2 Feb 2023 19:54:35 +0100 Subject: [PATCH 1/7] make LocalizationResources internal and static --- ...ommandLine_api_is_not_changed.approved.txt | 49 +--------- .../Help/HelpBuilderTests.Customization.cs | 24 ++--- .../Help/HelpBuilderTests.cs | 31 +------ .../Invocation/InvocationPipelineTests.cs | 2 +- .../OptionTests.MultipleArgumentsPerToken.cs | 2 +- .../ParserTests.MultipleArguments.cs | 2 +- .../ParserTests.RootCommandAndArg0.cs | 2 +- src/System.CommandLine.Tests/ParserTests.cs | 10 +- .../ParsingValidationTests.cs | 18 ++-- src/System.CommandLine/ArgumentArity.cs | 4 +- src/System.CommandLine/Argument{T}.cs | 6 +- .../Binding/ArgumentConversionResult.cs | 10 +- .../Binding/ArgumentConverter.cs | 4 +- .../Builder/CommandLineBuilder.cs | 8 -- .../Builder/CommandLineBuilderExtensions.cs | 22 +---- .../CommandLineConfiguration.cs | 11 +-- .../Help/HelpBuilder.Default.cs | 10 +- src/System.CommandLine/Help/HelpBuilder.cs | 12 +-- src/System.CommandLine/Help/HelpOption.cs | 10 +- src/System.CommandLine/Help/VersionOption.cs | 4 +- .../Invocation/InvocationContext.cs | 5 - .../Invocation/TypoCorrection.cs | 2 +- .../LocalizationResources.cs | 92 ++++++++----------- src/System.CommandLine/ParseResult.cs | 2 +- .../Parsing/ParseOperation.cs | 2 +- .../Parsing/StringExtensions.cs | 5 +- .../Parsing/SymbolResult.cs | 5 - .../Parsing/SymbolResultTree.cs | 5 +- src/System.CommandLine/Validate.cs | 6 +- 29 files changed, 107 insertions(+), 258 deletions(-) diff --git a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt index 46238e35f8..7a6ad1dfed 100644 --- a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt +++ b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt @@ -82,7 +82,6 @@ System.CommandLine public static CommandLineBuilder UseHelp(this CommandLineBuilder builder, System.String[] helpAliases) public static CommandLineBuilder UseHelp(this CommandLineBuilder builder, System.Action customize, System.Nullable maxWidth = null) public static TBuilder UseHelpBuilder(this TBuilder builder, System.Func getHelpBuilder) - public static CommandLineBuilder UseLocalizationResources(this CommandLineBuilder builder, LocalizationResources validationMessages) public static CommandLineBuilder UseParseDirective(this CommandLineBuilder builder, System.Nullable errorExitCode = null) public static CommandLineBuilder UseParseErrorReporting(this CommandLineBuilder builder, System.Nullable errorExitCode = null) public static CommandLineBuilder UseSuggestDirective(this CommandLineBuilder builder) @@ -91,11 +90,10 @@ System.CommandLine public static CommandLineBuilder UseVersionOption(this CommandLineBuilder builder) public static CommandLineBuilder UseVersionOption(this CommandLineBuilder builder, System.String[] aliases) public class CommandLineConfiguration - .ctor(Command command, System.Boolean enablePosixBundling = True, System.Boolean enableDirectives = True, System.Boolean enableTokenReplacement = True, LocalizationResources resources = null, System.Collections.Generic.IReadOnlyList middlewarePipeline = null, System.Func helpBuilderFactory = null, System.CommandLine.Parsing.TryReplaceToken tokenReplacer = null) + .ctor(Command command, System.Boolean enablePosixBundling = True, System.Boolean enableDirectives = True, System.Boolean enableTokenReplacement = True, System.Collections.Generic.IReadOnlyList middlewarePipeline = null, System.Func helpBuilderFactory = null, System.CommandLine.Parsing.TryReplaceToken tokenReplacer = null) public System.Boolean EnableDirectives { get; } public System.Boolean EnablePosixBundling { get; } public System.Boolean EnableTokenReplacement { get; } - public LocalizationResources LocalizationResources { get; } public Command RootCommand { get; } public System.Void ThrowIfInvalid() public class CommandLineConfigurationException : System.Exception, System.Runtime.Serialization.ISerializable @@ -142,46 +140,6 @@ System.CommandLine public System.Collections.Generic.IReadOnlyCollection Aliases { get; } public System.Void AddAlias(System.String alias) public System.Boolean HasAlias(System.String alias) - public class LocalizationResources - public static LocalizationResources Instance { get; } - public System.String ArgumentConversionCannotParse(System.String value, System.Type expectedType) - public System.String ArgumentConversionCannotParseForCommand(System.String value, System.String commandAlias, System.Type expectedType) - public System.String ArgumentConversionCannotParseForCommand(System.String value, System.String commandAlias, System.Type expectedType, System.Collections.Generic.IEnumerable completions) - public System.String ArgumentConversionCannotParseForOption(System.String value, System.String optionAlias, System.Type expectedType) - public System.String ArgumentConversionCannotParseForOption(System.String value, System.String optionAlias, System.Type expectedType, System.Collections.Generic.IEnumerable completions) - public System.String DirectoryDoesNotExist(System.String path) - public System.String ErrorReadingResponseFile(System.String filePath, System.IO.IOException e) - public System.String ExceptionHandlerHeader() - public System.String ExpectsFewerArguments(System.CommandLine.Parsing.Token token, System.Int32 providedNumberOfValues, System.Int32 maximumNumberOfValues) - public System.String ExpectsOneArgument(System.CommandLine.Parsing.SymbolResult symbolResult) - public System.String FileDoesNotExist(System.String filePath) - public System.String FileOrDirectoryDoesNotExist(System.String path) - protected System.String GetResourceString(System.String resourceString, System.Object[] formatArguments) - public System.String HelpAdditionalArgumentsDescription() - public System.String HelpAdditionalArgumentsTitle() - public System.String HelpArgumentDefaultValueLabel() - public System.String HelpArgumentsTitle() - public System.String HelpCommandsTitle() - public System.String HelpDescriptionTitle() - public System.String HelpOptionDescription() - public System.String HelpOptionsRequiredLabel() - public System.String HelpOptionsTitle() - public System.String HelpUsageAdditionalArguments() - public System.String HelpUsageCommand() - public System.String HelpUsageOptions() - public System.String HelpUsageTitle() - public System.String InvalidCharactersInFileName(System.Char invalidChar) - public System.String InvalidCharactersInPath(System.Char invalidChar) - public System.String NoArgumentProvided(System.CommandLine.Parsing.SymbolResult symbolResult) - public System.String RequiredArgumentMissing(System.CommandLine.Parsing.SymbolResult symbolResult) - public System.String RequiredCommandWasNotProvided() - public System.String RequiredOptionWasNotProvided(Option option) - public System.String ResponseFileNotFound(System.String filePath) - public System.String SuggestionsTokenNotMatched(System.String token) - public System.String UnrecognizedArgument(System.String unrecognizedArg, System.Collections.Generic.IReadOnlyCollection allowedValues) - public System.String UnrecognizedCommandOrArgument(System.String arg) - public System.String VersionOptionCannotBeCombinedWithOtherArguments(System.String optionAlias) - public System.String VersionOptionDescription() public abstract class Option : IdentifierSymbol, System.CommandLine.Binding.IValueDescriptor public System.Boolean AllowMultipleArgumentsPerToken { get; set; } public System.String ArgumentHelpName { get; set; } @@ -286,8 +244,7 @@ System.CommandLine.Completions public class TokenCompletionContext : CompletionContext System.CommandLine.Help public class HelpBuilder - .ctor(System.CommandLine.LocalizationResources localizationResources, System.Int32 maxWidth = 2147483647) - public System.CommandLine.LocalizationResources LocalizationResources { get; } + .ctor(System.Int32 maxWidth = 2147483647) public System.Int32 MaxWidth { get; } public System.Void CustomizeLayout(System.Func>> getLayout) public System.Void CustomizeSymbol(System.CommandLine.Symbol symbol, System.Func firstColumnText = null, System.Func secondColumnText = null, System.Func defaultValue = null) @@ -331,7 +288,6 @@ System.CommandLine.Invocation public System.Int32 ExitCode { get; set; } public System.CommandLine.Help.HelpBuilder HelpBuilder { get; } public System.Action InvocationResult { get; set; } - public System.CommandLine.LocalizationResources LocalizationResources { get; } public System.CommandLine.Parsing.Parser Parser { get; } public System.CommandLine.ParseResult ParseResult { get; set; } public System.Threading.CancellationToken GetCancellationToken() @@ -426,7 +382,6 @@ System.CommandLine.Parsing public static System.Threading.Tasks.Task InvokeAsync(this Parser parser, System.String[] args, System.CommandLine.IConsole console = null, System.Threading.CancellationToken cancellationToken = null) public static System.CommandLine.ParseResult Parse(this Parser parser, System.String commandLine) public abstract class SymbolResult - public System.CommandLine.LocalizationResources LocalizationResources { get; } public SymbolResult Parent { get; } public System.Collections.Generic.IReadOnlyList Tokens { get; } public System.Void AddError(System.String errorMessage) diff --git a/src/System.CommandLine.Tests/Help/HelpBuilderTests.Customization.cs b/src/System.CommandLine.Tests/Help/HelpBuilderTests.Customization.cs index 7979bb0a09..f0fa6764ed 100644 --- a/src/System.CommandLine.Tests/Help/HelpBuilderTests.Customization.cs +++ b/src/System.CommandLine.Tests/Help/HelpBuilderTests.Customization.cs @@ -28,9 +28,7 @@ public Customization() _indentation = new string(' ', IndentationWidth); } - private HelpBuilder GetHelpBuilder(int maxWidth) => - new(LocalizationResources.Instance, - maxWidth); + private HelpBuilder GetHelpBuilder(int maxWidth) => new (maxWidth); [Fact] public void Option_can_customize_default_value() @@ -89,7 +87,7 @@ public void Option_can_customize_first_column_text_based_on_parse_result() var optionAFirstColumnText = "option a help"; var optionBFirstColumnText = "option b help"; - var helpBuilder = new HelpBuilder(LocalizationResources.Instance, LargeMaxWidth); + var helpBuilder = new HelpBuilder(LargeMaxWidth); helpBuilder.CustomizeSymbol(option, firstColumnText: ctx => ctx.Command.Equals(commandA) ? optionAFirstColumnText @@ -127,7 +125,7 @@ public void Option_can_customize_second_column_text_based_on_parse_result() var optionADescription = "option a help"; var optionBDescription = "option b help"; - var helpBuilder = new HelpBuilder(LocalizationResources.Instance, LargeMaxWidth); + var helpBuilder = new HelpBuilder(LargeMaxWidth); helpBuilder.CustomizeSymbol(option, secondColumnText: ctx => ctx.Command.Equals(commandA) ? optionADescription @@ -226,7 +224,7 @@ public void Command_arguments_can_customize_default_value() [Fact] public void Customize_throws_when_symbol_is_null() { - Action action = () => new HelpBuilder(LocalizationResources.Instance).CustomizeSymbol(null!, ""); + Action action = () => new HelpBuilder().CustomizeSymbol(null!, ""); action.Should().Throw(); } @@ -243,7 +241,7 @@ public void Option_can_fallback_to_default_when_customizing(bool conditionA, boo command.Options.Add(option); - var helpBuilder = new HelpBuilder(LocalizationResources.Instance, LargeMaxWidth); + var helpBuilder = new HelpBuilder(LargeMaxWidth); helpBuilder.CustomizeSymbol(option, firstColumnText: ctx => conditionA ? "custom 1st" : HelpBuilder.Default.GetIdentifierSymbolUsageLabel(option, ctx), secondColumnText: ctx => conditionB ? "custom 2nd" : HelpBuilder.Default.GetIdentifierSymbolDescription(option)); @@ -280,7 +278,7 @@ public void Argument_can_fallback_to_default_when_customizing( command.Arguments.Add(argument); - var helpBuilder = new HelpBuilder(LocalizationResources.Instance, LargeMaxWidth); + var helpBuilder = new HelpBuilder(LargeMaxWidth); helpBuilder.CustomizeSymbol(argument, firstColumnText: ctx => conditionA ? "custom 1st" : HelpBuilder.Default.GetArgumentUsageLabel(argument), secondColumnText: ctx => conditionB ? "custom 2nd" : HelpBuilder.Default.GetArgumentDescription(argument), @@ -297,15 +295,5 @@ public void Argument_can_fallback_to_default_when_customizing( console.Out.ToString().Should().MatchRegex(expected); } } - - private class CustomLocalizationResources : LocalizationResources - { - public string OverrideHelpDescriptionTitle { get; set; } - - public override string HelpDescriptionTitle() - { - return OverrideHelpDescriptionTitle ?? base.HelpDescriptionTitle(); - } - } } } \ No newline at end of file diff --git a/src/System.CommandLine.Tests/Help/HelpBuilderTests.cs b/src/System.CommandLine.Tests/Help/HelpBuilderTests.cs index 25d00ccd57..b8076fe9bc 100644 --- a/src/System.CommandLine.Tests/Help/HelpBuilderTests.cs +++ b/src/System.CommandLine.Tests/Help/HelpBuilderTests.cs @@ -33,9 +33,7 @@ public HelpBuilderTests() _executableName = RootCommand.ExecutableName; } - private HelpBuilder GetHelpBuilder(int maxWidth = SmallMaxWidth) => - new(LocalizationResources.Instance, - maxWidth); + private HelpBuilder GetHelpBuilder(int maxWidth = SmallMaxWidth) => new(maxWidth); #region Synopsis @@ -93,26 +91,6 @@ public void Command_name_in_synopsis_can_be_specified() _console.ToString().Should().NotContain(_executableName); } - [Fact] - public void Synopsis_section_properly_uses_localized_HelpDescriptionTitle() - { - var command = new RootCommand("test description"); - - var customLocalization = new CustomLocalizationResources - { - OverrideHelpDescriptionTitle = "Custom Description:" - }; - HelpBuilder helpBuilder = new( - customLocalization, - LargeMaxWidth - ); - helpBuilder.Write(command, _console); - - var expected = $"Custom Description:{NewLine}{_indentation}test description{NewLine}"; - - _console.ToString().Should().Contain(expected); - } - #endregion Synopsis #region Usage @@ -146,7 +124,7 @@ public void Usage_section_shows_arguments_if_there_are_arguments_for_command_whe var rootCommand = new RootCommand(); rootCommand.Subcommands.Add(command); - new HelpBuilder(LocalizationResources.Instance, LargeMaxWidth).Write(command, _console); + new HelpBuilder(LargeMaxWidth).Write(command, _console); var expected = $"Usage:{NewLine}" + @@ -1638,7 +1616,7 @@ public void Help_describes_default_values_for_subcommand_with_multiple_defaultab [InlineData(int.MinValue)] public void Constructor_ignores_non_positive_max_width(int maxWidth) { - var helpBuilder = new HelpBuilder(LocalizationResources.Instance, maxWidth); + var helpBuilder = new HelpBuilder(maxWidth); Assert.Equal(int.MaxValue, helpBuilder.MaxWidth); } @@ -1651,14 +1629,13 @@ public void Commands_without_arguments_do_not_produce_extra_newlines_between_usa }; var helpBuilder = GetHelpBuilder(); - var resources = helpBuilder.LocalizationResources; using var writer = new StringWriter(); helpBuilder.Write(command, writer); var output = writer.ToString(); - output.Should().Contain($"{resources.HelpUsageOptions()}{NewLine}{NewLine}{resources.HelpOptionsTitle()}"); + output.Should().Contain($"{LocalizationResources.HelpUsageOptions()}{NewLine}{NewLine}{LocalizationResources.HelpOptionsTitle()}"); } } } diff --git a/src/System.CommandLine.Tests/Invocation/InvocationPipelineTests.cs b/src/System.CommandLine.Tests/Invocation/InvocationPipelineTests.cs index d67eda24d4..945e656ebf 100644 --- a/src/System.CommandLine.Tests/Invocation/InvocationPipelineTests.cs +++ b/src/System.CommandLine.Tests/Invocation/InvocationPipelineTests.cs @@ -320,7 +320,7 @@ public async Task When_help_builder_factory_is_specified_it_is_used_to_create_th .UseHelpBuilder(context => { factoryWasCalled = true; - return createdHelpBuilder = new HelpBuilder(context.ParseResult.Parser.Configuration.LocalizationResources); + return createdHelpBuilder = new HelpBuilder(); }) .Build(); diff --git a/src/System.CommandLine.Tests/OptionTests.MultipleArgumentsPerToken.cs b/src/System.CommandLine.Tests/OptionTests.MultipleArgumentsPerToken.cs index 881975de3f..ee24d691c0 100644 --- a/src/System.CommandLine.Tests/OptionTests.MultipleArgumentsPerToken.cs +++ b/src/System.CommandLine.Tests/OptionTests.MultipleArgumentsPerToken.cs @@ -191,7 +191,7 @@ public void Subsequent_matched_arguments_result_in_errors() var result = command.Parse("--option 1 2"); result.UnmatchedTokens.Should().BeEquivalentTo(new[] { "2" }); - result.Errors.Should().Contain(e => e.Message == LocalizationResources.Instance.UnrecognizedCommandOrArgument("2")); + result.Errors.Should().Contain(e => e.Message == LocalizationResources.UnrecognizedCommandOrArgument("2")); } [Fact] diff --git a/src/System.CommandLine.Tests/ParserTests.MultipleArguments.cs b/src/System.CommandLine.Tests/ParserTests.MultipleArguments.cs index 331f8d6515..27a1abdce7 100644 --- a/src/System.CommandLine.Tests/ParserTests.MultipleArguments.cs +++ b/src/System.CommandLine.Tests/ParserTests.MultipleArguments.cs @@ -307,7 +307,7 @@ public void When_there_are_not_enough_tokens_for_all_arguments_then_the_correct_ var numberOfMissingArgs = result .Errors - .Count(e => e.Message == LocalizationResources.Instance.RequiredArgumentMissing(result.CommandResult)); + .Count(e => e.Message == LocalizationResources.RequiredArgumentMissing(result.CommandResult)); numberOfMissingArgs .Should() diff --git a/src/System.CommandLine.Tests/ParserTests.RootCommandAndArg0.cs b/src/System.CommandLine.Tests/ParserTests.RootCommandAndArg0.cs index 1e2819c22c..b46fc1d62f 100644 --- a/src/System.CommandLine.Tests/ParserTests.RootCommandAndArg0.cs +++ b/src/System.CommandLine.Tests/ParserTests.RootCommandAndArg0.cs @@ -46,7 +46,7 @@ public void When_parsing_a_string_array_input_then_a_full_path_to_an_executable_ parserResult .Errors .Should() - .ContainSingle(e => e.Message == LocalizationResources.Instance.UnrecognizedCommandOrArgument(RootCommand.ExecutablePath)); + .ContainSingle(e => e.Message == LocalizationResources.UnrecognizedCommandOrArgument(RootCommand.ExecutablePath)); } [Fact] diff --git a/src/System.CommandLine.Tests/ParserTests.cs b/src/System.CommandLine.Tests/ParserTests.cs index 127f228cdf..fc8afed147 100644 --- a/src/System.CommandLine.Tests/ParserTests.cs +++ b/src/System.CommandLine.Tests/ParserTests.cs @@ -66,7 +66,7 @@ public void When_a_token_is_just_a_prefix_then_an_error_is_returned(string prefi result.Errors .Select(e => e.Message) .Should() - .Contain(LocalizationResources.Instance.UnrecognizedCommandOrArgument(prefix)); + .Contain(LocalizationResources.UnrecognizedCommandOrArgument(prefix)); } [Fact] @@ -1410,7 +1410,7 @@ public void When_command_arguments_are_fewer_than_minimum_arity_then_an_error_is result.Errors .Select(e => e.Message) .Should() - .Contain(LocalizationResources.Instance.RequiredArgumentMissing(result.CommandResult)); + .Contain(LocalizationResources.RequiredArgumentMissing(result.CommandResult)); } [Fact] @@ -1430,7 +1430,7 @@ public void When_command_arguments_are_greater_than_maximum_arity_then_an_error_ .Errors .Select(e => e.Message) .Should() - .Contain(LocalizationResources.Instance.UnrecognizedCommandOrArgument("4")); + .Contain(LocalizationResources.UnrecognizedCommandOrArgument("4")); } [Fact] @@ -1498,7 +1498,7 @@ public void When_option_arguments_are_fewer_than_minimum_arity_then_an_error_is_ result.Errors .Select(e => e.Message) .Should() - .Contain(LocalizationResources.Instance.RequiredArgumentMissing(result.CommandResult.FindResultFor(option))); + .Contain(LocalizationResources.RequiredArgumentMissing(result.CommandResult.FindResultFor(option))); } [Fact] @@ -1513,7 +1513,7 @@ public void When_option_arguments_are_greater_than_maximum_arity_then_an_error_i .Errors .Select(e => e.Message) .Should() - .Contain(LocalizationResources.Instance.UnrecognizedCommandOrArgument("4")); + .Contain(LocalizationResources.UnrecognizedCommandOrArgument("4")); } [Fact] diff --git a/src/System.CommandLine.Tests/ParsingValidationTests.cs b/src/System.CommandLine.Tests/ParsingValidationTests.cs index 66ce605324..597e5ad463 100644 --- a/src/System.CommandLine.Tests/ParsingValidationTests.cs +++ b/src/System.CommandLine.Tests/ParsingValidationTests.cs @@ -65,7 +65,7 @@ public void When_FromAmong_is_used_then_the_OptionResult_ErrorMessage_is_set() error .Message .Should() - .Be(parseResult.CommandResult.LocalizationResources.UnrecognizedArgument("c", new []{ "a", "b"})); + .Be(LocalizationResources.UnrecognizedArgument("c", new []{ "a", "b"})); error .SymbolResult .Should() @@ -88,7 +88,7 @@ public void When_FromAmong_is_used_then_the_ArgumentResult_ErrorMessage_is_set() error .Message .Should() - .Be(parseResult.CommandResult.LocalizationResources.UnrecognizedArgument("c", new []{ "a", "b"})); + .Be(LocalizationResources.UnrecognizedArgument("c", new []{ "a", "b"})); error .SymbolResult .Should() @@ -126,7 +126,7 @@ public void When_FromAmong_is_used_for_multiple_arguments_and_invalid_input_is_p .Which .Message .Should() - .Be(LocalizationResources.Instance.UnrecognizedArgument("not-key1", new[] { "key1", "key2" })); + .Be(LocalizationResources.UnrecognizedArgument("not-key1", new[] { "key1", "key2" })); } [Fact] @@ -148,7 +148,7 @@ public void When_FromAmong_is_used_multiple_times_only_the_most_recently_provide .Which .Message .Should() - .Be(LocalizationResources.Instance.UnrecognizedArgument("key2", new[] { "key1" })); + .Be(LocalizationResources.UnrecognizedArgument("key2", new[] { "key1" })); argument.AcceptOnlyFromAmong("key2"); @@ -174,7 +174,7 @@ public void When_FromAmong_is_used_for_multiple_arguments_and_invalid_input_is_p .Which .Message .Should() - .Be(LocalizationResources.Instance.UnrecognizedArgument("not-value1", new[] { "value1", "value2" })); + .Be(LocalizationResources.UnrecognizedArgument("not-value1", new[] { "value1", "value2" })); } [Fact] @@ -197,12 +197,12 @@ public void When_FromAmong_is_used_and_multiple_invalid_inputs_are_provided_the_ result.Errors[0] .Message .Should() - .Be(LocalizationResources.Instance.UnrecognizedArgument("c1", new[] { "author", "language", "tags", "type" })); + .Be(LocalizationResources.UnrecognizedArgument("c1", new[] { "author", "language", "tags", "type" })); result.Errors[1] .Message .Should() - .Be(LocalizationResources.Instance.UnrecognizedArgument("c2", new[] { "author", "language", "tags", "type" })); + .Be(LocalizationResources.UnrecognizedArgument("c2", new[] { "author", "language", "tags", "type" })); } [Fact] @@ -1117,7 +1117,7 @@ public void A_command_with_subcommands_is_invalid_to_invoke_if_it_has_no_handler result.Errors .Should() .ContainSingle( - e => e.Message.Equals(LocalizationResources.Instance.RequiredCommandWasNotProvided()) && + e => e.Message.Equals(LocalizationResources.RequiredCommandWasNotProvided()) && ((CommandResult)e.SymbolResult).Command.Name.Equals("inner")); } @@ -1133,7 +1133,7 @@ public void A_root_command_is_invalid_if_it_has_no_handler() result.Errors .Should() .ContainSingle( - e => e.Message.Equals(LocalizationResources.Instance.RequiredCommandWasNotProvided()) && + e => e.Message.Equals(LocalizationResources.RequiredCommandWasNotProvided()) && ((CommandResult)e.SymbolResult).Command == rootCommand); } diff --git a/src/System.CommandLine/ArgumentArity.cs b/src/System.CommandLine/ArgumentArity.cs index a779882ad7..39d284bf05 100644 --- a/src/System.CommandLine/ArgumentArity.cs +++ b/src/System.CommandLine/ArgumentArity.cs @@ -92,7 +92,7 @@ internal static bool Validate(ArgumentResult argumentResult, [NotNullWhen(false) error = ArgumentConversionResult.Failure( argumentResult, - argumentResult.LocalizationResources.RequiredArgumentMissing(argumentResult.Parent), + LocalizationResources.RequiredArgumentMissing(argumentResult.Parent), ArgumentConversionResultType.FailedMissingArgument); return false; @@ -106,7 +106,7 @@ internal static bool Validate(ArgumentResult argumentResult, [NotNullWhen(false) { error = ArgumentConversionResult.Failure( argumentResult, - argumentResult.LocalizationResources.ExpectsOneArgument(optionResult), + LocalizationResources.ExpectsOneArgument(optionResult), ArgumentConversionResultType.FailedTooManyArguments); return false; diff --git a/src/System.CommandLine/Argument{T}.cs b/src/System.CommandLine/Argument{T}.cs index ce51ca4156..12f14ff65c 100644 --- a/src/System.CommandLine/Argument{T}.cs +++ b/src/System.CommandLine/Argument{T}.cs @@ -195,7 +195,7 @@ void UnrecognizedArgumentError(ArgumentResult argumentResult) { if (Array.IndexOf(values, token.Value) < 0) { - argumentResult.AddError(argumentResult.LocalizationResources.UnrecognizedArgument(token.Value, values)); + argumentResult.AddError(LocalizationResources.UnrecognizedArgument(token.Value, values)); } } } @@ -221,7 +221,7 @@ public void AcceptLegalFilePathsOnly() if (invalidCharactersIndex >= 0) { - result.AddError(result.LocalizationResources.InvalidCharactersInPath(token.Value[invalidCharactersIndex])); + result.AddError(LocalizationResources.InvalidCharactersInPath(token.Value[invalidCharactersIndex])); } } }); @@ -244,7 +244,7 @@ public void AcceptLegalFileNamesOnly() if (invalidCharactersIndex >= 0) { - result.AddError(result.LocalizationResources.InvalidCharactersInFileName(token.Value[invalidCharactersIndex])); + result.AddError(LocalizationResources.InvalidCharactersInFileName(token.Value[invalidCharactersIndex])); } } }); diff --git a/src/System.CommandLine/Binding/ArgumentConversionResult.cs b/src/System.CommandLine/Binding/ArgumentConversionResult.cs index 6c103e1d3c..555125cf99 100644 --- a/src/System.CommandLine/Binding/ArgumentConversionResult.cs +++ b/src/System.CommandLine/Binding/ArgumentConversionResult.cs @@ -52,12 +52,12 @@ private static string FormatErrorMessage( if (completionItems.Length > 0) { - return argumentResult.LocalizationResources.ArgumentConversionCannotParseForCommand( + return LocalizationResources.ArgumentConversionCannotParseForCommand( value, alias, expectedType, completionItems.Select(ci => ci.Label)); } else { - return argumentResult.LocalizationResources.ArgumentConversionCannotParseForCommand(value, alias, expectedType); + return LocalizationResources.ArgumentConversionCannotParseForCommand(value, alias, expectedType); } } else if (argumentResult.Parent is OptionResult optionResult) @@ -67,17 +67,17 @@ private static string FormatErrorMessage( if (completionItems.Length > 0) { - return argumentResult.LocalizationResources.ArgumentConversionCannotParseForOption( + return LocalizationResources.ArgumentConversionCannotParseForOption( value, alias, expectedType, completionItems.Select(ci => ci.Label)); } else { - return argumentResult.LocalizationResources.ArgumentConversionCannotParseForOption(value, alias, expectedType); + return LocalizationResources.ArgumentConversionCannotParseForOption(value, alias, expectedType); } } // fake ArgumentResults with no Parent - return argumentResult.LocalizationResources.ArgumentConversionCannotParse(value, expectedType); + return LocalizationResources.ArgumentConversionCannotParse(value, expectedType); } } } \ No newline at end of file diff --git a/src/System.CommandLine/Binding/ArgumentConverter.cs b/src/System.CommandLine/Binding/ArgumentConverter.cs index c982a66fdf..5db016b571 100644 --- a/src/System.CommandLine/Binding/ArgumentConverter.cs +++ b/src/System.CommandLine/Binding/ArgumentConverter.cs @@ -186,9 +186,9 @@ internal static ArgumentConversionResult ConvertIfNeeded( Success(conversionResult.ArgumentResult, true), ArgumentConversionResultType.NoArgument when conversionResult.ArgumentResult.Argument.Arity.MinimumNumberOfValues > 0 => - ArgumentConversionResult.Failure( + Failure( conversionResult.ArgumentResult, - conversionResult.ArgumentResult.LocalizationResources.RequiredArgumentMissing(conversionResult.ArgumentResult.Parent!), + LocalizationResources.RequiredArgumentMissing(conversionResult.ArgumentResult.Parent!), ArgumentConversionResultType.FailedMissingArgument), _ => conversionResult diff --git a/src/System.CommandLine/Builder/CommandLineBuilder.cs b/src/System.CommandLine/Builder/CommandLineBuilder.cs index 547419f88d..7af1dc2143 100644 --- a/src/System.CommandLine/Builder/CommandLineBuilder.cs +++ b/src/System.CommandLine/Builder/CommandLineBuilder.cs @@ -18,7 +18,6 @@ public class CommandLineBuilder // (because each struct is of a different size) // that is why we don't use List for middleware private List>? _middlewareList; - private LocalizationResources? _localizationResources; private Action? _customizeHelpBuilder; private Func? _helpBuilderFactory; @@ -74,12 +73,6 @@ HelpBuilder CreateHelpBuilder(BindingContext bindingContext) internal int? MaxHelpWidth { get; set; } - internal LocalizationResources LocalizationResources - { - get => _localizationResources ??= LocalizationResources.Instance; - set => _localizationResources = value; - } - internal TryReplaceToken? TokenReplacer { get; set; } /// @@ -92,7 +85,6 @@ public Parser Build() => enablePosixBundling: EnablePosixBundling, enableDirectives: EnableDirectives, enableTokenReplacement: EnableTokenReplacement, - resources: LocalizationResources, middlewarePipeline: _middlewareList is null ? Array.Empty() : GetMiddleware(), diff --git a/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs b/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs index fe49e34d0d..f6ce88c6b2 100644 --- a/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs +++ b/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs @@ -323,7 +323,7 @@ void Default(Exception exception, InvocationContext context) context.Console.ResetTerminalForegroundColor(); context.Console.SetTerminalForegroundRed(); - context.Console.Error.Write(context.LocalizationResources.ExceptionHandlerHeader()); + context.Console.Error.Write(LocalizationResources.ExceptionHandlerHeader()); context.Console.Error.WriteLine(exception.ToString()); context.Console.ResetTerminalForegroundColor(); @@ -347,7 +347,7 @@ void Default(Exception exception, InvocationContext context) /// The same instance of . public static CommandLineBuilder UseHelp(this CommandLineBuilder builder, int? maxWidth = null) { - return builder.UseHelp(new HelpOption(() => builder.LocalizationResources), maxWidth); + return builder.UseHelp(new HelpOption(), maxWidth); } /// @@ -361,7 +361,7 @@ public static CommandLineBuilder UseHelp( this CommandLineBuilder builder, params string[] helpAliases) { - return builder.UseHelp(new HelpOption(helpAliases, () => builder.LocalizationResources)); + return builder.UseHelp(new HelpOption(helpAliases)); } /// @@ -381,7 +381,7 @@ public static CommandLineBuilder UseHelp( if (builder.HelpOption is null) { - builder.UseHelp(new HelpOption(() => builder.LocalizationResources), maxWidth); + builder.UseHelp(new HelpOption(), maxWidth); } return builder; @@ -577,20 +577,6 @@ public static CommandLineBuilder UseTypoCorrections( return builder; } - /// - /// Specifies localization resources to be used when displaying help, error messages, and other user-facing strings. - /// - /// A command line builder. - /// The localizations resources to use. - /// The same instance of . - public static CommandLineBuilder UseLocalizationResources( - this CommandLineBuilder builder, - LocalizationResources validationMessages) - { - builder.LocalizationResources = validationMessages; - return builder; - } - /// /// Specifies a delegate used to replace any token prefixed with @ with zero or more other tokens, prior to parsing. /// diff --git a/src/System.CommandLine/CommandLineConfiguration.cs b/src/System.CommandLine/CommandLineConfiguration.cs index 44672ea41b..af1ef1df65 100644 --- a/src/System.CommandLine/CommandLineConfiguration.cs +++ b/src/System.CommandLine/CommandLineConfiguration.cs @@ -26,7 +26,6 @@ public class CommandLineConfiguration /// to enable POSIX bundling; otherwise, . /// to enable directive parsing; otherwise, . /// to enable token replacement; otherwise, . - /// Provide custom validation messages. /// Provide a custom middleware pipeline. /// Provide a custom help builder. /// Replaces the specified token with any number of other tokens. @@ -35,7 +34,6 @@ public CommandLineConfiguration( bool enablePosixBundling = true, bool enableDirectives = true, bool enableTokenReplacement = true, - LocalizationResources? resources = null, IReadOnlyList? middlewarePipeline = null, Func? helpBuilderFactory = null, TryReplaceToken? tokenReplacer = null) @@ -45,7 +43,6 @@ public CommandLineConfiguration( EnablePosixBundling = enablePosixBundling; EnableDirectives = enableDirectives; - LocalizationResources = resources ?? LocalizationResources.Instance; Middleware = middlewarePipeline ?? Array.Empty(); _helpBuilderFactory = helpBuilderFactory; @@ -60,7 +57,7 @@ internal static HelpBuilder DefaultHelpBuilderFactory(BindingContext context, in maxWidth = systemConsole.GetWindowWidth(); } - return new HelpBuilder(context.ParseResult.CommandResult.LocalizationResources, maxWidth); + return new HelpBuilder(maxWidth); } /// @@ -84,11 +81,6 @@ internal static HelpBuilder DefaultHelpBuilderFactory(BindingContext context, in /// public bool EnableTokenReplacement { get; } - /// - /// Gets the localizable resources. - /// - public LocalizationResources LocalizationResources { get; } - internal Func HelpBuilderFactory => _helpBuilderFactory ??= context => DefaultHelpBuilderFactory(context); internal IReadOnlyList Middleware { get; } @@ -104,7 +96,6 @@ private bool DefaultTokenReplacer( out string? errorMessage) => StringExtensions.TryReadResponseFile( tokenToReplace, - LocalizationResources, out replacementTokens, out errorMessage); diff --git a/src/System.CommandLine/Help/HelpBuilder.Default.cs b/src/System.CommandLine/Help/HelpBuilder.Default.cs index 1681fb2583..361a74824b 100644 --- a/src/System.CommandLine/Help/HelpBuilder.Default.cs +++ b/src/System.CommandLine/Help/HelpBuilder.Default.cs @@ -131,7 +131,7 @@ public static string GetIdentifierSymbolUsageLabel(IdentifierSymbol symbol, Help if (symbol is Option { IsRequired: true }) { - firstColumnText += $" {context.HelpBuilder.LocalizationResources.HelpOptionsRequiredLabel()}"; + firstColumnText += $" {LocalizationResources.HelpOptionsRequiredLabel()}"; } return firstColumnText; @@ -156,7 +156,7 @@ public static IEnumerable> GetLayout() public static Action SynopsisSection() => ctx => { - ctx.HelpBuilder.WriteHeading(ctx.HelpBuilder.LocalizationResources.HelpDescriptionTitle(), ctx.Command.Description, ctx.Output); + ctx.HelpBuilder.WriteHeading(LocalizationResources.HelpDescriptionTitle(), ctx.Command.Description, ctx.Output); }; /// @@ -165,7 +165,7 @@ public static Action SynopsisSection() => public static Action CommandUsageSection() => ctx => { - ctx.HelpBuilder.WriteHeading(ctx.HelpBuilder.LocalizationResources.HelpUsageTitle(), ctx.HelpBuilder.GetUsage(ctx.Command), ctx.Output); + ctx.HelpBuilder.WriteHeading(LocalizationResources.HelpUsageTitle(), ctx.HelpBuilder.GetUsage(ctx.Command), ctx.Output); }; /// @@ -182,7 +182,7 @@ public static Action CommandArgumentsSection() => return; } - ctx.HelpBuilder.WriteHeading(ctx.HelpBuilder.LocalizationResources.HelpArgumentsTitle(), null, ctx.Output); + ctx.HelpBuilder.WriteHeading(LocalizationResources.HelpArgumentsTitle(), null, ctx.Output); ctx.HelpBuilder.WriteColumns(commandArguments, ctx); }; @@ -246,7 +246,7 @@ public static Action OptionsSection() => return; } - ctx.HelpBuilder.WriteHeading(ctx.HelpBuilder.LocalizationResources.HelpOptionsTitle(), null, ctx.Output); + ctx.HelpBuilder.WriteHeading(LocalizationResources.HelpOptionsTitle(), null, ctx.Output); ctx.HelpBuilder.WriteColumns(options, ctx); ctx.Output.WriteLine(); }; diff --git a/src/System.CommandLine/Help/HelpBuilder.cs b/src/System.CommandLine/Help/HelpBuilder.cs index 0519020d4a..53d3dd2ae1 100644 --- a/src/System.CommandLine/Help/HelpBuilder.cs +++ b/src/System.CommandLine/Help/HelpBuilder.cs @@ -17,14 +17,9 @@ public partial class HelpBuilder private Dictionary? _customizationsBySymbol; private Func>>? _getLayout; - /// Resources used to localize the help output. /// The maximum width in characters after which help output is wrapped. - public HelpBuilder( - LocalizationResources localizationResources, - int maxWidth = int.MaxValue) + public HelpBuilder(int maxWidth = int.MaxValue) { - LocalizationResources = localizationResources ?? throw new ArgumentNullException(nameof(localizationResources)); - if (maxWidth <= 0) { maxWidth = int.MaxValue; @@ -32,11 +27,6 @@ public HelpBuilder( MaxWidth = maxWidth; } - /// - /// Provides localizable strings for help and error messages. - /// - public LocalizationResources LocalizationResources { get; } - /// /// The maximum width for which to format help output. /// diff --git a/src/System.CommandLine/Help/HelpOption.cs b/src/System.CommandLine/Help/HelpOption.cs index 616156cff1..f480e3ac09 100644 --- a/src/System.CommandLine/Help/HelpOption.cs +++ b/src/System.CommandLine/Help/HelpOption.cs @@ -5,29 +5,27 @@ namespace System.CommandLine.Help { internal class HelpOption : Option { - private readonly Func _localizationResources; private string? _description; - public HelpOption(string[] aliases, Func getLocalizationResources) + public HelpOption(string[] aliases) : base(aliases, null, new Argument { Arity = ArgumentArity.Zero }) { - _localizationResources = getLocalizationResources; } - public HelpOption(Func getLocalizationResources) : this(new[] + public HelpOption() : this(new[] { "-h", "/h", "--help", "-?", "/?" - }, getLocalizationResources) + }) { } public override string? Description { - get => _description ??= _localizationResources().HelpOptionDescription(); + get => _description ??= LocalizationResources.HelpOptionDescription(); set => _description = value; } diff --git a/src/System.CommandLine/Help/VersionOption.cs b/src/System.CommandLine/Help/VersionOption.cs index 8e65328ee8..0976861d67 100644 --- a/src/System.CommandLine/Help/VersionOption.cs +++ b/src/System.CommandLine/Help/VersionOption.cs @@ -33,7 +33,7 @@ private void AddValidators() parent.Children.Where(r => !(r is OptionResult optionResult && optionResult.Option is VersionOption)) .Any(IsNotImplicit)) { - result.AddError(result.LocalizationResources.VersionOptionCannotBeCombinedWithOtherArguments(result.Token?.Value ?? result.Option.Name)); + result.AddError(LocalizationResources.VersionOptionCannotBeCombinedWithOtherArguments(result.Token?.Value ?? result.Option.Name)); } }); } @@ -50,7 +50,7 @@ private static bool IsNotImplicit(SymbolResult symbolResult) public override string? Description { - get => _description ??= _builder.LocalizationResources.VersionOptionDescription(); + get => _description ??= LocalizationResources.VersionOptionDescription(); set => _description = value; } diff --git a/src/System.CommandLine/Invocation/InvocationContext.cs b/src/System.CommandLine/Invocation/InvocationContext.cs index 39076d22e8..f0261f223e 100644 --- a/src/System.CommandLine/Invocation/InvocationContext.cs +++ b/src/System.CommandLine/Invocation/InvocationContext.cs @@ -86,11 +86,6 @@ public IConsole Console /// public Parser Parser => ParseResult.Parser; - /// - /// Provides localizable strings for help and error messages. - /// - public LocalizationResources LocalizationResources => Parser.Configuration.LocalizationResources; - /// /// The parse result for the current invocation. /// diff --git a/src/System.CommandLine/Invocation/TypoCorrection.cs b/src/System.CommandLine/Invocation/TypoCorrection.cs index 3dead941da..4801fc1f66 100644 --- a/src/System.CommandLine/Invocation/TypoCorrection.cs +++ b/src/System.CommandLine/Invocation/TypoCorrection.cs @@ -33,7 +33,7 @@ public void ProvideSuggestions(ParseResult result, IConsole console) { if (first) { - console.Out.WriteLine(result.CommandResult.LocalizationResources.SuggestionsTokenNotMatched(token)); + console.Out.WriteLine(LocalizationResources.SuggestionsTokenNotMatched(token)); first = false; } diff --git a/src/System.CommandLine/LocalizationResources.cs b/src/System.CommandLine/LocalizationResources.cs index ce1c832e31..3cc9fc40fb 100644 --- a/src/System.CommandLine/LocalizationResources.cs +++ b/src/System.CommandLine/LocalizationResources.cs @@ -11,26 +11,12 @@ namespace System.CommandLine /// /// Provides localizable strings for help and error messages. /// - public class LocalizationResources + internal static class LocalizationResources { - private static LocalizationResources? _instance; - - /// - /// Gets a global instance of the class. - /// - public static LocalizationResources Instance => _instance ??= new(); - - /// - /// Initializes a new instance of the class. - /// - protected LocalizationResources() - { - } - /// /// Interpolates values into a localized string similar to Command '{0}' expects a single argument but {1} were provided. /// - public virtual string ExpectsOneArgument(SymbolResult symbolResult) => + internal static string ExpectsOneArgument(SymbolResult symbolResult) => symbolResult is CommandResult ? GetResourceString(Properties.Resources.CommandExpectsOneArgument, symbolResult.Token().Value, symbolResult.Tokens.Count) : GetResourceString(Properties.Resources.OptionExpectsOneArgument, symbolResult.Token().Value, symbolResult.Tokens.Count); @@ -38,7 +24,7 @@ symbolResult is CommandResult /// /// Interpolates values into a localized string similar to No argument was provided for Command '{0}'.. /// - public virtual string NoArgumentProvided(SymbolResult symbolResult) => + internal static string NoArgumentProvided(SymbolResult symbolResult) => symbolResult is CommandResult ? GetResourceString(Properties.Resources.CommandNoArgumentProvided, symbolResult.Token().Value) : GetResourceString(Properties.Resources.OptionNoArgumentProvided, symbolResult.Token().Value); @@ -46,7 +32,7 @@ symbolResult is CommandResult /// /// Interpolates values into a localized string similar to Command '{0}' expects no more than {1} arguments, but {2} were provided. /// - public virtual string ExpectsFewerArguments( + internal static string ExpectsFewerArguments( Token token, int providedNumberOfValues, int maximumNumberOfValues) => @@ -57,37 +43,37 @@ public virtual string ExpectsFewerArguments( /// /// Interpolates values into a localized string similar to Directory does not exist: {0}. /// - public virtual string DirectoryDoesNotExist(string path) => + internal static string DirectoryDoesNotExist(string path) => GetResourceString(Properties.Resources.DirectoryDoesNotExist, path); /// /// Interpolates values into a localized string similar to File does not exist: {0}. /// - public virtual string FileDoesNotExist(string filePath) => + internal static string FileDoesNotExist(string filePath) => GetResourceString(Properties.Resources.FileDoesNotExist, filePath); /// /// Interpolates values into a localized string similar to File or directory does not exist: {0}. /// - public virtual string FileOrDirectoryDoesNotExist(string path) => + internal static string FileOrDirectoryDoesNotExist(string path) => GetResourceString(Properties.Resources.FileOrDirectoryDoesNotExist, path); /// /// Interpolates values into a localized string similar to Character not allowed in a path: {0}. /// - public virtual string InvalidCharactersInPath(char invalidChar) => + internal static string InvalidCharactersInPath(char invalidChar) => GetResourceString(Properties.Resources.InvalidCharactersInPath, invalidChar); /// /// Interpolates values into a localized string similar to Character not allowed in a file name: {0}. /// - public virtual string InvalidCharactersInFileName(char invalidChar) => + internal static string InvalidCharactersInFileName(char invalidChar) => GetResourceString(Properties.Resources.InvalidCharactersInFileName, invalidChar); /// /// Interpolates values into a localized string similar to Required argument missing for command: {0}. /// - public virtual string RequiredArgumentMissing(SymbolResult symbolResult) => + internal static string RequiredArgumentMissing(SymbolResult symbolResult) => symbolResult is CommandResult ? GetResourceString(Properties.Resources.CommandRequiredArgumentMissing, symbolResult.Token().Value) : GetResourceString(Properties.Resources.OptionRequiredArgumentMissing, symbolResult.Token().Value); @@ -95,170 +81,170 @@ symbolResult is CommandResult /// /// Interpolates values into a localized string similar to Required command was not provided. /// - public virtual string RequiredCommandWasNotProvided() => + internal static string RequiredCommandWasNotProvided() => GetResourceString(Properties.Resources.RequiredCommandWasNotProvided); /// /// Interpolates values into a localized string similar to Option '{0}' is required. /// - public virtual string RequiredOptionWasNotProvided(Option option) => + internal static string RequiredOptionWasNotProvided(Option option) => GetResourceString(Properties.Resources.RequiredOptionWasNotProvided, option.GetLongestAlias(removePrefix: false)); /// /// Interpolates values into a localized string similar to Argument '{0}' not recognized. Must be one of:{1}. /// - public virtual string UnrecognizedArgument(string unrecognizedArg, IReadOnlyCollection allowedValues) => + internal static string UnrecognizedArgument(string unrecognizedArg, IReadOnlyCollection allowedValues) => GetResourceString(Properties.Resources.UnrecognizedArgument, unrecognizedArg,$"\n\t{string.Join("\n\t", allowedValues.Select(v => $"'{v}'"))}"); /// /// Interpolates values into a localized string similar to Unrecognized command or argument '{0}'. /// - public virtual string UnrecognizedCommandOrArgument(string arg) => + internal static string UnrecognizedCommandOrArgument(string arg) => GetResourceString(Properties.Resources.UnrecognizedCommandOrArgument, arg); /// /// Interpolates values into a localized string similar to Response file not found '{0}'. /// - public virtual string ResponseFileNotFound(string filePath) => + internal static string ResponseFileNotFound(string filePath) => GetResourceString(Properties.Resources.ResponseFileNotFound, filePath); /// /// Interpolates values into a localized string similar to Error reading response file '{0}': {1}. /// - public virtual string ErrorReadingResponseFile(string filePath, IOException e) => + internal static string ErrorReadingResponseFile(string filePath, IOException e) => GetResourceString(Properties.Resources.ErrorReadingResponseFile, filePath, e.Message); /// /// Interpolates values into a localized string similar to Show help and usage information. /// - public virtual string HelpOptionDescription() => + internal static string HelpOptionDescription() => GetResourceString(Properties.Resources.HelpOptionDescription); /// /// Interpolates values into a localized string similar to Usage:. /// - public virtual string HelpUsageTitle() => + internal static string HelpUsageTitle() => GetResourceString(Properties.Resources.HelpUsageTitle); /// /// Interpolates values into a localized string similar to Description:. /// - public virtual string HelpDescriptionTitle() => + internal static string HelpDescriptionTitle() => GetResourceString(Properties.Resources.HelpDescriptionTitle); /// /// Interpolates values into a localized string similar to [options]. /// - public virtual string HelpUsageOptions() => + internal static string HelpUsageOptions() => GetResourceString(Properties.Resources.HelpUsageOptions); /// /// Interpolates values into a localized string similar to [command]. /// - public virtual string HelpUsageCommand() => + internal static string HelpUsageCommand() => GetResourceString(Properties.Resources.HelpUsageCommand); /// /// Interpolates values into a localized string similar to [[--] <additional arguments>...]]. /// - public virtual string HelpUsageAdditionalArguments() => + internal static string HelpUsageAdditionalArguments() => GetResourceString(Properties.Resources.HelpUsageAdditionalArguments); /// /// Interpolates values into a localized string similar to Arguments:. /// - public virtual string HelpArgumentsTitle() => + internal static string HelpArgumentsTitle() => GetResourceString(Properties.Resources.HelpArgumentsTitle); /// /// Interpolates values into a localized string similar to Options:. /// - public virtual string HelpOptionsTitle() => + internal static string HelpOptionsTitle() => GetResourceString(Properties.Resources.HelpOptionsTitle); /// /// Interpolates values into a localized string similar to (REQUIRED). /// - public virtual string HelpOptionsRequiredLabel() => + internal static string HelpOptionsRequiredLabel() => GetResourceString(Properties.Resources.HelpOptionsRequiredLabel); /// /// Interpolates values into a localized string similar to default. /// - public virtual string HelpArgumentDefaultValueLabel() => + internal static string HelpArgumentDefaultValueLabel() => GetResourceString(Properties.Resources.HelpArgumentDefaultValueLabel); /// /// Interpolates values into a localized string similar to Commands:. /// - public virtual string HelpCommandsTitle() => + internal static string HelpCommandsTitle() => GetResourceString(Properties.Resources.HelpCommandsTitle); /// /// Interpolates values into a localized string similar to Additional Arguments:. /// - public virtual string HelpAdditionalArgumentsTitle() => + internal static string HelpAdditionalArgumentsTitle() => GetResourceString(Properties.Resources.HelpAdditionalArgumentsTitle); /// /// Interpolates values into a localized string similar to Arguments passed to the application that is being run.. /// - public virtual string HelpAdditionalArgumentsDescription() => + internal static string HelpAdditionalArgumentsDescription() => GetResourceString(Properties.Resources.HelpAdditionalArgumentsDescription); /// /// Interpolates values into a localized string similar to '{0}' was not matched. Did you mean one of the following?. /// - public virtual string SuggestionsTokenNotMatched(string token) + internal static string SuggestionsTokenNotMatched(string token) => GetResourceString(Properties.Resources.SuggestionsTokenNotMatched, token); /// /// Interpolates values into a localized string similar to Show version information. /// - public virtual string VersionOptionDescription() + internal static string VersionOptionDescription() => GetResourceString(Properties.Resources.VersionOptionDescription); /// /// Interpolates values into a localized string similar to {0} option cannot be combined with other arguments.. /// - public virtual string VersionOptionCannotBeCombinedWithOtherArguments(string optionAlias) + internal static string VersionOptionCannotBeCombinedWithOtherArguments(string optionAlias) => GetResourceString(Properties.Resources.VersionOptionCannotBeCombinedWithOtherArguments, optionAlias); /// /// Interpolates values into a localized string similar to Unhandled exception: . /// - public virtual string ExceptionHandlerHeader() + internal static string ExceptionHandlerHeader() => GetResourceString(Properties.Resources.ExceptionHandlerHeader); /// /// Interpolates values into a localized string similar to Cannot parse argument '{0}' as expected type {1}.. /// - public virtual string ArgumentConversionCannotParse(string value, Type expectedType) + internal static string ArgumentConversionCannotParse(string value, Type expectedType) => GetResourceString(Properties.Resources.ArgumentConversionCannotParse, value, expectedType); /// /// Interpolates values into a localized string similar to Cannot parse argument '{0}' for command '{1}' as expected type {2}.. /// - public virtual string ArgumentConversionCannotParseForCommand(string value, string commandAlias, Type expectedType) + internal static string ArgumentConversionCannotParseForCommand(string value, string commandAlias, Type expectedType) => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForCommand, value, commandAlias, expectedType); /// /// Interpolates values into a localized string similar to Cannot parse argument '{0}' for command '{1}' as expected type {2}.. /// - public virtual string ArgumentConversionCannotParseForCommand(string value, string commandAlias, Type expectedType, IEnumerable completions) + internal static string ArgumentConversionCannotParseForCommand(string value, string commandAlias, Type expectedType, IEnumerable completions) => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForCommand_Completions, value, commandAlias, expectedType, Environment.NewLine + string.Join(Environment.NewLine, completions)); /// /// Interpolates values into a localized string similar to Cannot parse argument '{0}' for option '{1}' as expected type {2}.. /// - public virtual string ArgumentConversionCannotParseForOption(string value, string optionAlias, Type expectedType) + internal static string ArgumentConversionCannotParseForOption(string value, string optionAlias, Type expectedType) => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForOption, value, optionAlias, expectedType); /// /// Interpolates values into a localized string similar to Cannot parse argument '{0}' for option '{1}' as expected type {2}.. /// - public virtual string ArgumentConversionCannotParseForOption(string value, string optionAlias, Type expectedType, IEnumerable completions) + internal static string ArgumentConversionCannotParseForOption(string value, string optionAlias, Type expectedType, IEnumerable completions) => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForOption_Completions, value, optionAlias, expectedType, Environment.NewLine + string.Join(Environment.NewLine, completions)); @@ -268,7 +254,7 @@ public virtual string ArgumentConversionCannotParseForOption(string value, strin /// The string template into which values will be interpolated. /// The values to interpolate. /// The final string after interpolation. - protected virtual string GetResourceString(string resourceString, params object[] formatArguments) + static string GetResourceString(string resourceString, params object[] formatArguments) { if (resourceString is null) { diff --git a/src/System.CommandLine/ParseResult.cs b/src/System.CommandLine/ParseResult.cs index 08bd091071..4692a2c6f2 100644 --- a/src/System.CommandLine/ParseResult.cs +++ b/src/System.CommandLine/ParseResult.cs @@ -65,7 +65,7 @@ internal ParseResult( for (var i = 0; i < _unmatchedTokens.Count; i++) { var token = _unmatchedTokens[i]; - (errors ??= new()).Add(new ParseError(parser.Configuration.LocalizationResources.UnrecognizedCommandOrArgument(token.Value), rootCommandResult)); + (errors ??= new()).Add(new ParseError(LocalizationResources.UnrecognizedCommandOrArgument(token.Value), rootCommandResult)); } } } diff --git a/src/System.CommandLine/Parsing/ParseOperation.cs b/src/System.CommandLine/Parsing/ParseOperation.cs index caf62a54cf..ebac3cdc0f 100644 --- a/src/System.CommandLine/Parsing/ParseOperation.cs +++ b/src/System.CommandLine/Parsing/ParseOperation.cs @@ -31,7 +31,7 @@ public ParseOperation( _tokens = tokens; _configuration = configuration; _rawInput = rawInput; - _symbolResultTree = new(configuration.LocalizationResources, tokenizeErrors); + _symbolResultTree = new(tokenizeErrors); _innermostCommandResult = _rootCommandResult = new CommandResult( _configuration.RootCommand, CurrentToken, diff --git a/src/System.CommandLine/Parsing/StringExtensions.cs b/src/System.CommandLine/Parsing/StringExtensions.cs index ee7010b933..4b8fd121a8 100644 --- a/src/System.CommandLine/Parsing/StringExtensions.cs +++ b/src/System.CommandLine/Parsing/StringExtensions.cs @@ -359,7 +359,6 @@ internal static bool TrySplitIntoSubtokens( internal static bool TryReadResponseFile( string filePath, - LocalizationResources localizationResources, out IReadOnlyList? newTokens, out string? error) { @@ -371,11 +370,11 @@ internal static bool TryReadResponseFile( } catch (FileNotFoundException) { - error = localizationResources.ResponseFileNotFound(filePath); + error = LocalizationResources.ResponseFileNotFound(filePath); } catch (IOException e) { - error = localizationResources.ErrorReadingResponseFile(filePath, e); + error = LocalizationResources.ErrorReadingResponseFile(filePath, e); } newTokens = null; diff --git a/src/System.CommandLine/Parsing/SymbolResult.cs b/src/System.CommandLine/Parsing/SymbolResult.cs index a7ae8d5202..45f84d4a85 100644 --- a/src/System.CommandLine/Parsing/SymbolResult.cs +++ b/src/System.CommandLine/Parsing/SymbolResult.cs @@ -31,11 +31,6 @@ private protected SymbolResult(SymbolResultTree symbolResultTree, SymbolResult? /// public IReadOnlyList Tokens => _tokens is not null ? _tokens : Array.Empty(); - /// - /// Localization resources used to produce messages for this symbol result. - /// - public LocalizationResources LocalizationResources => SymbolResultTree.LocalizationResources; - internal void AddToken(Token token) => (_tokens ??= new()).Add(token); /// diff --git a/src/System.CommandLine/Parsing/SymbolResultTree.cs b/src/System.CommandLine/Parsing/SymbolResultTree.cs index d59935f020..3c7633dced 100644 --- a/src/System.CommandLine/Parsing/SymbolResultTree.cs +++ b/src/System.CommandLine/Parsing/SymbolResultTree.cs @@ -7,14 +7,11 @@ namespace System.CommandLine.Parsing { internal sealed class SymbolResultTree : Dictionary { - internal readonly LocalizationResources LocalizationResources; internal List? Errors; internal List? UnmatchedTokens; - internal SymbolResultTree(LocalizationResources localizationResources, List? tokenizeErrors) + internal SymbolResultTree(List? tokenizeErrors) { - LocalizationResources = localizationResources; - if (tokenizeErrors is not null) { Errors = new List(tokenizeErrors.Count); diff --git a/src/System.CommandLine/Validate.cs b/src/System.CommandLine/Validate.cs index 0b339174ed..cb0ae6f578 100644 --- a/src/System.CommandLine/Validate.cs +++ b/src/System.CommandLine/Validate.cs @@ -13,7 +13,7 @@ internal static void FileExists(ArgumentResult result) if (!File.Exists(token.Value)) { - result.AddError(result.LocalizationResources.FileDoesNotExist(token.Value)); + result.AddError(LocalizationResources.FileDoesNotExist(token.Value)); } } } @@ -26,7 +26,7 @@ internal static void DirectoryExists(ArgumentResult result) if (!Directory.Exists(token.Value)) { - result.AddError(result.LocalizationResources.DirectoryDoesNotExist(token.Value)); + result.AddError(LocalizationResources.DirectoryDoesNotExist(token.Value)); } } } @@ -39,7 +39,7 @@ internal static void FileOrDirectoryExists(ArgumentResult result) if (!Directory.Exists(token.Value) && !File.Exists(token.Value)) { - result.AddError(result.LocalizationResources.FileOrDirectoryDoesNotExist(token.Value)); + result.AddError(LocalizationResources.FileOrDirectoryDoesNotExist(token.Value)); } } } From 0e59a6e4135300fae70e7047d1f0b953c36190aa Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 2 Feb 2023 20:12:27 +0100 Subject: [PATCH 2/7] make sure LocalizationResources does not use any S.CL internals, so it can be included in the .Tests project --- .../LocalizationResources.cs | 36 ++++++++++--------- .../Parsing/CommandResult.cs | 2 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/System.CommandLine/LocalizationResources.cs b/src/System.CommandLine/LocalizationResources.cs index 3cc9fc40fb..e40f69bf32 100644 --- a/src/System.CommandLine/LocalizationResources.cs +++ b/src/System.CommandLine/LocalizationResources.cs @@ -16,18 +16,18 @@ internal static class LocalizationResources /// /// Interpolates values into a localized string similar to Command '{0}' expects a single argument but {1} were provided. /// - internal static string ExpectsOneArgument(SymbolResult symbolResult) => - symbolResult is CommandResult - ? GetResourceString(Properties.Resources.CommandExpectsOneArgument, symbolResult.Token().Value, symbolResult.Tokens.Count) - : GetResourceString(Properties.Resources.OptionExpectsOneArgument, symbolResult.Token().Value, symbolResult.Tokens.Count); + internal static string ExpectsOneArgument(SymbolResult symbolResult) => + symbolResult is CommandResult commandResult + ? GetResourceString(Properties.Resources.CommandExpectsOneArgument, commandResult.Token.Value, symbolResult.Tokens.Count) + : GetResourceString(Properties.Resources.OptionExpectsOneArgument, GetOptionName((OptionResult)symbolResult), symbolResult.Tokens.Count); /// /// Interpolates values into a localized string similar to No argument was provided for Command '{0}'.. /// internal static string NoArgumentProvided(SymbolResult symbolResult) => - symbolResult is CommandResult - ? GetResourceString(Properties.Resources.CommandNoArgumentProvided, symbolResult.Token().Value) - : GetResourceString(Properties.Resources.OptionNoArgumentProvided, symbolResult.Token().Value); + symbolResult is CommandResult commandResult + ? GetResourceString(Properties.Resources.CommandNoArgumentProvided, commandResult.Token.Value) + : GetResourceString(Properties.Resources.OptionNoArgumentProvided, GetOptionName((OptionResult)symbolResult)); /// /// Interpolates values into a localized string similar to Command '{0}' expects no more than {1} arguments, but {2} were provided. @@ -63,7 +63,7 @@ internal static string FileOrDirectoryDoesNotExist(string path) => /// internal static string InvalidCharactersInPath(char invalidChar) => GetResourceString(Properties.Resources.InvalidCharactersInPath, invalidChar); - + /// /// Interpolates values into a localized string similar to Character not allowed in a file name: {0}. /// @@ -74,9 +74,9 @@ internal static string InvalidCharactersInFileName(char invalidChar) => /// Interpolates values into a localized string similar to Required argument missing for command: {0}. /// internal static string RequiredArgumentMissing(SymbolResult symbolResult) => - symbolResult is CommandResult - ? GetResourceString(Properties.Resources.CommandRequiredArgumentMissing, symbolResult.Token().Value) - : GetResourceString(Properties.Resources.OptionRequiredArgumentMissing, symbolResult.Token().Value); + symbolResult is CommandResult commandResult + ? GetResourceString(Properties.Resources.CommandRequiredArgumentMissing, commandResult.Token.Value) + : GetResourceString(Properties.Resources.OptionRequiredArgumentMissing, GetOptionName((OptionResult)symbolResult)); /// /// Interpolates values into a localized string similar to Required command was not provided. @@ -87,14 +87,14 @@ internal static string RequiredCommandWasNotProvided() => /// /// Interpolates values into a localized string similar to Option '{0}' is required. /// - internal static string RequiredOptionWasNotProvided(Option option) => - GetResourceString(Properties.Resources.RequiredOptionWasNotProvided, option.GetLongestAlias(removePrefix: false)); + internal static string RequiredOptionWasNotProvided(string longestAliasWithPrefix) => + GetResourceString(Properties.Resources.RequiredOptionWasNotProvided, longestAliasWithPrefix); /// /// Interpolates values into a localized string similar to Argument '{0}' not recognized. Must be one of:{1}. /// internal static string UnrecognizedArgument(string unrecognizedArg, IReadOnlyCollection allowedValues) => - GetResourceString(Properties.Resources.UnrecognizedArgument, unrecognizedArg,$"\n\t{string.Join("\n\t", allowedValues.Select(v => $"'{v}'"))}"); + GetResourceString(Properties.Resources.UnrecognizedArgument, unrecognizedArg, $"\n\t{string.Join("\n\t", allowedValues.Select(v => $"'{v}'"))}"); /// /// Interpolates values into a localized string similar to Unrecognized command or argument '{0}'. @@ -232,7 +232,7 @@ internal static string ArgumentConversionCannotParseForCommand(string value, str /// Interpolates values into a localized string similar to Cannot parse argument '{0}' for command '{1}' as expected type {2}.. /// internal static string ArgumentConversionCannotParseForCommand(string value, string commandAlias, Type expectedType, IEnumerable completions) - => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForCommand_Completions, + => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForCommand_Completions, value, commandAlias, expectedType, Environment.NewLine + string.Join(Environment.NewLine, completions)); /// @@ -245,7 +245,7 @@ internal static string ArgumentConversionCannotParseForOption(string value, stri /// Interpolates values into a localized string similar to Cannot parse argument '{0}' for option '{1}' as expected type {2}.. /// internal static string ArgumentConversionCannotParseForOption(string value, string optionAlias, Type expectedType, IEnumerable completions) - => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForOption_Completions, + => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForOption_Completions, value, optionAlias, expectedType, Environment.NewLine + string.Join(Environment.NewLine, completions)); /// @@ -254,7 +254,7 @@ internal static string ArgumentConversionCannotParseForOption(string value, stri /// The string template into which values will be interpolated. /// The values to interpolate. /// The final string after interpolation. - static string GetResourceString(string resourceString, params object[] formatArguments) + private static string GetResourceString(string resourceString, params object[] formatArguments) { if (resourceString is null) { @@ -266,5 +266,7 @@ static string GetResourceString(string resourceString, params object[] formatArg } return resourceString; } + + private static string GetOptionName(OptionResult optionResult) => optionResult.Token?.Value ?? optionResult.Option.Name; } } diff --git a/src/System.CommandLine/Parsing/CommandResult.cs b/src/System.CommandLine/Parsing/CommandResult.cs index 3b868952a2..9fc990c32c 100644 --- a/src/System.CommandLine/Parsing/CommandResult.cs +++ b/src/System.CommandLine/Parsing/CommandResult.cs @@ -96,7 +96,7 @@ private void ValidateOptions(bool completeValidation) { if (option.IsRequired) { - AddError(LocalizationResources.RequiredOptionWasNotProvided(option)); + AddError(LocalizationResources.RequiredOptionWasNotProvided(option.GetLongestAlias(removePrefix: false))); continue; } else if (option.Argument.HasDefaultValue) From 1b02c3288fb2a6761e7a6a511864741ba706303b Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 2 Feb 2023 20:19:47 +0100 Subject: [PATCH 3/7] include LocalizationResources and S.CL resources in the test projects in order to be able to validate localized the strings in tests --- .../System.CommandLine.Tests.csproj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj b/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj index 72d069fe73..c907e77ac2 100644 --- a/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj +++ b/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj @@ -32,6 +32,8 @@ + + @@ -54,4 +56,11 @@ runtime; build; native; contentfiles; analyzers + + + + System.CommandLine.Properties.Resources.resources + + + From db6834065682a836bcf6c84bb03c1d46229fbdbd Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 2 Feb 2023 20:48:31 +0100 Subject: [PATCH 4/7] tests --- .../LocalizationTests.cs | 37 ++++++++++ .../ResourceLocalizationTests.cs | 72 +++++++------------ 2 files changed, 62 insertions(+), 47 deletions(-) create mode 100644 src/System.CommandLine.ApiCompatibility.Tests/LocalizationTests.cs diff --git a/src/System.CommandLine.ApiCompatibility.Tests/LocalizationTests.cs b/src/System.CommandLine.ApiCompatibility.Tests/LocalizationTests.cs new file mode 100644 index 0000000000..97abc2e674 --- /dev/null +++ b/src/System.CommandLine.ApiCompatibility.Tests/LocalizationTests.cs @@ -0,0 +1,37 @@ +using System.Globalization; +using System.Linq; +using Xunit; + +namespace System.CommandLine.ApiCompatibility.Tests +{ + public class LocalizationTests + { + private const string CommandName = "the-command"; + + [Theory] + [InlineData("es", $"Falta el argumento requerido para el comando: '{CommandName}'.")] + [InlineData("en-US", $"Required argument missing for command: '{CommandName}'.")] + public void ErrorMessages_AreLocalized(string cultureName, string expectedMessage) + { + CultureInfo uiCultureBefore = CultureInfo.CurrentUICulture; + + try + { + CultureInfo.CurrentUICulture = new CultureInfo(cultureName); + + Command command = new(CommandName) + { + new Argument() + }; + + ParseResult parseResult = command.Parse(CommandName); + + Assert.Equal(expectedMessage, parseResult.Errors.Single().Message); + } + finally + { + CultureInfo.CurrentUICulture = uiCultureBefore; + } + } + } +} diff --git a/src/System.CommandLine.Tests/ResourceLocalizationTests.cs b/src/System.CommandLine.Tests/ResourceLocalizationTests.cs index a22841ec3e..2ab553f0cb 100644 --- a/src/System.CommandLine.Tests/ResourceLocalizationTests.cs +++ b/src/System.CommandLine.Tests/ResourceLocalizationTests.cs @@ -14,61 +14,39 @@ public class ResourceLocalizationTests [Fact] public void Default_validation_messages_can_be_replaced_in_order_to_add_localization_support() { - var messages = new FakeLocalizationResources("the-message"); - - var command = new Command("the-command") - { - new Argument() - }; - var parser = new Parser(new CommandLineConfiguration(command, resources: messages)); - var result = parser.Parse("the-command"); - - result.Errors - .Select(e => e.Message) - .Should() - .Contain("the-message"); + //var messages = new FakeLocalizationResources("the-message"); + + //var command = new Command("the-command") + //{ + // new Argument() + //}; + //var parser = new Parser(new CommandLineConfiguration(command, resources: messages)); + //var result = parser.Parse("the-command"); + + //result.Errors + // .Select(e => e.Message) + // .Should() + // .Contain("the-message"); } [Fact] public void Default_validation_messages_can_be_replaced_using_CommandLineBuilder_in_order_to_add_localization_support() { - var messages = new FakeLocalizationResources("the-message"); - - var parser = new CommandLineBuilder(new Command("the-command") - { - new Argument() - }) - .UseLocalizationResources(messages) - .Build(); - - var result = parser.Parse("the-command"); - - result.Errors - .Select(e => e.Message) - .Should() - .Contain("the-message"); - } - - public class FakeLocalizationResources : LocalizationResources - { - private readonly string message; - - public FakeLocalizationResources(string message) - { - this.message = message; - } - - public override string ExpectsOneArgument(SymbolResult symbolResult) => message; - - public override string FileDoesNotExist(string filePath) => message; - - public override string RequiredArgumentMissing(SymbolResult symbolResult) => message; + //var messages = new FakeLocalizationResources("the-message"); - public override string RequiredCommandWasNotProvided() => message; + //var parser = new CommandLineBuilder(new Command("the-command") + // { + // new Argument() + // }) + // .UseLocalizationResources(messages) + // .Build(); - public override string UnrecognizedArgument(string unrecognizedArg, IReadOnlyCollection allowedValues) => message; + //var result = parser.Parse("the-command"); - public override string UnrecognizedCommandOrArgument(string arg) => message; + //result.Errors + // .Select(e => e.Message) + // .Should() + // .Contain("the-message"); } } } From 130068ddf0c296f7e90278fcbbe5043eece3e79b Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 16 Feb 2023 14:29:37 +0100 Subject: [PATCH 5/7] add translations from SDK repo --- .../Properties/xlf/Resources.cs.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.de.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.fr.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.it.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.ja.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.ko.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.pl.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.pt-BR.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.ru.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.tr.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.zh-Hans.xlf | 38 +++++++++---------- .../Properties/xlf/Resources.zh-Hant.xlf | 38 +++++++++---------- 12 files changed, 228 insertions(+), 228 deletions(-) diff --git a/src/System.CommandLine/Properties/xlf/Resources.cs.xlf b/src/System.CommandLine/Properties/xlf/Resources.cs.xlf index ef2f1568d8..f34c58cb3e 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.cs.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.cs.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + Příkaz '{0}' očekává maximálně tento počet argumentů: {1}. Zadal se jich ale tento počet: {2}. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + Chybí povinný argument pro příkaz: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + Adresář neexistuje: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + Při čtení souboru odpovědi '{0}' došlo k chybě: {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + Neexistující soubor: '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + Soubor nebo adresář neexistuje: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + Další argumenty: @@ -89,12 +89,12 @@ Arguments: - Arguments: + Argumenty: Commands: - Commands: + Příkazy: @@ -129,7 +129,7 @@ Options: - Options: + Možnosti: @@ -139,17 +139,17 @@ Usage: - Usage: + Použití: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + Znak se v cestě nepovoluje: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + Možnost '{0}' očekává maximálně tento počet argumentů: {1}. Zadal se jich ale tento počet: {2}. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + Chybí povinný argument pro možnost: '{0}'. Required command was not provided. - Required command was not provided. + Požadovaný příkaz nebyl zadán. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Soubor odpovědi se nenašel '{0}'. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + Argument '{0}' nebyl rozpoznán. Musí se jednat o jeden z těchto argumentů: {1}. Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + Nerozpoznaný příkaz nebo argument: '{0}'. @@ -204,7 +204,7 @@ Show version information - Show version information + Zobrazit verzi diff --git a/src/System.CommandLine/Properties/xlf/Resources.de.xlf b/src/System.CommandLine/Properties/xlf/Resources.de.xlf index 6b69459ae5..e2b3ae52b8 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.de.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.de.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + Der Befehl '{0}' erwartet maximal {1} Argumente, es wurden jedoch {2} angegeben. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + Ein erforderliches Argument fehlt für den Befehl: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + Verzeichnis nicht vorhanden: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + Fehler beim Lesen der Antwortdatei '{0}': {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + Die Datei ist nicht vorhanden: '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + Datei oder Verzeichnis nicht vorhanden: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + Zusätzliche Argumente: @@ -89,12 +89,12 @@ Arguments: - Arguments: + Argumente: Commands: - Commands: + Befehle: @@ -129,7 +129,7 @@ Options: - Options: + Optionen: @@ -139,17 +139,17 @@ Usage: - Usage: + Nutzung: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + Zeichen in Pfad nicht zulässig: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + Die Option '{0}' erwartet maximal {1} Argumente, es wurden jedoch {2} angegeben. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + Ein erforderliches Argument fehlt für die Option: '{0}'. Required command was not provided. - Required command was not provided. + Der erforderliche Befehl wurde nicht bereitgestellt. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Antwortdatei nicht gefunden: '{0}'. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + Das Argument '{0}' wurde nicht erkannt. Folgendes ist erforderlich: {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + Befehl oder Argument '{0}' nicht erkannt. @@ -204,7 +204,7 @@ Show version information - Show version information + Versionsinformationen anzeigen diff --git a/src/System.CommandLine/Properties/xlf/Resources.fr.xlf b/src/System.CommandLine/Properties/xlf/Resources.fr.xlf index 2d611ac68f..37522fa9d6 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.fr.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.fr.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + La commande '{0}' n'attend pas plus de {1} arguments, mais {2} ont été fournis. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + Argument obligatoire manquant pour la commande : '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + Le répertoire n'existe pas : '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + Erreur durant la lecture du fichier réponse '{0}' : {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + Le fichier n'existe pas : '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + Le fichier ou le répertoire n'existe pas : '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + Arguments supplémentaires : @@ -89,12 +89,12 @@ Arguments: - Arguments: + Arguments : Commands: - Commands: + Commandes : @@ -129,7 +129,7 @@ Options: - Options: + Options : @@ -139,17 +139,17 @@ Usage: - Usage: + Utilisation : Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + Caractère non autorisé dans un chemin : '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + L'option '{0}' n'attend pas plus de {1} arguments, mais {2} ont été fournis. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + Argument obligatoire manquant pour l'option : '{0}'. Required command was not provided. - Required command was not provided. + La commande nécessaire n'a pas été fournie. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Fichier réponse introuvable '{0}'. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + Argument '{0}' non reconnu. Il doit faire partie de : {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + Commande ou argument non reconnu : '{0}'. @@ -204,7 +204,7 @@ Show version information - Show version information + Afficher les informations de version diff --git a/src/System.CommandLine/Properties/xlf/Resources.it.xlf b/src/System.CommandLine/Properties/xlf/Resources.it.xlf index 146e7b4814..dfa81a684d 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.it.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.it.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + Il comando '{0}' prevede non più di {1} argomenti, ma ne sono stati forniti {2}. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + Manca l'argomento obbligatorio per il comando: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + La directory non esiste: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + Si è verificato un errore durante la lettura del file di risposta '{0}': {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + Il file '{0}' non esiste. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + Il file o la directory non esiste: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + Argomenti aggiuntivi: @@ -89,12 +89,12 @@ Arguments: - Arguments: + Argomenti: Commands: - Commands: + Comandi: @@ -129,7 +129,7 @@ Options: - Options: + Opzioni: @@ -139,17 +139,17 @@ Usage: - Usage: + Utilizzo: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + Il carattere non è consentito in un percorso: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + L'opzione '{0}' prevede non più di {1} argomenti, ma ne sono stati forniti {2}. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + Manca l'argomento obbligatorio per l'opzione: '{0}'. Required command was not provided. - Required command was not provided. + Il comando obbligatorio non è stato specificato. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Il file di risposta non è stato trovato in '{0}'. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + L'argomento '{0}' non è riconosciuto. Deve essere uno dei seguenti: {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + Il comando o l'argomento '{0}' non è stato riconosciuto. @@ -204,7 +204,7 @@ Show version information - Show version information + Visualizza le informazioni sulla versione diff --git a/src/System.CommandLine/Properties/xlf/Resources.ja.xlf b/src/System.CommandLine/Properties/xlf/Resources.ja.xlf index 0f23a46804..6c29d0e89d 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ja.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ja.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + コマンド '{0}' では引数が {1} 個以下である必要がありますが、{2} 個が指定されました。. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + 必要な引数がコマンドにありません: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + 次のディレクトリが存在しません: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + 応答ファイル '{0}' の読み取りでエラーが発生しました: {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + ファイルが存在しません: '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + ファイルまたはディレクトリが存在しません: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + 追加引数: @@ -89,12 +89,12 @@ Arguments: - Arguments: + 引数: Commands: - Commands: + コマンド: @@ -129,7 +129,7 @@ Options: - Options: + オプション: @@ -139,17 +139,17 @@ Usage: - Usage: + 使用法: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + パスで使用することが許可されていない文字: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + オプション '{0}' では、引数が {1} 個以下である必要がありますが、{2} 個が指定されています。. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + 必要な引数がオプションにありません: '{0}'. Required command was not provided. - Required command was not provided. + 必要なコマンドが指定されませんでした。. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + 応答ファイルが見つかりません: '{0}'. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + 引数 '{0}' は認識されません。次のいずれかである必要があります: {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + 認識されないコマンドまたは引数 '{0}'. @@ -204,7 +204,7 @@ Show version information - Show version information + バージョン情報を表示する diff --git a/src/System.CommandLine/Properties/xlf/Resources.ko.xlf b/src/System.CommandLine/Properties/xlf/Resources.ko.xlf index 60c9971927..0ce67fdf20 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ko.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ko.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + 명령 '{0}'에는 {1}개 이하의 인수가 필요한데 {2}개가 제공되었습니다. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + 명령 '{0}'에 대한 필수 인수가 없습니다. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + 디렉터리 '{0}'이(가) 없습니다. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + 지시 파일 '{0}'을(를) 읽는 동안 오류가 발생했습니다. {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + 파일이 없습니다. '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + 파일 또는 디렉터리가 없음: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + 추가 인수: @@ -89,12 +89,12 @@ Arguments: - Arguments: + 인수: Commands: - Commands: + 명령: @@ -129,7 +129,7 @@ Options: - Options: + 옵션: @@ -139,17 +139,17 @@ Usage: - Usage: + 사용법: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + 경로에 사용할 수 없는 문자: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + 옵션 '{0}'에는 {1}개 이하의 인수가 필요한데 {2}개가 제공되었습니다. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + 옵션 '{0}'에 대한 필수 인수가 없습니다. Required command was not provided. - Required command was not provided. + 필수 명령을 제공하지 않았습니다. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + '{0}'에서 지시 파일을 찾을 수 없음. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + '{0}' 인수를 인식할 수 없습니다. 다음 중 하나여야 합니다. {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + 인식할 수 없는 명령 또는 인수 '{0}'. @@ -204,7 +204,7 @@ Show version information - Show version information + 버전 정보 표시 diff --git a/src/System.CommandLine/Properties/xlf/Resources.pl.xlf b/src/System.CommandLine/Properties/xlf/Resources.pl.xlf index 4d74816ac1..648e8c3226 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.pl.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.pl.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + Polecenie '{0}' oczekuje nie więcej niż {1} argumentów, ale podano {2}. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + Brakuje argumentu wymaganego polecenia: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + Katalog nie istnieje: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + Błąd podczas odczytywania pliku odpowiedzi '{0}': {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + Plik nie istnieje: '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + Plik lub katalog nie istnieje: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + Dodatkowe argumenty: @@ -89,12 +89,12 @@ Arguments: - Arguments: + Argumenty: Commands: - Commands: + Polecenia: @@ -129,7 +129,7 @@ Options: - Options: + Opcje: @@ -139,17 +139,17 @@ Usage: - Usage: + Użycie: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + Znak jest niedozwolony w ścieżce: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + Opcja '{0}' oczekuje nie więcej niż {1} argumentów, ale podano {2}. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + Brakuje argumentu wymaganego opcji: '{0}'. Required command was not provided. - Required command was not provided. + Nie podano wymaganego polecenia. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Nie znaleziono pliku odpowiedzi '{0}'. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + Nie rozpoznano argumentu '{0}'. Musi on być jednym z tych: {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + Nierozpoznane polecenie lub argument '{0}'. @@ -204,7 +204,7 @@ Show version information - Show version information + Wyświetl informacje o wersji diff --git a/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf b/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf index c1d25a631a..ff2f95d95f 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + O comando '{0}' não espera mais de {1} argumentos, mas {2} foram fornecidos. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + Argumento obrigatório ausente para o comando: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + O diretório não existe: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + Erro ao ler o arquivo de resposta '{0}': {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + O arquivo não existe: '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + O arquivo ou o diretório não existe: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + Argumentos adicionais: @@ -89,12 +89,12 @@ Arguments: - Arguments: + Argumentos: Commands: - Commands: + Comandos: @@ -129,7 +129,7 @@ Options: - Options: + Opções: @@ -139,17 +139,17 @@ Usage: - Usage: + Uso: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + Caractere não permitido em um caminho: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + A opção '{0}' não espera mais de {1} argumentos, mas {2} foram fornecidos. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + Argumento obrigatório ausente para a opção: '{0}'. Required command was not provided. - Required command was not provided. + O comando necessário não foi fornecido. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Arquivo de resposta não encontrado '{0}'. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + Argumento '{0}' não reconhecido. Ele deve ser um dos seguintes: {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + Comando ou argumento '{0}' não reconhecido. @@ -204,7 +204,7 @@ Show version information - Show version information + Mostrar informações de versão diff --git a/src/System.CommandLine/Properties/xlf/Resources.ru.xlf b/src/System.CommandLine/Properties/xlf/Resources.ru.xlf index 2525b84023..0e9495e183 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ru.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ru.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + Максимальное допустимое число аргументов команды '{0}' — {1}. Число указанных аргументов — {2}. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + Отсутствует обязательный аргумент для команды: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + Каталог не существует: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + Ошибка при чтении файла ответа '{0}': {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + Файл не существует: '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + Файл или каталог не существует: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + Дополнительные аргументы: @@ -89,12 +89,12 @@ Arguments: - Arguments: + Аргументы: Commands: - Commands: + Команды: @@ -129,7 +129,7 @@ Options: - Options: + Параметры: @@ -139,17 +139,17 @@ Usage: - Usage: + Использование: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + Недопустимый символ в пути: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + Максимальное допустимое число аргументов параметра '{0}' — {1}. Число указанных аргументов — {2}. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + Отсутствует обязательный аргумент для параметра: '{0}'. Required command was not provided. - Required command was not provided. + Обязательная команда не указана. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Не удалось найти файл ответа '{0}'. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + Аргумент '{0}' не распознан. Он должен быть одним из следующих: {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + Нераспознанная команда или аргумент '{0}'. @@ -204,7 +204,7 @@ Show version information - Show version information + Показать информацию о версии diff --git a/src/System.CommandLine/Properties/xlf/Resources.tr.xlf b/src/System.CommandLine/Properties/xlf/Resources.tr.xlf index 3835a328f0..f3d2c60d39 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.tr.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.tr.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + '{0}' komutu en fazla {1} bağımsız değişken bekliyor, ancak {2} bağımsız değişken sağlandı. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + Komut için gerekli bağımsız değişken eksik: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + Dizin yok: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + '{0}' yanıt dosyası okunurken hata oluştu: {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + Dosya yok: '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + Dosya veya dizin yok: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + Ek Bağımsız Değişkenler: @@ -89,12 +89,12 @@ Arguments: - Arguments: + Bağımsız değişkenler: Commands: - Commands: + Komutlar: @@ -129,7 +129,7 @@ Options: - Options: + Seçenekler: @@ -139,17 +139,17 @@ Usage: - Usage: + Kullanım: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + Yolda '{0}' karakterine izin verilmiyor. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + '{0}' seçeneği en fazla {1} bağımsız değişken bekliyor, ancak {2} bağımsız değişken sağlandı. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + Seçenek için gerekli bağımsız değişken eksik: '{0}'. Required command was not provided. - Required command was not provided. + Gerekli komut sağlanmadı. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + '{0}' yanıt dosyası bulunamadı. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + '{0}' bağımsız değişkeni tanınmıyor. Şunlardan biri olmalıdır: {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + Tanınmayan komut veya bağımsız değişken: '{0}'. @@ -204,7 +204,7 @@ Show version information - Show version information + Sürüm bilgilerini göster diff --git a/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf b/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf index 0b5a526be0..30b160270f 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + 命令“'{0}'”期望参数不超过 {1} 个,但提供了 {2} 个。. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + 命令缺少所需参数: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + 目录不存在: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + 读取响应文件“'{0}'”时出错: {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + 文件不存在: '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + 文件或目录不存在: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + 附加参数: @@ -89,12 +89,12 @@ Arguments: - Arguments: + 参数: Commands: - Commands: + 命令: @@ -129,7 +129,7 @@ Options: - Options: + 选项: @@ -139,17 +139,17 @@ Usage: - Usage: + 用法: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + 路径中不允许的字符: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + 选项“'{0}'”期望参数不超过 {1} 个,但提供了 {2} 个。. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + 选项缺少所需参数: '{0}'. Required command was not provided. - Required command was not provided. + 未提供必需的命令。. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + “'{0}'”找不到响应文件. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + 未识别参数“'{0}'”。必须为一个: {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + 未识别命令或参数“'{0}'”. @@ -204,7 +204,7 @@ Show version information - Show version information + 显示版本信息 diff --git a/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf b/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf index e52a13023e..308f0f63ac 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf @@ -29,7 +29,7 @@ Command '{0}' expects no more than {1} arguments, but {2} were provided. - Command '{0}' expects no more than {1} arguments, but {2} were provided. + 命令 '{0}' 不應有超過 {1} 個引數,但提供了 {2} 個。. @@ -44,17 +44,17 @@ Required argument missing for command: '{0}'. - Required argument missing for command: '{0}'. + 命令遺漏必要引數: '{0}'. Directory does not exist: '{0}'. - Directory does not exist: '{0}'. + 目錄不存在: '{0}'. Error reading response file '{0}': {1} - Error reading response file '{0}': {1} + 讀取回應檔 '{0}' 時發生錯誤: {1} @@ -64,12 +64,12 @@ File does not exist: '{0}'. - File does not exist: '{0}'. + 檔案不存在: '{0}'. File or directory does not exist: '{0}'. - File or directory does not exist: '{0}'. + 檔案或目錄不存在: '{0}'. @@ -79,7 +79,7 @@ Additional Arguments: - Additional Arguments: + 其他引數: @@ -89,12 +89,12 @@ Arguments: - Arguments: + 引數: Commands: - Commands: + 命令: @@ -129,7 +129,7 @@ Options: - Options: + 選項: @@ -139,17 +139,17 @@ Usage: - Usage: + 使用方式: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{0}'. + 路徑中不允許的字元: '{0}'. Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects no more than {1} arguments, but {2} were provided. + 選項 '{0}' 不應有超過 {1} 個引數,但提供了 {2} 個。. @@ -164,12 +164,12 @@ Required argument missing for option: '{0}'. - Required argument missing for option: '{0}'. + 選項遺漏必要引數: '{0}'. Required command was not provided. - Required command was not provided. + 未提供所需的命令。. @@ -179,7 +179,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + 找不到回應檔 '{0}'. @@ -189,12 +189,12 @@ Argument '{0}' not recognized. Must be one of:{1} - Argument '{0}' not recognized. Must be one of:{1} + 無法辨識引數 '{0}'。必須為下列之一: {1} Unrecognized command or argument '{0}'. - Unrecognized command or argument '{0}'. + 無法辨識的命令或引數 '{0}'. @@ -204,7 +204,7 @@ Show version information - Show version information + 顯示版本資訊 From 69fb412e4267f1b8dff704ca8209d54339280f68 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 16 Feb 2023 22:59:44 +0100 Subject: [PATCH 6/7] cleanup --- .../ResourceLocalizationTests.cs | 52 ------------------- .../LocalizationResources.cs | 6 +-- 2 files changed, 2 insertions(+), 56 deletions(-) delete mode 100644 src/System.CommandLine.Tests/ResourceLocalizationTests.cs diff --git a/src/System.CommandLine.Tests/ResourceLocalizationTests.cs b/src/System.CommandLine.Tests/ResourceLocalizationTests.cs deleted file mode 100644 index 2ab553f0cb..0000000000 --- a/src/System.CommandLine.Tests/ResourceLocalizationTests.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Collections.Generic; -using System.CommandLine.Parsing; -using FluentAssertions; -using System.Linq; -using Xunit; - -namespace System.CommandLine.Tests -{ - public class ResourceLocalizationTests - { - [Fact] - public void Default_validation_messages_can_be_replaced_in_order_to_add_localization_support() - { - //var messages = new FakeLocalizationResources("the-message"); - - //var command = new Command("the-command") - //{ - // new Argument() - //}; - //var parser = new Parser(new CommandLineConfiguration(command, resources: messages)); - //var result = parser.Parse("the-command"); - - //result.Errors - // .Select(e => e.Message) - // .Should() - // .Contain("the-message"); - } - - [Fact] - public void Default_validation_messages_can_be_replaced_using_CommandLineBuilder_in_order_to_add_localization_support() - { - //var messages = new FakeLocalizationResources("the-message"); - - //var parser = new CommandLineBuilder(new Command("the-command") - // { - // new Argument() - // }) - // .UseLocalizationResources(messages) - // .Build(); - - //var result = parser.Parse("the-command"); - - //result.Errors - // .Select(e => e.Message) - // .Should() - // .Contain("the-message"); - } - } -} diff --git a/src/System.CommandLine/LocalizationResources.cs b/src/System.CommandLine/LocalizationResources.cs index e40f69bf32..d30ec97c5d 100644 --- a/src/System.CommandLine/LocalizationResources.cs +++ b/src/System.CommandLine/LocalizationResources.cs @@ -16,10 +16,8 @@ internal static class LocalizationResources /// /// Interpolates values into a localized string similar to Command '{0}' expects a single argument but {1} were provided. /// - internal static string ExpectsOneArgument(SymbolResult symbolResult) => - symbolResult is CommandResult commandResult - ? GetResourceString(Properties.Resources.CommandExpectsOneArgument, commandResult.Token.Value, symbolResult.Tokens.Count) - : GetResourceString(Properties.Resources.OptionExpectsOneArgument, GetOptionName((OptionResult)symbolResult), symbolResult.Tokens.Count); + internal static string ExpectsOneArgument(OptionResult optionResult) + => GetResourceString(Properties.Resources.OptionExpectsOneArgument, GetOptionName(optionResult), optionResult.Tokens.Count); /// /// Interpolates values into a localized string similar to No argument was provided for Command '{0}'.. From b8a97611020a6b6c10710ad35517fab18f106b5c Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Fri, 17 Feb 2023 08:59:54 +0100 Subject: [PATCH 7/7] address code review feedback: remove unused LocalizationResources methods and resources --- .../LocalizationResources.cs | 19 -------- .../Properties/Resources.Designer.cs | 45 ------------------- .../Properties/Resources.resx | 15 ------- .../Properties/xlf/Resources.cs.xlf | 25 ----------- .../Properties/xlf/Resources.de.xlf | 25 ----------- .../Properties/xlf/Resources.es.xlf | 27 +---------- .../Properties/xlf/Resources.fr.xlf | 25 ----------- .../Properties/xlf/Resources.it.xlf | 25 ----------- .../Properties/xlf/Resources.ja.xlf | 25 ----------- .../Properties/xlf/Resources.ko.xlf | 25 ----------- .../Properties/xlf/Resources.pl.xlf | 25 ----------- .../Properties/xlf/Resources.pt-BR.xlf | 25 ----------- .../Properties/xlf/Resources.ru.xlf | 25 ----------- .../Properties/xlf/Resources.tr.xlf | 25 ----------- .../Properties/xlf/Resources.zh-Hans.xlf | 25 ----------- .../Properties/xlf/Resources.zh-Hant.xlf | 25 ----------- 16 files changed, 1 insertion(+), 405 deletions(-) diff --git a/src/System.CommandLine/LocalizationResources.cs b/src/System.CommandLine/LocalizationResources.cs index d30ec97c5d..3e0fe99dee 100644 --- a/src/System.CommandLine/LocalizationResources.cs +++ b/src/System.CommandLine/LocalizationResources.cs @@ -19,25 +19,6 @@ internal static class LocalizationResources internal static string ExpectsOneArgument(OptionResult optionResult) => GetResourceString(Properties.Resources.OptionExpectsOneArgument, GetOptionName(optionResult), optionResult.Tokens.Count); - /// - /// Interpolates values into a localized string similar to No argument was provided for Command '{0}'.. - /// - internal static string NoArgumentProvided(SymbolResult symbolResult) => - symbolResult is CommandResult commandResult - ? GetResourceString(Properties.Resources.CommandNoArgumentProvided, commandResult.Token.Value) - : GetResourceString(Properties.Resources.OptionNoArgumentProvided, GetOptionName((OptionResult)symbolResult)); - - /// - /// Interpolates values into a localized string similar to Command '{0}' expects no more than {1} arguments, but {2} were provided. - /// - internal static string ExpectsFewerArguments( - Token token, - int providedNumberOfValues, - int maximumNumberOfValues) => - token.Type == TokenType.Command - ? GetResourceString(Properties.Resources.CommandExpectsFewerArguments, token, maximumNumberOfValues, providedNumberOfValues) - : GetResourceString(Properties.Resources.OptionExpectsFewerArguments, token, maximumNumberOfValues, providedNumberOfValues); - /// /// Interpolates values into a localized string similar to Directory does not exist: {0}. /// diff --git a/src/System.CommandLine/Properties/Resources.Designer.cs b/src/System.CommandLine/Properties/Resources.Designer.cs index c781eb9f85..8d95bb93a4 100644 --- a/src/System.CommandLine/Properties/Resources.Designer.cs +++ b/src/System.CommandLine/Properties/Resources.Designer.cs @@ -105,33 +105,6 @@ internal static string ArgumentConversionCannotParseForOption_Completions { } } - /// - /// Looks up a localized string similar to Command '{0}' expects no more than {1} arguments, but {2} were provided.. - /// - internal static string CommandExpectsFewerArguments { - get { - return ResourceManager.GetString("CommandExpectsFewerArguments", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Command '{0}' expects a single argument but {1} were provided.. - /// - internal static string CommandExpectsOneArgument { - get { - return ResourceManager.GetString("CommandExpectsOneArgument", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No argument was provided for Command '{0}'.. - /// - internal static string CommandNoArgumentProvided { - get { - return ResourceManager.GetString("CommandNoArgumentProvided", resourceCulture); - } - } - /// /// Looks up a localized string similar to Required argument missing for command: '{0}'.. /// @@ -321,15 +294,6 @@ internal static string InvalidCharactersInPath { } } - /// - /// Looks up a localized string similar to Option '{0}' expects no more than {1} arguments, but {2} were provided.. - /// - internal static string OptionExpectsFewerArguments { - get { - return ResourceManager.GetString("OptionExpectsFewerArguments", resourceCulture); - } - } - /// /// Looks up a localized string similar to Option '{0}' expects a single argument but {1} were provided.. /// @@ -339,15 +303,6 @@ internal static string OptionExpectsOneArgument { } } - /// - /// Looks up a localized string similar to No argument was provided for Option '{0}'.. - /// - internal static string OptionNoArgumentProvided { - get { - return ResourceManager.GetString("OptionNoArgumentProvided", resourceCulture); - } - } - /// /// Looks up a localized string similar to Required argument missing for option: '{0}'.. /// diff --git a/src/System.CommandLine/Properties/Resources.resx b/src/System.CommandLine/Properties/Resources.resx index a5e32aa8dc..2cd913ede2 100644 --- a/src/System.CommandLine/Properties/Resources.resx +++ b/src/System.CommandLine/Properties/Resources.resx @@ -117,27 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - Command '{0}' expects a single argument but {1} were provided. - - - No argument was provided for Command '{0}'. - Directory does not exist: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - File does not exist: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.cs.xlf b/src/System.CommandLine/Properties/xlf/Resources.cs.xlf index f34c58cb3e..d20a81bf04 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.cs.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.cs.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - Příkaz '{0}' očekává maximálně tento počet argumentů: {1}. Zadal se jich ale tento počet: {2}. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. Chybí povinný argument pro příkaz: '{0}'. @@ -147,21 +132,11 @@ Znak se v cestě nepovoluje: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - Možnost '{0}' očekává maximálně tento počet argumentů: {1}. Zadal se jich ale tento počet: {2}. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. Chybí povinný argument pro možnost: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.de.xlf b/src/System.CommandLine/Properties/xlf/Resources.de.xlf index e2b3ae52b8..648385ec11 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.de.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.de.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - Der Befehl '{0}' erwartet maximal {1} Argumente, es wurden jedoch {2} angegeben. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. Ein erforderliches Argument fehlt für den Befehl: '{0}'. @@ -147,21 +132,11 @@ Zeichen in Pfad nicht zulässig: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - Die Option '{0}' erwartet maximal {1} Argumente, es wurden jedoch {2} angegeben. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. Ein erforderliches Argument fehlt für die Option: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.es.xlf b/src/System.CommandLine/Properties/xlf/Resources.es.xlf index 005fd3590d..3d8efcb17c 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.es.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.es.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - El comando '{0}' no espera más de {1} argumentos, pero se proporcionaron {2}. - - - - Command '{0}' expects a single argument but {1} were provided. - El comando '{0}' espera un solo argumento, pero se proporcionaron {1}. - - - - No argument was provided for Command '{0}'. - No se proporcionó ningún argumento para el comando '{0}'. - - Required argument missing for command: '{0}'. Falta el argumento requerido para el comando: '{0}'. @@ -147,21 +132,11 @@ Carácter no permitido en una ruta: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - La opción '{0}' no espera más de {1} argumentos, pero se proporcionaron {2}. - - Option '{0}' expects a single argument but {1} were provided. La opción '{0}' espera un solo argumento, pero se proporcionaron {1}. - - No argument was provided for Option '{0}'. - No se proporcionó ningún argumento para la opción '{0}'. - - Required argument missing for option: '{0}'. Falta el argumento requerido para la opción: '{0}'. @@ -209,4 +184,4 @@ - + \ 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 37522fa9d6..cee804e763 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.fr.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.fr.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - La commande '{0}' n'attend pas plus de {1} arguments, mais {2} ont été fournis. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. Argument obligatoire manquant pour la commande : '{0}'. @@ -147,21 +132,11 @@ Caractère non autorisé dans un chemin : '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - L'option '{0}' n'attend pas plus de {1} arguments, mais {2} ont été fournis. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. Argument obligatoire manquant pour l'option : '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.it.xlf b/src/System.CommandLine/Properties/xlf/Resources.it.xlf index dfa81a684d..9801fe92dc 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.it.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.it.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - Il comando '{0}' prevede non più di {1} argomenti, ma ne sono stati forniti {2}. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. Manca l'argomento obbligatorio per il comando: '{0}'. @@ -147,21 +132,11 @@ Il carattere non è consentito in un percorso: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - L'opzione '{0}' prevede non più di {1} argomenti, ma ne sono stati forniti {2}. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. Manca l'argomento obbligatorio per l'opzione: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.ja.xlf b/src/System.CommandLine/Properties/xlf/Resources.ja.xlf index 6c29d0e89d..3370c359b7 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ja.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ja.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - コマンド '{0}' では引数が {1} 個以下である必要がありますが、{2} 個が指定されました。. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. 必要な引数がコマンドにありません: '{0}'. @@ -147,21 +132,11 @@ パスで使用することが許可されていない文字: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - オプション '{0}' では、引数が {1} 個以下である必要がありますが、{2} 個が指定されています。. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. 必要な引数がオプションにありません: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.ko.xlf b/src/System.CommandLine/Properties/xlf/Resources.ko.xlf index 0ce67fdf20..e121e576d9 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ko.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ko.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - 명령 '{0}'에는 {1}개 이하의 인수가 필요한데 {2}개가 제공되었습니다. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. 명령 '{0}'에 대한 필수 인수가 없습니다. @@ -147,21 +132,11 @@ 경로에 사용할 수 없는 문자: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - 옵션 '{0}'에는 {1}개 이하의 인수가 필요한데 {2}개가 제공되었습니다. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. 옵션 '{0}'에 대한 필수 인수가 없습니다. diff --git a/src/System.CommandLine/Properties/xlf/Resources.pl.xlf b/src/System.CommandLine/Properties/xlf/Resources.pl.xlf index 648e8c3226..12d431c17e 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.pl.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.pl.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - Polecenie '{0}' oczekuje nie więcej niż {1} argumentów, ale podano {2}. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. Brakuje argumentu wymaganego polecenia: '{0}'. @@ -147,21 +132,11 @@ Znak jest niedozwolony w ścieżce: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - Opcja '{0}' oczekuje nie więcej niż {1} argumentów, ale podano {2}. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. Brakuje argumentu wymaganego opcji: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf b/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf index ff2f95d95f..fffee1d8ed 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - O comando '{0}' não espera mais de {1} argumentos, mas {2} foram fornecidos. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. Argumento obrigatório ausente para o comando: '{0}'. @@ -147,21 +132,11 @@ Caractere não permitido em um caminho: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - A opção '{0}' não espera mais de {1} argumentos, mas {2} foram fornecidos. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. Argumento obrigatório ausente para a opção: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.ru.xlf b/src/System.CommandLine/Properties/xlf/Resources.ru.xlf index 0e9495e183..68a2d6eb24 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ru.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ru.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - Максимальное допустимое число аргументов команды '{0}' — {1}. Число указанных аргументов — {2}. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. Отсутствует обязательный аргумент для команды: '{0}'. @@ -147,21 +132,11 @@ Недопустимый символ в пути: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - Максимальное допустимое число аргументов параметра '{0}' — {1}. Число указанных аргументов — {2}. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. Отсутствует обязательный аргумент для параметра: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.tr.xlf b/src/System.CommandLine/Properties/xlf/Resources.tr.xlf index f3d2c60d39..5096668256 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.tr.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.tr.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - '{0}' komutu en fazla {1} bağımsız değişken bekliyor, ancak {2} bağımsız değişken sağlandı. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. Komut için gerekli bağımsız değişken eksik: '{0}'. @@ -147,21 +132,11 @@ Yolda '{0}' karakterine izin verilmiyor. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - '{0}' seçeneği en fazla {1} bağımsız değişken bekliyor, ancak {2} bağımsız değişken sağlandı. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. Seçenek için gerekli bağımsız değişken eksik: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf b/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf index 30b160270f..507b132746 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - 命令“'{0}'”期望参数不超过 {1} 个,但提供了 {2} 个。. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. 命令缺少所需参数: '{0}'. @@ -147,21 +132,11 @@ 路径中不允许的字符: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - 选项“'{0}'”期望参数不超过 {1} 个,但提供了 {2} 个。. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. 选项缺少所需参数: '{0}'. diff --git a/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf b/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf index 308f0f63ac..72d2f50e2d 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf @@ -27,21 +27,6 @@ Cannot parse argument '{0}' for option '{1}' as expected type '{2}'. Did you mean one of the following?{3} - - Command '{0}' expects no more than {1} arguments, but {2} were provided. - 命令 '{0}' 不應有超過 {1} 個引數,但提供了 {2} 個。. - - - - Command '{0}' expects a single argument but {1} were provided. - Command '{0}' expects a single argument but {1} were provided. - - - - No argument was provided for Command '{0}'. - No argument was provided for Command '{0}'. - - Required argument missing for command: '{0}'. 命令遺漏必要引數: '{0}'. @@ -147,21 +132,11 @@ 路徑中不允許的字元: '{0}'. - - Option '{0}' expects no more than {1} arguments, but {2} were provided. - 選項 '{0}' 不應有超過 {1} 個引數,但提供了 {2} 個。. - - Option '{0}' expects a single argument but {1} were provided. Option '{0}' expects a single argument but {1} were provided. - - No argument was provided for Option '{0}'. - No argument was provided for Option '{0}'. - - Required argument missing for option: '{0}'. 選項遺漏必要引數: '{0}'.