[PLUG] env LANG=C
Wil Cooley
wcooley at nakedape.cc
Sat Nov 2 18:45:39 UTC 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Carla Schroder wrote:
> OK, let's try a different approach- When using the command env LANG=C to
> run a program, for example
>
> env LANG=C gnumeric
>
> is it correct to say, this sets the locale for gnumeric as defined within
> gnumeric's own code? In order to override the system locale? That C = the
> default as coded in the app itself?
Well, yes and no, for certain meanings of "default". For an
internationalized application, there are no hard-coded "defaults"
(otherwise, it wouldn't be flexible enough to make translations for).
However, for a newly created application, C is typically the first
"translation" done--there is, I think, a standard or at least informal
convention that this locale always exist.
I've never done any actual development with i18n'd applications, so past
that I can't tell you. Of course, locales change things other than
language text strings--it also controls the way numbers and dates are
formatted in some standard C functions.
> Or am I like totally confused? Here are some reference docs I found:
>
> http://www.cl.cam.ac.uk/~mgk25/unicode.html
> http://www.ccd.bnl.gov/bcf/cluster/pgi/pgC++_lib/stdlibug/sta_9169.htm
>
> I can firmly and confidently state that env is a bash command. By dang,
> got that much.
Yes and no :) It is a command, but it's not a bash built-in command, like
'test' or 'echo'. It's also not necessary in your example above--'LANG=C
gnumeric' would have worked just fine. The only reason I can think of for
prepending 'env' would be to make it portable to other shells--my example
wouldn't work in csh but yours would. But now I'm OT.
Hm, maybe this from POSIX/The Single Unix Specification v2 will be
enlightening (and then again, maybe not :):
POSIX Locale
All systems provide a POSIX locale, also known as the C locale. The
behaviour of standard utilities and functions in the POSIX locale is as if
the locale was defined via the localedef utility with input data from the
POSIX locale tables in Locale Definition .
The tables in Locale Definition describe the characteristics and behaviour
of the POSIX locale for data consisting entirely of characters from the
portable character set and the control character set. For other
characters, the behaviour is unspecified. For C-language programs, the
POSIX locale is the default locale when the setlocale() function is not
called.
The POSIX locale can be specified by assigning to the appropriate
environment variables the values C or POSIX.
All implementations define a locale as the default locale, to be invoked
when no environment variables are set, or set to the empty string. This
default locale can be the POSIX locale or any other,
implementation-dependent locale. Some implementations may provide
facilities for local installation administrators to set the default
locale, customising it for each location. This specification set does not
require such a facility.
If you don't want to go through the mess of getting a downloadable copy of
SUSv2 from http://www.opengroup.org, you might also look at the glibc info
pages.
Wil
- --
Wil Cooley wcooley at nakedape.cc
Naked Ape Consulting http://nakedape.cc
* * * * Linux, UNIX, Networking and Security Solutions * * * *
QCSNet http://www.qcsn.com
* * * * T1, Frame Relay, DSL, Dial-up, and Web Hosting * * * *
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9xB1ZJpn3uYWUEaoRAsnOAJ94Vz5ODtTjjKjGMwm+3275fI9NcACfTjgH
lqKrcbL9vRPIZOAxVO/A3Yg=
=+YHN
-----END PGP SIGNATURE-----
More information about the PLUG
mailing list