Date: Wed, 29 Apr 1998 19:15:53 -0700 (PDT) From: Gary Kline <kline@thought.org> To: freebsd-questions@FreeBSD.ORG (FreeBSD Mailing List) Subject: locale (( did this make it out?)) Message-ID: <199804300215.TAA01154@tao.thought.org>
next in thread | raw e-mail | index | archive | help
(( I send this mail mid-afternoon but never saw it on
the the list; thus this re-send. Sorry if it *did*
get out and I missed it.)) --gdk
Hello,
I'm interested in testing the locale library to see how to
(for example) print an error messsage or a date in German,
Danish, Norwegian. We've got the code in $lib/libc/locate,
and I see the data in /usr/share/locale, but so far my few
lines of code aren't doing very much.
Anyone know how to implement this?
I probably should add some pseudo-code so that folks
understand what I'm trying...and fumbling with.
In main I set the locale to de_DE:
... setlocale(LC_ALL, de_DE);
// malloc struct lconv *lp
lp = localeconv();
// then attempt to print the struct members:
printf ("lp->decimal_point = [%s]\n", lp->decimal_point);
printf ("lp->thousands_sep = [%s]\n", lp->thousands_sep);
printf ("lp->currency_symbol = [%s]\n", lp->currency_symbol);
I realize that several members are initialized to ``empty'';
but figured that these would be filled. (??)
Next, I try to set the TIME, and with fr_FR:
setlocale (LC_TIME, "fr_FR");
puts("...Now using strftime()");
strftime(tbuf, sizeof(tbuf), "%c", localtime(&when));
printf("tbuf = [%s]\n", tbuf);
tbuf contains a strictly US English string. PATH_LOCALE is
set. ...I'm obviously missing some steps here; don't know
what. Anybody??
thanks,
gary
--
Gary D. Kline kline@tao.thought.org Public service uNix
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804300215.TAA01154>
