So I know what locale does. Sets the output format of certain programs depending on what country/language you're in, for example 1000000 can be formatted like 1,000,000.00 1 000 000.00 1.000.000,00 and a variety of others on output. But is there a program to literally test this so that I could do export LC_ALL=en_GB.utf8
vs export LC_ALL=en_US.utf8
and observe different output?
Asked
Active
Viewed 1,914 times
5
1 Answers
2
For temporary testing, you don’t actually need to export
the environment
variables before running the command or program whose behaviour you want to
test. If, for example, you want to see how dates are displayed in different
locales you could run the following:
$ LC_ALL=en_US.utf8 date +%x
07/03/2014
$ LC_ALL=en_GB.utf8 date +%x
03/07/14
For the above commands, the LC_ALL
environment variable is set temporarily for
only the date
command by prefixing it with variable assignments for LC_ALL
(this is a feature of POSIX shells).
From the manual for GNU date
:
%x locale’s date representation (e.g., 12/31/99)

Anthony Geoghegan
- 12,950