blob: 8e258f2932d2b7181c120a958b7d7f7249b26283 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <locale.h>
#include <stdio.h>
/* You may have to unset the LANGUAGE environment variable for this to
work properly. */
int main(int argc, char* argv[argc+1]) {
perror("With C locale");
if (!setlocale(LC_ALL, ""))
perror("couldn't set locale");
else
perror("With default locale");
if (!setlocale(LC_MESSAGES, "C"))
perror("couldn't set locale");
else
perror("C locale, again");
if (argv[1] && !setlocale(LC_MESSAGES, argv[1]))
perror("couldn't set locale");
else
perror("new locale");
printf("commandline argument was '%s'\n", argv[1]);
}
|