Internationalisation, setlocale()

USENET News System news at OSF.ORG
Thu May 3 22:36:44 AEST 1990


From: martin at osf.osf.org (Sandra Martin)
Path: osf!martin

You're right that the examples are confusing, and not entirely appropriate.
The problem is that there are no current standards for locale names or for
the way locale information should be organized. Most implementations that I
know of use some form of the X/Open naming recommendation which consists of
three parts:

	language_territory.codeset

At this point, however, there is no agreement about the contents of the
individual parts. For example, some implementations might use "long" country
names for the the territory segment (e.g., canada, germany), while others use
abbreviations (can, ger). Still others use the nationality rather than the
country name (e.g., using "swiss" rather than "switzerland"). There are many,
many other examples of different approaches.

As for your question about how the locales should be organized, again, it isn't
standardized, and so depends on the implementation. There are two fairly popular
approaches: flat and tiered. With the flat approach, information is stored 
something like this

	.../locale/<locale_name>/<locale_related_file(s)>

With the tiered approach, information is stored something like this:

	.../locale/<language>/<territory>/<codeset>/<locale_related_file(s)>

In the tiered approach, the territory and codeset directories are optional
and therefore might not exist. 

You noted that some locale-related info is language-specific, while other 
info is country-specific. Notice that neither the flat nor tiered approach
makes these kinds of distinctions. Some implementations do have separate
files for language- and country-specific info, but they store them together
in the same directory.

Confused? I wouldn't be surprised if you were. I've thought for a long time
that it would be a good idea to have some standards for locale names, but
have been voted down in a couple of different groups. However, lately 
there have been some rumblings about the confusion inherent in the current
chaotic system, so we may see some standards soon. Standards for the
organization of locale info also would be helpful.

Hope this helps.

		-- Sandra Martin
		Open Software Foundation
		email: martin at osf.org
		tel: (617) 621-8707



More information about the Comp.lang.c mailing list