Tyrrrz / CliFx

Class-first framework for building command-line interfaces
MIT License
1.48k stars 60 forks source link

Add multi-language output message support #107

Closed AlisaAkiron closed 2 years ago

AlisaAkiron commented 3 years ago

Details

This framework is awesome. But unfortunately, it can only output messages in English. I want it can print messages in other languages to offer better user experience. So I wonder if the framework can add multi-language support or just make the output messages customizable. Thanks.

Tyrrrz commented 3 years ago

To clarify, you mean the error messages and the help text?

AlisaAkiron commented 3 years ago

Yes. The help text and error messages. For example, "you can run blablabla to show help in a specific command", I want to print it in other language. And others like "USAGE", "DESCRIPTION", "OPTIONS", etc.

Tyrrrz commented 3 years ago

I think the best option here is to allow users to change those strings, although I'm not sure what's a good way to do that.

Kacper-Kondracki commented 3 years ago

I think instead of allowing users to change those strings, it may be better to use .resx localization to achieve multi-language output. That way help messages would be in different languages depending on the user pc language.

In addition, something like this should be added to complement multi-language output support.

[Command(Description = "HelloWorldDescription", ResourceType = typeof(Resources))] // Search for static string property "HelloWorldDescription" in type "Resources" using reflection and get the value
public class HelloWorldCommand : ICommand
Tyrrrz commented 2 years ago

Marking this as out-of-scope because:

  1. the burden of maintaining different translations for every user-facing string in the library will be too high
  2. most CLI tools don't provide support for multiple languages