473,473 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Determination of language codes from a locale

Hello,

I have found two class libraries that have got the method "getLanguage".
http://www.icu-project.org/apiref/ic...0edae91f75c94f
http://java.sun.com/javase/6/docs/ap...l#getLanguage()

This method provides the capability to get the ISO 639 language code from a
locale. I am looking for a C function that offers the same service.

I know that a current setting can be queried by the function "setlocale". But I
do not see a function in the POSIX API to extract ISO 639 codes from the usual
naming conventions. Which is the recommended way to retrieve such information?
http://opengroup.org/onlinepubs/0096...setlocale.html

Regards,
Markus
Oct 23 '08 #1
25 2521
Markus Elfring wrote:
>
I have found two class libraries that have got the method
"getLanguage".

http://www.icu-project.org/apiref/ic...0edae91f75c94f
http://java.sun.com/javase/6/docs/ap...l#getLanguage()

This method provides the capability to get the ISO 639 language
code from a locale. I am looking for a C function that offers the
same service.

I know that a current setting can be queried by the function
"setlocale". But I do not see a function in the POSIX API to
extract ISO 639 codes from the usual naming conventions. Which is
the recommended way to retrieve such information?

http://opengroup.org/onlinepubs/0096...setlocale.html
This is off-topic on c.l.c. Try comp.unix.programmer. POSIX is
not C.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Oct 23 '08 #2
>I have found two class libraries that have got the method "getLanguage".
>http://www.icu-project.org/apiref/ic...0edae91f75c94f
http://java.sun.com/javase/6/docs/ap...l#getLanguage()

This method provides the capability to get the ISO 639 language
code from a locale. I am looking for a C function that offers
the same service.

I know that a current setting can be queried by the function
"setlocale". But I do not see a function in the POSIX API to
extract ISO 639 codes from the usual naming conventions.
Which is the recommended way to retrieve such information?
http://opengroup.org/onlinepubs/0096...setlocale.html

This is off-topic on c.l.c. Try comp.unix.programmer.
POSIX is not C.
Can the requested functionality belong to a standard C library?

I see the use of specific language information constants (for "nl_langinfo()")
as another candidate to get the desired data. I find it not clear if a detail
like codeset name adheres to an ISO standard.
http://opengroup.org/onlinepubs/0096...anginfo.h.html
http://www.gnu.org/software/libc/man...-Fast-Way.html

Regards,
Markus
Oct 24 '08 #3
Markus Elfring wrote:
>
>>I have found two class libraries that have got the method
"getLanguage".
http://www.icu-project.org/apiref/ic...0edae91f75c94f
http://java.sun.com/javase/6/docs/ap...l#getLanguage()

This method provides the capability to get the ISO 639 language
code from a locale. I am looking for a C function that offers
the same service.

I know that a current setting can be queried by the function
"setlocale". But I do not see a function in the POSIX API to
extract ISO 639 codes from the usual naming conventions.
Which is the recommended way to retrieve such information?

http://opengroup.org/onlinepubs/0096...setlocale.html

This is off-topic on c.l.c. Try comp.unix.programmer.
POSIX is not C.

Can the requested functionality belong to a standard C library?
This is still off topic for c.l.c. Also, please do not send e-mail
replies to things that can be handled in the newsgroup. F'ups set.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Oct 24 '08 #4
CBFalconer wrote:
Markus Elfring wrote:
>>>I have found two class libraries that have got the method
"getLanguage".
http://www.icu-project.org/apiref/ic...0edae91f75c94f
http://java.sun.com/javase/6/docs/ap...l#getLanguage()

This method provides the capability to get the ISO 639 language
code from a locale. I am looking for a C function that offers
the same service.

I know that a current setting can be queried by the function
"setlocale". But I do not see a function in the POSIX API to
extract ISO 639 codes from the usual naming conventions.
Which is the recommended way to retrieve such information?

http://opengroup.org/onlinepubs/0096...setlocale.html
This is off-topic on c.l.c. Try comp.unix.programmer.
POSIX is not C.
Can the requested functionality belong to a standard C library?

This is still off topic for c.l.c. Also, please do not send e-mail
replies to things that can be handled in the newsgroup. F'ups set.
I think F'up has a different meaning here, you declared a post OT on
c.l.c then set follow-ups to c.l.c...

An F'up indeed.

--
Ian Collins
Oct 24 '08 #5
On 23 Oct 2008 at 20:15, Markus Elfring wrote:
I know that a current setting can be queried by the function
"setlocale". But I do not see a function in the POSIX API to extract
ISO 639 codes from the usual naming conventions. Which is the
recommended way to retrieve such information?
I'm slightly confused. The locale could be "C" or "POSIX"; otherwise,
can't you just look at its first two characters, which will be the
standard language code?

(I notice that "CBFalconer" has told you that your question is "off
topic". Of course, it is perfectly topical. CBF is one of the resident
trolls here who seeks to disrupt the newsgroup - please ignore him.)

Oct 24 '08 #6
In article <sl*******************@nospam.invalid>,
Antoninus Twink <no****@nospam.invalidwrote:
....
>(I notice that "CBFalconer" has told you that your question is "off
topic". Of course, it is perfectly topical. CBF is one of the resident
trolls here who seeks to disrupt the newsgroup - please ignore him.)
To all newbies: Keep in mind that in this newsgroup, trolls are like
bacteria (and like witches in the land of Oz) - there are good trolls
and bad trolls. Twink & I are good trolls. CBF is a very bad troll.

Oct 25 '08 #7
POSIX is not C.

Does a programming interface exist in the C standard function library that
returns informations in ISO 639 data format from a locale?
http://en.wikipedia.org/wiki/ISO_639

Is the API situation any better in desktop environments like GNOME and KDE?

Regards,
Markus
Oct 25 '08 #8
I'm slightly confused. The locale could be "C" or "POSIX"; otherwise,
can't you just look at its first two characters, which will be the
standard language code?
Where is the data format officially documented for the locale naming convention?

Regards,
Markus
Oct 25 '08 #9
On 25 Oct 2008 at 10:41, Markus Elfring wrote:
>I'm slightly confused. The locale could be "C" or "POSIX"; otherwise,
can't you just look at its first two characters, which will be the
standard language code?

Where is the data format officially documented for the locale naming
convention?
I think POSIX leaves it implementation-defined, except for insisting on
the existence of "POSIX" as the default locale, "C" as a synonymn for
"POSIX", and "" for an implementation-defined "native locale". Cf.
<http://www.opengroup.org/onlinepubs/000095399/utilities/locale.html>
and
<http://www.opengroup.org/onlinepubs/009695399/functions/setlocale.html>
Here's what the manpage for glibc's setlocale has to say about it:

A locale name is typically of the form language[_territory][.code‐
set][@modifier], where language is an ISO 639 language code, territory
is an ISO 3166 country code, and codeset is a character set or encoding
identifier like ISO-8859-1 or UTF-8.

I don't know of an implementation with a different convention, but the
language lawyers in this group could probably dredge up some mainframe
from the 80s that does something different.

Oct 25 '08 #10
Markus Elfring wrote:
>
>I'm slightly confused. The locale could be "C" or "POSIX"; otherwise,
can't you just look at its first two characters, which will be the
standard language code?

Where is the data format officially documented for the locale naming
convention?
Ignore Twink. He is a troll, who attempts to disrupt the
newsgroup, as does McCormack. If you reply to my email address
again I will consider you a troll and stop replying.

Look at the C-99 references in the following. They document
everything that is topical on c.l.c.

Some useful references about C:
<http://www.ungerhu.com/jxh/clc.welcome.txt>
<http://c-faq.com/ (C-faq)
<http://benpfaff.org/writings/clc/off-topic.html>
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf(C99)
<http://cbfalconer.home.att.net/download/n869_txt.bz2 (pre-C99)
<http://www.dinkumware.com/c99.aspx (C-library}
<http://gcc.gnu.org/onlinedocs/ (GNU docs)
<http://clc-wiki.net/wiki/C_community:comp.lang.c:Introduction>

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Oct 26 '08 #11
I don't know of an implementation with a different convention, but the
language lawyers in this group could probably dredge up some mainframe
from the 80s that does something different.
I do not like the consequences from this software design aspect that the data
format is implementation-defined. I do not see that the C standard function
library supports a direct mapping from a locale identifier to more language
informations like ISO codes.

I have got the impression that only external libraries from the approach
"International Components for Unicode" can provide the requested functionality
for the C/C++ programming language so far.
http://www.icu-project.org/apiref/icu4c/

Regards,
Markus
Oct 26 '08 #12
Look at the C-99 references in the following. They document
everything that is topical on c.l.c.
[...]
<http://benpfaff.org/writings/clc/off-topic.html>
I guess that it is on-topic to discuss open issues in the standard C library.
How are the chances that improved support for Unicode features will result in
adjustments for locale programming interfaces?

Regards,
Markus
Oct 26 '08 #13
Markus Elfring said:
>Look at the C-99 references in the following. They document
everything that is topical on c.l.c.
[...]
> <http://benpfaff.org/writings/clc/off-topic.html>

I guess that it is on-topic to discuss open issues in the standard C
library.
Well, ish. But I saw nothing atopical about your original question. There
*is* a limit (although the group sports a small number of trolls who
appear to think otherwise), but I don't think you broke it...
How are the chances that improved support for Unicode features
will result in adjustments for locale programming interfaces?
....and I'd be delighted to answer your question if only I knew the answer!
You might get a more useful answer here in the next day or two, but on the
other hand you may well find that you get better joy in comp.std.c.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 26 '08 #14
Markus Elfring wrote, On 26/10/08 08:49:
>Look at the C-99 references in the following. They document
everything that is topical on c.l.c.
[...]
> <http://benpfaff.org/writings/clc/off-topic.html>

I guess that it is on-topic to discuss open issues in the standard C library.
How are the chances that improved support for Unicode features will result in
adjustments for locale programming interfaces?
There is a group comp.std.c specifically for discussing the standard
itself, as to how to programming in standard C. That group has more
people who are involved in the standardisation process than this group
so you are more likely to get an accurate answer as to whether the
standard might change over there. Be aware though that changes to the C
standard tend to take a long time to be implemented across the board, as
evidence the version released in 1999 is *still* not fully implemented
by most compilers.

Currently the best way to handle your problem is to use third-party
libraries and/or Posix if you are only concerned with Linux/Unix
--
Flash Gordon
If spamming me sent it to sm**@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Oct 26 '08 #15
On 26 Oct 2008 at 8:49, Markus Elfring wrote:
>Look at the C-99 references in the following. They document
everything that is topical on c.l.c.
[...]
> <http://benpfaff.org/writings/clc/off-topic.html>
This is a lie. They document the opinion of *one individual* about
what's topical on clc.
I guess that it is on-topic to discuss open issues in the standard C
library.
Of course it is, as should be obvious to anyone with an ounce of common
sense.

Those who strut around pretending it's off-topic are never going to help
you anyway, so just ignore them and leave them to wallow in their
absurdities.

Oct 26 '08 #16
Currently the best way to handle your problem is to use third-party
libraries and/or Posix if you are only concerned with Linux/Unix
Would any software developer like to integrate the capability to query more
language informations like ISO 639 codes into locale programming interfaces by
the standard C library?

Can an extension like a symbol "_NL_IDENTIFICATION_LANGUAGE" for the function
"nl_langinfo" become part of the official API?
http://www.gnu.org/software/libc/man...formation.html

Regards,
Markus
Oct 27 '08 #17
Markus Elfring wrote:
>
>Currently the best way to handle your problem is to use third-
party libraries and/or Posix if you are only concerned with
Linux/Unix

Would any software developer like to integrate the capability to
query more language informations like ISO 639 codes into locale
programming interfaces by the standard C library?

Can an extension like a symbol "_NL_IDENTIFICATION_LANGUAGE" for
the function "nl_langinfo" become part of the official API?
Of course it CAN. It won't, because anything of that nature would
make C highly system sensitive. Note that names begining with a
'_' character are generally reserved for the implementation.

Please don't delete attribution lines for material you quote.
Those are the initial lines of the general form "Joe wrote:".

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Oct 27 '08 #18
CBFalconer wrote:
Markus Elfring wrote:
>>Currently the best way to handle your problem is to use third-
party libraries and/or Posix if you are only concerned with
Linux/Unix
Would any software developer like to integrate the capability to
query more language informations like ISO 639 codes into locale
programming interfaces by the standard C library?

Can an extension like a symbol "_NL_IDENTIFICATION_LANGUAGE" for
the function "nl_langinfo" become part of the official API?

Of course it CAN. It won't, because anything of that nature would
make C highly system sensitive.
How?
Note that names begining with a
'_' character are generally reserved for the implementation.
Which is where Markus is proposing this goes.

--
Ian Collins
Oct 27 '08 #19
On Oct 26, 1:49*am, Markus Elfring <Markus.Elfr...@web.dewrote:
Look at the C-99 references in the following. *They document
everything that is topical on c.l.c.
[...]
*<http://benpfaff.org/writings/clc/off-topic.html>

I guess that it is on-topic to discuss open issues in the standard C library.
While such discussions are topical here, probably news:comp.std.c is
even better.
How are the chances that improved support for Unicode features will result in
adjustments for locale programming interfaces?
I use ICU.
http://icu-project.org/
Oct 27 '08 #20
Ian Collins wrote:
CBFalconer wrote:
>Markus Elfring wrote:
.... snip ...
>>
>>Can an extension like a symbol "_NL_IDENTIFICATION_LANGUAGE" for
the function "nl_langinfo" become part of the official API?

Of course it CAN. It won't, because anything of that nature would
make C highly system sensitive.

How?
By forcing every implementation to understand and define whatever
is meant by "_NL_IDENTIFICATION_LANGUAGE" and "nl_langinfo".
>
>Note that names begining with a
'_' character are generally reserved for the implementation.

Which is where Markus is proposing this goes.
I don't know that. At any rate, all I said was "note".

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Oct 27 '08 #21
On 25 Oct, 00:45, gaze...@shell.xmission.com (Kenny McCormack) wrote:
In article <slrngg4jf9.4np.nos...@nospam.invalid>,
Antoninus Twink *<nos...@nospam.invalidwrote:
(I notice that "CBFalconer" has told you that your question is "off
topic". Of course, it is perfectly topical. CBF is one of the resident
trolls here who seeks to disrupt the newsgroup - please ignore him.)

To all newbies: Keep in mind that in this newsgroup, trolls are like
bacteria (and like witches in the land of Oz) - there are good trolls
and bad trolls. *Twink & I are good trolls. *CBF is a very bad troll.
Twink and Kenny have this exactly backward. CBFalconer is sometimes
wrong (way too often wrong). But he is not deliberatly
disruptive of the Newsgroup. T&K rarely (*vanishingly* rarely)
post anything useful or constructive.
Oct 28 '08 #22
CBFalconer schrieb:
By forcing every implementation to understand and define whatever
is meant by "_NL_IDENTIFICATION_LANGUAGE" and "nl_langinfo".
Would you like to suggest different symbols and better function interfaces with
clear data structures to improve the involved API situation?

Regards,
Markus
Oct 28 '08 #23
In article <0a**********************************@v72g2000hsv. googlegroups.com>,
Nick Keighley <ni******************@hotmail.comwrote:
>On 25 Oct, 00:45, gaze...@shell.xmission.com (Kenny McCormack) wrote:
>In article <slrngg4jf9.4np.nos...@nospam.invalid>,
Antoninus Twink *<nos...@nospam.invalidwrote:
>(I notice that "CBFalconer" has told you that your question is "off
topic". Of course, it is perfectly topical. CBF is one of the resident
trolls here who seeks to disrupt the newsgroup - please ignore him.)

To all newbies: Keep in mind that in this newsgroup, trolls are like
bacteria (and like witches in the land of Oz) - there are good trolls
and bad trolls. *Twink & I are good trolls. *CBF is a very bad troll.

Twink and Kenny have this exactly backward. CBFalconer is sometimes
wrong (way too often wrong). But he is not deliberatly
disruptive of the Newsgroup. T&K rarely (*vanishingly* rarely)
post anything useful or constructive.
I'm sure the Witch of the West would say that she (and Ms. East as well)
is/are a good witch. I respectfully, disagree.

You and CBF probably think you are the good ones, too.

Oct 28 '08 #24
CBFalconer schrieb:
>By forcing every implementation to understand and define whatever
is meant by "_NL_IDENTIFICATION_LANGUAGE" and "nl_langinfo".
Markus Elfring wrote:
Would you like to suggest different symbols and better function interfaces with
clear data structures to improve the involved API situation?
IIRC, the current ISO C standard does not require the
implementation to be aware of any external environment variables
for its operation. (That's not to say that a given implementation
cannot use environment variable settings, it's just that ISO C does
not /require/ it.)

So it's not a question of symbol names, but about requiring
certain environment variables to exist in the first place. On some
systems, the very notion of "environment variable" is an unknown
concept.

Also, it's an uphill battle to add X/Open or POSIX functionality to
the ISO C standard library. How would MS/Win32 applications
deal with them, for example, in light of the fact that the Win32
platform already has its own locale functions?
FWIW, I've taken a different approach in my various proposals for
ISO C library enhancements. I borrow the most useful and most
general functionality from several sources (primarily POSIX and
Win32, but also others) and invent an entirely new set of function
and variable names to embody them. That way, no single existing
implementation is favored over the others, but the functionality
still covers all (or most) of them.

See
http://david.tribble.com/letters.html#c-proposals

-drt
Oct 28 '08 #25
David R Tribble schrieb:
Also, it's an uphill battle to add X/Open or POSIX functionality to
the ISO C standard library. How would MS/Win32 applications
deal with them, for example, in light of the fact that the Win32
platform already has its own locale functions?
Is there a growing demand to complete the standard programming interfaces?
Are more extensions needed for locale data to express personal preferences?

Regards,
Markus
Oct 30 '08 #26

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Trevor Hardwick | last post by:
Hi Can you tell me why setting the assembly culture attribute to "" gives me "Language Neutral" for the file language property when viewed through windows explorer but creating an interop...
2
by: Dannie Chan | last post by:
Hi, I try to create a new application from VB.NET. Bottoms, text and output will show both english and Chinese. Should I use Chinese version or I still use English verion? If I use English...
0
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
8
by: Alien | last post by:
Say, I want to prevent user from inputting Russian character in username, how to deal with it? The codes I'm using now is: ------------------------------------------ for (...
9
by: aleplgr | last post by:
Hi! I'm trying to let the end-user select the language of the menues I'm showing him. To do that I've got this Selector class that shows the end user a combo box, a label and a button. In the combo...
2
by: maxinbjohn | last post by:
Dear friends, I am a Python programmer from Kerala, India. When I tried to run a simple python program which uses the Malayalam language (ml), import os import locale os.environ='ml' print...
6
by: Ole Nielsby | last post by:
Does C++ have a method of retrieving this? When launching my app, I want to select the appropriate language for ts GUI, based on the user's language setting. The frameworks wxWidgets and...
4
by: edgy | last post by:
Hello, I am a beginner with PHP, and I have made a language switcher on a site that I am looking for your feedback on. First of all, the page is http://www.mankar.ca My question regarding...
56
by: Adem | last post by:
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" The C++ Standard (ISO/IEC 14882, Second edition, 2003-10-15) says under...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.