4 ms·
I'm pretty sure that's not bash. In any case, the script makes a cogent and concise argument. That argument is that command line options are not just a human i
by mikeash 11y ago
I'm pretty sure that's not bash.
In any case, the script makes a cogent and concise argument. That argument is that command line options are not just a human interface, but also a machine interface, and localization of machine interfaces leads to pain and catastrophe.
You certainly don't have to agree with that argument, but it's there.
- officialchicken 11y agoSure, any naive implementation will lead to pain and catastrophe. But I don't buy that this is a cogent and concise argument to NOT do it.
- mikeash 11y agoWhat does the non-naive implementation look like? You say "support libraries" but what sort of support do they provide for the machine-interface scenario? How do they avoid problems such as forgetting to put a switch through the libraries and ending up with code that only works in some localizations?
- chris_wot 11y agoThe non-naive version sets the PowerShell culture/Bash locale before it runs anything.
- mikeash 11y agoThat works, but it also means that non-English speakers have to learn everything twice.
- chris_wot 11y agoNot sure I see the point you are attempting to make.
- mikeash 11y agoThe great thing about shell scripting is that you use the same commands for interactive use and scripting. If interactive use is localized but scripting is not then that no longer applies.
- chris_wot 11y agoYou add the locale to your script and the problem goes away. You still haven't explained how that's a problem.
- genericuser 11y agoCould you explain the argument to me a bit more? Because the way I am reading your comment and the code is that doing this localization is a pain in the ass (therefore also extremely easy to screw up and not notice), and therefore 'a very bad idea.' However it seems like you would write a library that was basically a collection of user command/language/machine command triplets, expanding the library as you needed new commands to be available. Being as inexperienced as I am I see this as a fairly straight forward manner of allowing users to provide commands which seem intuitive to them making the learning curve for software easier. It would make online community trouble shooting and question asking / answering more difficult, but that could be handled by what would amount to using the same library to translate posts to the users local language. It just seems like a text based user interface will unfortunately already confound enough people that making the commands seem foreign to any one that does not know the original language of the commands is a barrier you would want to avoid creating for potential users. Anyway I am sure I missed your point, or that there is a painfully simple way to handle allowing users to give commands which seem intuitive in their local language, and would like to learn what it is. That way if I encounter this problem in the future I can handle it in an appropriate manner rather than a manner similar to the one which I described.
- mikeash 11y agoThe problem is that sometimes the command is being run directly by a human at the keyboard, and sometimes it's being run as part of a program. And it doesn't really have a way to know which. Localizing the former is fine, but the latter is bad. In short, if you write a script that uses /Y to indicate "yes" as an option to a command, then that script will fail on computers which are set to a language where /Y doesn't mean "yes", and where the command is localized accordingly. If you can solve the problem of differentiating between direct human interaction and running a program, this would be a lot better. But then non-English speakers would have to learn everything twice.
- genericuser 11y agoSo its bad because other people won't localize their programs which might run yours? I can see that being a sadly accurate answer. Thank you for your clarification, assuming I read that correctly. Although I think a more ideal solution to this problem would be if they are going to run your software they should be using the same library to provide input to it so that they can just specify the machine command (as their software doesn't need to be coded to provide short easy to read commands, like are ideal for a human) to look up the local language command, and give your program the command that will map back to the machine command in their local language where ever it is run. If both a machine and a human will be using your software, wouldn't optimizing for the human be ideal, even if it involves another look up or function call for the machine?