Why internationalization of commands is a very bad idea
gist.github.com
gist.github.com
PowerShell is making this better, but of course when you 'shell out' from PSH to a legacy command you're stuck with its crappy commandline parsing which is designed to be backwards compatible with batch files written 20 years ago. The powershell way to do this (assuming 'set-owner' isn't built in to PSH) is probably to end-run round takeown.exe and work with the shell win32 APIs directly (or google for a cmdlet someone else has written that does that for you).
The script in the link is considering what the prompt might ask for, not what the parameters of the program are. If the full thing was internationalized, the script might as well have language specific versions as well, I think.
New-PSSessionOption -Culture=de-DE
Might be worthwhile looking up the PowerShell reference before making comments like that...
It was probably even in 1.0 but MSDN doesn't contain documentation for old software.
- keyboard shortcuts in Windows also sometimes differ depending on locale (for instance, in Spanish version of Notepad shortcut for "save" is CTRL-G, from "guardar", instead of CTRL-S like "save")
- output of some command-line utilities is inconsistent between versions of Windows (XP, 7 etc): sometimes it delimits stuff by tabs, sometimes by whitespaces etc.
Doing internationalization without support libraries is a very bad idea, as this sample code helps illustrate.
There is literally no way to know what languages are supported, this is impossible to enumerate, and what might pass for correct at one time might be adjusted later to better reflect conversational usage.
It's like insisting you could possibly know all the honorifics a personal name might have. If you think you can you're deluding yourself.
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.
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.
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.
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?
For your solution of running through the same mapping library on both ends, that works, but it transforms the scripting language into something dramatically different from writing commands on the command line. The beauty of shell scripting (and, I would argue, the only thing that even makes it worth doing at all) is that you write the same commands in the script that you would write interactively.
By the way thank you again for taking the time to answer my questions, I do appreciate it as these are honestly things I am wondering. I seem to be getting down voted because I am so stupid, but at least you are helping me learn to be less stupid on this subject (which believe it or not everyone else the down votes don't actually accomplish).
Anyway, I take the post as just saying that internationalization is bad for shell commands, not necessarily for other things.
Shell commands are unusual in that they are both a programming interface and a human interface. That puts strange constraints on them that don't show up elsewhere. For things that are clearly just a human interface (for example, a GUI app) you definitely want to localize. For things that are clearly just a computer interface (for example, a REST API) you definitely don't want to. But how do you deal with something like this where it's half and half? Trying to optimize for one use case can hurt the other, which is what this post is trying to show.
This is already solved to an extent in the Unix world by providing the ability for a program to detect whether its standard input/output is wired to an interactive terminal. This is how, for example, many Unix programs detect whether they're being piped into another program and to therefore be more strict about their output.
He runs it; the script starts deleting files/sending emails/downloading files over expensive gsm connection without asking for confirmation.
After some angry words, I discover that the command line flag '-d' for 'dry run' means 'do it now without asking for confirmation' in another locale.
From another reply, it seems one can guard against that by running under the invariant culture, but I don't think one should require everybody who writes a script to be that vigilant.
If you aren't convinced try googling for help on writing VBA macros in localized version of Excel or Word.