old-www/HOWTO/Danish-HOWTO-6.html

52 lines
2.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>The Linux Danish/International HOWTO: Programming tips for X11</TITLE>
<LINK HREF="Danish-HOWTO-7.html" REL=next>
<LINK HREF="Danish-HOWTO-5.html" REL=previous>
<LINK HREF="Danish-HOWTO.html#toc6" REL=contents>
</HEAD>
<BODY>
<A HREF="Danish-HOWTO-7.html">Next</A>
<A HREF="Danish-HOWTO-5.html">Previous</A>
<A HREF="Danish-HOWTO.html#toc6">Contents</A>
<HR>
<H2><A NAME="programming"></A> <A NAME="s6">6. Programming tips for X11</A><!--Danish!X programming--></H2>
<P>Displaying 8-bit charaters is easy. You can use them just as you would use
7-bit ASCII. Getting applications to accept input of special characters is
an entirely different matter.
<P>If you are using e.g. the Xt toolkit and a widget set like Motif you need
only add one line to your program. As your <B>first</B> call to Xt use
<CODE>XtSetLanguageProc</CODE>. Like this:
<PRE>
int main (int argc, char** argv)
{
...
XtSetLanguageProc (NULL, NULL, NULL);
top = XtAppInitialize ( ... );
...
}
</PRE>
<P>Now your program will automagically look up the <CODE>LC_CTYPE</CODE> variable
and interpret dead keys etc. according to the <CODE>Compose</CODE> tables in
<CODE>/usr/X11R6/lib/X11/locale/</CODE>. This should work for all Western European
keyboard layouts and is entirely portable. As XFree86 multilanguage support
gets better your program will also be useful in Eastern Europe and the
Middle East.
<P>This method of input is supported by Xt, Xlib and Motif v1.2 (and
higher.) According to the information I have available it is only partially
supported by Xaw. If you have further information on this subject I would like
to hear from you.
<P>This section was adapted from a more extensive discussion in Michael
Gschwind's Programming for Internationalization. See section
<A HREF="Danish-HOWTO-8.html#docs">Other documents of relevance</A> for a pointer to that document.
<P>
<HR>
<A HREF="Danish-HOWTO-7.html">Next</A>
<A HREF="Danish-HOWTO-5.html">Previous</A>
<A HREF="Danish-HOWTO.html#toc6">Contents</A>
</BODY>
</HTML>