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 9a07c56d77..f4ca09d3cb 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 @@ -81,7 +81,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.Int32 errorExitCode = 1) public static CommandLineBuilder UseParseErrorReporting(this CommandLineBuilder builder, System.Int32 errorExitCode = 1) public static CommandLineBuilder UseSuggestDirective(this CommandLineBuilder builder) @@ -90,11 +89,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 @@ -141,46 +139,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.Boolean AppliesToSelfAndChildren { get; set; } @@ -284,8 +242,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) @@ -329,7 +286,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 T GetValue(Option option) @@ -420,7 +376,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.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/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 c19f899f3f..3bb8606059 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 85710b9395..6a96cc730d 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] @@ -1121,7 +1121,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")); } @@ -1137,7 +1137,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.Tests/ResourceLocalizationTests.cs b/src/System.CommandLine.Tests/ResourceLocalizationTests.cs deleted file mode 100644 index a22841ec3e..0000000000 --- a/src/System.CommandLine.Tests/ResourceLocalizationTests.cs +++ /dev/null @@ -1,74 +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"); - } - - 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; - - public override string RequiredCommandWasNotProvided() => message; - - public override string UnrecognizedArgument(string unrecognizedArg, IReadOnlyCollection allowedValues) => message; - - public override string UnrecognizedCommandOrArgument(string arg) => message; - } - } -} 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 + + + 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 d45654bbc8..5270370d71 100644 --- a/src/System.CommandLine/Builder/CommandLineBuilder.cs +++ b/src/System.CommandLine/Builder/CommandLineBuilder.cs @@ -47,7 +47,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; @@ -90,12 +89,6 @@ HelpBuilder CreateHelpBuilder(BindingContext bindingContext) internal int? MaxHelpWidth; - internal LocalizationResources LocalizationResources - { - get => _localizationResources ??= LocalizationResources.Instance; - set => _localizationResources = value; - } - internal TryReplaceToken? TokenReplacer; /// @@ -115,7 +108,6 @@ public Parser Build() => maxLevenshteinDistance: MaxLevenshteinDistance, exceptionHandler: ExceptionHandler, processTerminationTimeout: ProcessTerminationTimeout, - 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 42213a556e..12c7edef19 100644 --- a/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs +++ b/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs @@ -212,7 +212,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(); @@ -236,7 +236,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); } /// @@ -250,7 +250,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)); } /// @@ -270,7 +270,7 @@ public static CommandLineBuilder UseHelp( if (builder.HelpOption is null) { - builder.UseHelp(new HelpOption(builder.LocalizationResources), maxWidth); + builder.UseHelp(new HelpOption(), maxWidth); } return builder; @@ -412,20 +412,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. /// @@ -454,7 +440,7 @@ public static CommandLineBuilder UseVersionOption( return builder; } - builder.VersionOption = new (builder); + builder.VersionOption = new (); builder.Command.Options.Add(builder.VersionOption); return builder; @@ -472,7 +458,7 @@ public static CommandLineBuilder UseVersionOption( return builder; } - builder.VersionOption = new (aliases, builder); + builder.VersionOption = new (aliases); builder.Command.Options.Add(builder.VersionOption); return builder; diff --git a/src/System.CommandLine/CommandLineConfiguration.cs b/src/System.CommandLine/CommandLineConfiguration.cs index 3632e2855e..08c901b7a4 100644 --- a/src/System.CommandLine/CommandLineConfiguration.cs +++ b/src/System.CommandLine/CommandLineConfiguration.cs @@ -61,7 +61,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. @@ -70,12 +69,11 @@ public CommandLineConfiguration( bool enablePosixBundling = true, bool enableDirectives = true, bool enableTokenReplacement = true, - LocalizationResources? resources = null, IReadOnlyList? middlewarePipeline = null, Func? helpBuilderFactory = null, TryReplaceToken? tokenReplacer = null) : this(command, enablePosixBundling, enableDirectives, enableTokenReplacement, false, null, false, null, 0, null, - resources, middlewarePipeline, helpBuilderFactory, tokenReplacer, null) + middlewarePipeline, helpBuilderFactory, tokenReplacer, null) { } @@ -90,7 +88,6 @@ internal CommandLineConfiguration( int? parseErrorReportingExitCode, int maxLevenshteinDistance, TimeSpan? processTerminationTimeout, - LocalizationResources? resources, IReadOnlyList? middlewarePipeline, Func? helpBuilderFactory, TryReplaceToken? tokenReplacer, @@ -106,7 +103,6 @@ internal CommandLineConfiguration( ParseErrorReportingExitCode = parseErrorReportingExitCode; MaxLevenshteinDistance = maxLevenshteinDistance; ProcessTerminationTimeout = processTerminationTimeout; - LocalizationResources = resources ?? LocalizationResources.Instance; Middleware = middlewarePipeline ?? Array.Empty(); _helpBuilderFactory = helpBuilderFactory; @@ -122,7 +118,7 @@ internal static HelpBuilder DefaultHelpBuilderFactory(BindingContext context, in maxWidth = systemConsole.GetWindowWidth(); } - return new HelpBuilder(context.ParseResult.CommandResult.LocalizationResources, maxWidth); + return new HelpBuilder(maxWidth); } /// @@ -146,11 +142,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 TryReplaceToken? TokenReplacer => @@ -164,7 +155,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 77d5fe9912..04e1c24122 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 44a6d3280d..c74679dc4e 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 627c43e238..c5dca1a6c6 100644 --- a/src/System.CommandLine/Help/HelpOption.cs +++ b/src/System.CommandLine/Help/HelpOption.cs @@ -8,20 +8,20 @@ namespace System.CommandLine.Help { internal class HelpOption : Option { - internal HelpOption(string[] aliases, LocalizationResources localizationResources) - : base(aliases, localizationResources.HelpOptionDescription(), new Argument { Arity = ArgumentArity.Zero }) + internal HelpOption(string[] aliases) + : base(aliases, LocalizationResources.HelpOptionDescription(), new Argument { Arity = ArgumentArity.Zero }) { AppliesToSelfAndChildren = true; } - internal HelpOption(LocalizationResources localizationResources) : this(new[] + internal HelpOption() : this(new[] { "-h", "/h", "--help", "-?", "/?" - }, localizationResources) + }) { } diff --git a/src/System.CommandLine/Help/VersionOption.cs b/src/System.CommandLine/Help/VersionOption.cs index e97e39bb4e..3621a1ae04 100644 --- a/src/System.CommandLine/Help/VersionOption.cs +++ b/src/System.CommandLine/Help/VersionOption.cs @@ -10,14 +10,14 @@ namespace System.CommandLine.Help { internal class VersionOption : Option { - internal VersionOption(CommandLineBuilder builder) - : base("--version", builder.LocalizationResources.VersionOptionDescription(), new Argument { Arity = ArgumentArity.Zero }) + internal VersionOption() + : base("--version", LocalizationResources.VersionOptionDescription(), new Argument { Arity = ArgumentArity.Zero }) { AddValidators(); } - internal VersionOption(string[] aliases, CommandLineBuilder builder) - : base(aliases, builder.LocalizationResources.VersionOptionDescription()) + internal VersionOption(string[] aliases) + : base(aliases, LocalizationResources.VersionOptionDescription()) { AddValidators(); } @@ -30,7 +30,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)); } }); } diff --git a/src/System.CommandLine/Invocation/InvocationContext.cs b/src/System.CommandLine/Invocation/InvocationContext.cs index 8e133600a3..97482b6d03 100644 --- a/src/System.CommandLine/Invocation/InvocationContext.cs +++ b/src/System.CommandLine/Invocation/InvocationContext.cs @@ -49,11 +49,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 bdc0937d92..efad1e8ce1 100644 --- a/src/System.CommandLine/Invocation/TypoCorrection.cs +++ b/src/System.CommandLine/Invocation/TypoCorrection.cs @@ -25,7 +25,7 @@ internal static void ProvideSuggestions(InvocationContext context) { 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..3e0fe99dee 100644 --- a/src/System.CommandLine/LocalizationResources.cs +++ b/src/System.CommandLine/LocalizationResources.cs @@ -11,255 +11,220 @@ 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) => - symbolResult is CommandResult - ? GetResourceString(Properties.Resources.CommandExpectsOneArgument, symbolResult.Token().Value, symbolResult.Tokens.Count) - : GetResourceString(Properties.Resources.OptionExpectsOneArgument, symbolResult.Token().Value, symbolResult.Tokens.Count); - - /// - /// Interpolates values into a localized string similar to No argument was provided for Command '{0}'.. - /// - public virtual string NoArgumentProvided(SymbolResult symbolResult) => - symbolResult is CommandResult - ? GetResourceString(Properties.Resources.CommandNoArgumentProvided, symbolResult.Token().Value) - : GetResourceString(Properties.Resources.OptionNoArgumentProvided, symbolResult.Token().Value); - - /// - /// Interpolates values into a localized string similar to Command '{0}' expects no more than {1} arguments, but {2} were provided. - /// - public virtual 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); + internal static string ExpectsOneArgument(OptionResult optionResult) + => GetResourceString(Properties.Resources.OptionExpectsOneArgument, GetOptionName(optionResult), optionResult.Tokens.Count); /// /// 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) => - symbolResult is CommandResult - ? GetResourceString(Properties.Resources.CommandRequiredArgumentMissing, symbolResult.Token().Value) - : GetResourceString(Properties.Resources.OptionRequiredArgumentMissing, symbolResult.Token().Value); + internal static string RequiredArgumentMissing(SymbolResult symbolResult) => + 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. /// - 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) => - 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}. /// - public virtual string UnrecognizedArgument(string unrecognizedArg, IReadOnlyCollection allowedValues) => - GetResourceString(Properties.Resources.UnrecognizedArgument, unrecognizedArg,$"\n\t{string.Join("\n\t", allowedValues.Select(v => $"'{v}'"))}"); + 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) - => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForCommand_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) - => GetResourceString(Properties.Resources.ArgumentConversionCannotParseForOption_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 +233,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) + private static string GetResourceString(string resourceString, params object[] formatArguments) { if (resourceString is null) { @@ -280,5 +245,7 @@ protected virtual string GetResourceString(string resourceString, params object[ } 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 6eb8f7b935..be6895f9b2 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) diff --git a/src/System.CommandLine/Parsing/ParseOperation.cs b/src/System.CommandLine/Parsing/ParseOperation.cs index 00520d4a7e..dcac8ad0b7 100644 --- a/src/System.CommandLine/Parsing/ParseOperation.cs +++ b/src/System.CommandLine/Parsing/ParseOperation.cs @@ -30,7 +30,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 78d3e85f95..877674bfff 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 73f5b75b93..efeaf0dc94 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 9d152ec3e6..86bcdbe66d 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/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 ef2f1568d8..d20a81bf04 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.cs.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.cs.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + Další argumenty: @@ -89,12 +74,12 @@ Arguments: - Arguments: + Argumenty: Commands: - Commands: + Příkazy: @@ -129,7 +114,7 @@ Options: - Options: + Možnosti: @@ -139,17 +124,12 @@ Usage: - Usage: + Použití: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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. + Znak se v cestě nepovoluje: '{0}'. @@ -157,19 +137,14 @@ 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}'. - 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 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Soubor odpovědi se nenašel '{0}'. @@ -189,12 +164,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 +179,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..648385ec11 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.de.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.de.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + Zusätzliche Argumente: @@ -89,12 +74,12 @@ Arguments: - Arguments: + Argumente: Commands: - Commands: + Befehle: @@ -129,7 +114,7 @@ Options: - Options: + Optionen: @@ -139,17 +124,12 @@ Usage: - Usage: + Nutzung: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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. + Zeichen in Pfad nicht zulässig: '{0}'. @@ -157,19 +137,14 @@ 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}'. - 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 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Antwortdatei nicht gefunden: '{0}'. @@ -189,12 +164,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 +179,7 @@ Show version information - Show version information + Versionsinformationen anzeigen 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 2d611ac68f..cee804e763 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.fr.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.fr.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + Arguments supplémentaires : @@ -89,12 +74,12 @@ Arguments: - Arguments: + Arguments : Commands: - Commands: + Commandes : @@ -129,7 +114,7 @@ Options: - Options: + Options : @@ -139,17 +124,12 @@ Usage: - Usage: + Utilisation : Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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. + Caractère non autorisé dans un chemin : '{0}'. @@ -157,19 +137,14 @@ 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}'. - 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 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Fichier réponse introuvable '{0}'. @@ -189,12 +164,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 +179,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..9801fe92dc 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.it.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.it.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + Argomenti aggiuntivi: @@ -89,12 +74,12 @@ Arguments: - Arguments: + Argomenti: Commands: - Commands: + Comandi: @@ -129,7 +114,7 @@ Options: - Options: + Opzioni: @@ -139,17 +124,12 @@ Usage: - Usage: + Utilizzo: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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. + Il carattere non è consentito in un percorso: '{0}'. @@ -157,19 +137,14 @@ 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}'. - 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 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Il file di risposta non è stato trovato in '{0}'. @@ -189,12 +164,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 +179,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..3370c359b7 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ja.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ja.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + 追加引数: @@ -89,12 +74,12 @@ Arguments: - Arguments: + 引数: Commands: - Commands: + コマンド: @@ -129,7 +114,7 @@ Options: - Options: + オプション: @@ -139,17 +124,12 @@ Usage: - Usage: + 使用法: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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}'. @@ -157,19 +137,14 @@ 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}'. - Required argument missing for option: '{0}'. + 必要な引数がオプションにありません: '{0}'. Required command was not provided. - Required command was not provided. + 必要なコマンドが指定されませんでした。. @@ -179,7 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + 応答ファイルが見つかりません: '{0}'. @@ -189,12 +164,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 +179,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..e121e576d9 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ko.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ko.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + 추가 인수: @@ -89,12 +74,12 @@ Arguments: - Arguments: + 인수: Commands: - Commands: + 명령: @@ -129,7 +114,7 @@ Options: - Options: + 옵션: @@ -139,17 +124,12 @@ Usage: - Usage: + 사용법: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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}'. @@ -157,19 +137,14 @@ 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}'. - Required argument missing for option: '{0}'. + 옵션 '{0}'에 대한 필수 인수가 없습니다. Required command was not provided. - Required command was not provided. + 필수 명령을 제공하지 않았습니다. @@ -179,7 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + '{0}'에서 지시 파일을 찾을 수 없음. @@ -189,12 +164,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 +179,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..12d431c17e 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.pl.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.pl.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + Dodatkowe argumenty: @@ -89,12 +74,12 @@ Arguments: - Arguments: + Argumenty: Commands: - Commands: + Polecenia: @@ -129,7 +114,7 @@ Options: - Options: + Opcje: @@ -139,17 +124,12 @@ Usage: - Usage: + Użycie: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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. + Znak jest niedozwolony w ścieżce: '{0}'. @@ -157,19 +137,14 @@ 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}'. - 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 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Nie znaleziono pliku odpowiedzi '{0}'. @@ -189,12 +164,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 +179,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..fffee1d8ed 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.pt-BR.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + Argumentos adicionais: @@ -89,12 +74,12 @@ Arguments: - Arguments: + Argumentos: Commands: - Commands: + Comandos: @@ -129,7 +114,7 @@ Options: - Options: + Opções: @@ -139,17 +124,12 @@ Usage: - Usage: + Uso: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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. + Caractere não permitido em um caminho: '{0}'. @@ -157,19 +137,14 @@ 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}'. - 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 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Arquivo de resposta não encontrado '{0}'. @@ -189,12 +164,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 +179,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..68a2d6eb24 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.ru.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.ru.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + Дополнительные аргументы: @@ -89,12 +74,12 @@ Arguments: - Arguments: + Аргументы: Commands: - Commands: + Команды: @@ -129,7 +114,7 @@ Options: - Options: + Параметры: @@ -139,17 +124,12 @@ Usage: - Usage: + Использование: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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}'. @@ -157,19 +137,14 @@ 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}'. - Required argument missing for option: '{0}'. + Отсутствует обязательный аргумент для параметра: '{0}'. Required command was not provided. - Required command was not provided. + Обязательная команда не указана. @@ -179,7 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + Не удалось найти файл ответа '{0}'. @@ -189,12 +164,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 +179,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..5096668256 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.tr.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.tr.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + Ek Bağımsız Değişkenler: @@ -89,12 +74,12 @@ Arguments: - Arguments: + Bağımsız değişkenler: Commands: - Commands: + Komutlar: @@ -129,7 +114,7 @@ Options: - Options: + Seçenekler: @@ -139,17 +124,12 @@ Usage: - Usage: + Kullanım: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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. + Yolda '{0}' karakterine izin verilmiyor. @@ -157,19 +137,14 @@ 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}'. - 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 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + '{0}' yanıt dosyası bulunamadı. @@ -189,12 +164,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 +179,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..507b132746 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.zh-Hans.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + 附加参数: @@ -89,12 +74,12 @@ Arguments: - Arguments: + 参数: Commands: - Commands: + 命令: @@ -129,7 +114,7 @@ Options: - Options: + 选项: @@ -139,17 +124,12 @@ Usage: - Usage: + 用法: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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}'. @@ -157,19 +137,14 @@ 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}'. - Required argument missing for option: '{0}'. + 选项缺少所需参数: '{0}'. Required command was not provided. - Required command was not provided. + 未提供必需的命令。. @@ -179,7 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + “'{0}'”找不到响应文件. @@ -189,12 +164,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 +179,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..72d2f50e2d 100644 --- a/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf +++ b/src/System.CommandLine/Properties/xlf/Resources.zh-Hant.xlf @@ -27,34 +27,19 @@ 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. - Command '{0}' expects no more than {1} arguments, but {2} were provided. - - - - 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}'. - 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 +49,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 +64,7 @@ Additional Arguments: - Additional Arguments: + 其他引數: @@ -89,12 +74,12 @@ Arguments: - Arguments: + 引數: Commands: - Commands: + 命令: @@ -129,7 +114,7 @@ Options: - Options: + 選項: @@ -139,17 +124,12 @@ Usage: - Usage: + 使用方式: Character not allowed in a path: '{0}'. - Character not allowed in a path: '{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}'. @@ -157,19 +137,14 @@ 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}'. - Required argument missing for option: '{0}'. + 選項遺漏必要引數: '{0}'. Required command was not provided. - Required command was not provided. + 未提供所需的命令。. @@ -179,7 +154,7 @@ Response file not found '{0}'. - Response file not found '{0}'. + 找不到回應檔 '{0}'. @@ -189,12 +164,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 +179,7 @@ Show version information - Show version information + 顯示版本資訊 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)); } } }