Topic: Locale names


Author: "Ney Andr de Mello Zunino" <zunino@ias.unu.edu>
Date: Thu, 25 Jan 2001 17:15:38 GMT
Raw View
Hello All,

After reading a reply post on comp.lang.c++, I have been wondering about the
current situation of locales in the Standard, specially with regards to
their "names".

The post I refer to constructed a locale object like this:

std::locale loc("German");

My wonder has to do with the string literal passed to the locale's
constructor. First, I must say I was quite pleased with the way it looks
here, specially if compared to "de_DE", which I had read somewhere else.

Next, I decided to try his code myself with my compiler (Borland C++ Builder
5's compiler) and it worked. Then, I decided to push it a little bit further
and tried passing the literal "Portuguese" (I am Brazilian). Guess what? It
worked!

This definitely pleased me. However, I would like to know what does the
Standard say about it? Is there a list of acceptable/valid string literals
that may be used to identify different locales or is this still up to the
implementations?

Thanks in advance,

Ney Andr    de Mello Zunino.

"Take of the fruit,
    But guard the seed..."



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Pete Becker <petebecker@acm.org>
Date: Thu, 25 Jan 2001 18:15:42 GMT
Raw View
"Ney Andr=E9 de Mello Zunino" wrote:
>=20
> This definitely pleased me. However, I would like to know what does the
> Standard say about it? Is there a list of acceptable/valid string liter=
als
> that may be used to identify different locales or is this still up to t=
he
> implementations?
>=20

The standard says the same thing in this newsgroup as it does in
comp.lang.c++. The only names that an implementation must support are ""
and "C".

--=20
Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: James.Kanze@dresdner-bank.com
Date: Fri, 26 Jan 2001 17:19:16 GMT
Raw View
In article <94ocj8$9ve$1@news.ias.unu.edu>,
  "Ney Andr    de Mello Zunino" <zunino@ias.unu.edu> wrote:

> After reading a reply post on comp.lang.c++, I have been wondering
> about the current situation of locales in the Standard, specially
> with regards to their "names".

With the exception of "" and "C", it's implementation defined.

> The post I refer to constructed a locale object like this:

> std::locale loc("German");

> My wonder has to do with the string literal passed to the locale's
> constructor. First, I must say I was quite pleased with the way it
> looks here, specially if compared to "de_DE", which I had read
> somewhere else.

The "de_DE" is the Posix standard, I think.  ISO codes for language
followed by country.

What locale did you get for "German": Germany, Switzerland or Austria?
(It matters, for example, if you are formatting currency.)

> Next, I decided to try his code myself with my compiler (Borland C++
> Builder 5's compiler) and it worked. Then, I decided to push it a
> little bit further and tried passing the literal "Portuguese" (I am
> Brazilian). Guess what? It worked!

Same question.  Did you get Brazilian Portuguese or Portuguese
Portuguese?  (I would presume that at least the currency symbol is
different.)

> This definitely pleased me. However, I would like to know what does
> the Standard say about it? Is there a list of acceptable/valid
> string literals that may be used to identify different locales or is
> this still up to the implementations?

The implementation isn't even required to furnish locales other than
"" and "C" (and it can make these two identical), much less use some
predetermined strings to specify them.  The most widespread practice
is to use the ISO two character language symbol in lower case,
followed by a "_", followed by the ISO two character country code in
upper case.  As a quality of implementation issue, I would expect any
implementation to support these, plus a default country code when only
the language code is given, plus perhaps also a certain number of
familiar names.

--
James Kanze                               mailto:kanze@gabi-soft.de
Conseils en informatique orient   e objet/
                   Beratung in objektorientierter Datenverarbeitung
Ziegelh   ttenweg 17a, 60598 Frankfurt, Germany Tel. +49(069)63198627


Sent via Deja.com
http://www.deja.com/

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]