Y
yogeshmk
I'm writing an application which is required to function with many
languages and also compile on Linux & windows. Here's how I find the
locale ..
# include <stdio.h>
# include <locale.h>
int
main(void)
{
unsigned char* loc = NULL;
loc = setlocale(LC_MESSAGES, NULL);
puts (loc);
return 0;
}
Depending upon what string 'loc' contains, I need to write "hello
world" (or any other message) in the corrosponding language (there are
separate header files with texts in different languages coded in a
struct.
I've ran this piece of code on RedHat linux (en_US.UTF-8), Windows XP
(??) and Ubuntu linux (on which the `locale` *command* returns
"en_IN.UTF-8" which is correct). However, I observe that the function
always returns "C" as the locale.
Q1. What explains this behaviour of 'setlocale()'
Q2. Any other way to find out the currently set language on the
computer?
cheers!
languages and also compile on Linux & windows. Here's how I find the
locale ..
# include <stdio.h>
# include <locale.h>
int
main(void)
{
unsigned char* loc = NULL;
loc = setlocale(LC_MESSAGES, NULL);
puts (loc);
return 0;
}
Depending upon what string 'loc' contains, I need to write "hello
world" (or any other message) in the corrosponding language (there are
separate header files with texts in different languages coded in a
struct.
I've ran this piece of code on RedHat linux (en_US.UTF-8), Windows XP
(??) and Ubuntu linux (on which the `locale` *command* returns
"en_IN.UTF-8" which is correct). However, I observe that the function
always returns "C" as the locale.
Q1. What explains this behaviour of 'setlocale()'
Q2. Any other way to find out the currently set language on the
computer?
cheers!