2

Most shell allow the temporary usage of a different localization for single commands. This is great in the case someone is not using an English locale and is using the output of a command in his/her question or reply.

For instance # cd /nonexistent will output -bash: cd: /nonexistent: Datei oder Verzeichnis nicht gefunden. Everybody that doesn't speak German has basically speaking no clue what the message is telling.
But if I use this command # LC_ALL=C cd /nonexitent I will get this output: -bash: cd: /nonexistent: No such file or directory

While posting commands where the output matters you of course should leave the LC_ALL=C part out.
For instance:

This is bad:

root@server:~# cd /nonexistent
-bash: cd: /nonexistent: Datei oder Verzeichnis nicht gefunden

This is better:

root@server:~# LC_ALL=C cd /nonexistent
-bash: cd: /nonexistent: No such file or directory

And this would be perfect:

root@server:~# cd /nonexistent
-bash: cd: /nonexistent: No such file or directory

I think we should really make this a convention here and make sure everybody knows about it to make it a whole lot simpler for everybody to understand!

An older question (by me :( ) that has that problem: https://stackoverflow.com/questions/20691852/linux-bash-parse-date-in-custom-format (I didn't know there was this board when I posted this question.)

Edit:

Another possible way of dealing with this "problem" would be putting this piece of advice directly on the ask question page.

Of course this does not apply to people using their system in English!

  • Do you have some statistics on how often this problem shows up? – Bernhard Jun 4 '14 at 12:22
  • I've seen it quite a few times (too many IMHO) but I don't have statistics on that. Sorry. – BrainStone Jun 4 '14 at 12:30
  • On GNU systems at least, you can do LANGUAGE=en instead to only override the language of messages and not all the other aspects of localisation (strftime month/day names would still be in the user's language). LANGUAGE takes precedence over LC_ALL (except for LC_ALL=C or LC_ALL=POSIX). – Stéphane Chazelas Aug 8 '16 at 11:52
4

No, if you do that you should use LC_ALL=C

  • 1
    I see! If LC_ALL is not set LANG=C works as well. I will update my answer when I'm on the computer again. – BrainStone Jun 4 '14 at 3:50
  • @BrainStone - that's true, which is why I upvoted it, but if it is set it will override it anyway. – mikeserv Jun 4 '14 at 3:58
  • @BrainStone No: LANG=C only overrides a prior LANG setting. Specific LC_xxx settings have precedence over LANG. LC_ALL=C overrides all locale settings (except for the GNU LANGUAGE variable, which should be set to C as well). – Gilles 'SO- stop being evil' Jun 8 '14 at 1:46
-1

I don't really see why everybody should do that. I am non-native in English, but still I am not using any software in my mother tongue, but only English. Just because it is much easier to search for error messages and also other help, that are in English. If you are a serious programmer or Linux-user, I think it is really stupid to use any other language than English (also in comments. I once received a code with comments in Croatian, that is horrible!)

That sat aside, I don't really see why everybody should put any language statement in front, as the majority of users is using English for their language settings anyhow. New users using weird languages will not be familiar with these temporal settings change anyhow. Therefore, it will be better to comment something like "Please use ... before executing, so all errors and warnings will be in English", and give the user some time to update their question. In practice, this will work a lot smoother.

  • Updated my question. – BrainStone Jun 4 '14 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .