dargaud
dargaud

Reputation: 2571

Bash LANGUAGE variable logic

Can someone explain the logic of the LANGUAGE environment variable to me. I just don't get why the 2nd and especially the 3rd examples here are in french. Shouldn't they all be in english ?

$ LANGUAGE=en_US gerp
No command 'gerp' found, did you mean: Command 'grep' from package 'grep' (main)
$ LANGUAGE=en_US:fr gerp
La commande « gerp » est introuvable, vouliez-vous dire : La commande « grep » du paquet « grep » (main)
$ LANGUAGE=en_US:fr:it gerp
La commande « gerp » est introuvable, vouliez-vous dire : La commande « grep » du paquet « grep » (main)

Upvotes: 1

Views: 69

Answers (1)

Bart Friederichs
Bart Friederichs

Reputation: 33521

I did some tests and it seems like it goes through the list and stops at the first language that is known. That, and en_US doesn't seem to be a valid LANGUAGE code to use. Neither is en by the way. It seems like bash only uses English if no other language is set.

[bf@bf-laptop ~]$ LANGUAGE=en:it gerp
bash: gerp: comando non trovato...
Un comando simile è: 'grep'

[bf@bf-laptop ~]$ LANGUAGE=foo:bar:fr gerp
bash: gerp: commande inconnue...
Commande similaire : 'grep'

The LANGUAGE variable is used in the gettext library. The documentation there states:

By default, an English message is shown in place of a nonexistent translation.

Upvotes: 2

Related Questions