← Back to davo.co
aboutsummaryrefslogtreecommitdiffstats
path: root/locale.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale.c')
-rw-r--r--locale.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/locale.c b/locale.c
new file mode 100644
index 0000000..8e258f2
--- /dev/null
+++ b/locale.c
@@ -0,0 +1,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]);
+}