LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-09-2007, 09:05 PM   #1
jaepi
Member
 
Registered: Apr 2007
Location: Urban Jungle
Distribution: Ubuntu
Posts: 189
Blog Entries: 1

Rep: Reputation: 30
Function for getting the language code in standard library


Hello there, do you have any idea how to get the user default language code id using standard library functions? There is in win32 (GetUserDefaultLCID) but I have to port it into the linux platform. Thanks
 
Old 12-10-2007, 01:33 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
What language are you talking about? C?

In linux (and most unices) there is no concept of a “default locale” AFAIK (besides the “C” or “POSIX” locale). For any given process, there is a “current locale” (the one it should currently use).

The accessing of the current locale is the same in ANSI C regardless of operating system: you use the functions described in §7.11 of the ISO 9899 document. In particular, you may set the locale using setlocale(). You may chose to use any of several categories of activation for the locale (including LC_TIME, LC_NUMERIC, LC_MONETARY, LC_CTYPE, LC_COLLATE, and LC_ALL plus any implementation-specific macros). If you want to obtain the name of the current setting of one of these categories, you pass NULL as the second argument of setlocale(). If you want to get the details of the current locale for application use, you use localeconv().

On POSIX systems (including linux) there is usually at least one more category (LC_MESSAGES) for message catalogs. You might use environment variables to run a program under a specific locale. Additionally, the return values of setlocale() or localeconv() should be copied before use, because they may be clobbered upon subsequent calls to those functions.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
list library function of a shared library .so powah Linux - General 7 10-25-2011 04:47 AM
Is there any tar equivalent library function which can be included in a "C" code bagav General 1 09-13-2006 01:16 PM
Sockets and standard I/O library failure_to Programming 0 05-22-2004 11:55 AM
what is the function library of the basic graphics library in rethat9.0? zerwolve Red Hat 0 04-29-2004 09:18 PM
C++ standard library. Thetargos Programming 8 10-09-2003 03:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration