You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
53 lines
1.6 KiB
Gettext support for Tcl
|
|
=======================
|
|
|
|
The file `tcl_gettext.c' contains the first attempt to provide an
|
|
interface for Tcl. I know that TclX already supports `catgets', but
|
|
because GNU uses `gettext' and because I think `gettext' is the better
|
|
concept I wrote this file.
|
|
|
|
|
|
Unlike many other interpreter extension I haven't provided a
|
|
`tclAppInit.c' file. I have three reason: it's easy to write (see
|
|
Ousterhout's book), It will probably combined with other extensions
|
|
and so would be more or less useless. But the most important reason
|
|
is that I don't find Tcl useful without the dynamic loading introduced
|
|
in version 7.5.
|
|
|
|
The way I think you should use this module is to build a dynamic
|
|
object and load it at runtime with the command `load'. The following
|
|
transcript shows the way I work on my Linux/ELF box. Consult other
|
|
Tcl modules or a local wizard to see how it works for your system.
|
|
|
|
|
|
1. Compile the file to position independent object code:
|
|
|
|
gcc -fPIC -O3 -c tcl_gettext.c
|
|
|
|
(The file `tcl.h' from tcl7.5 or up and `libintl.h' as installed
|
|
from GNU gettext must be found in the path.)
|
|
|
|
2. Link the file to a shared object:
|
|
|
|
gcc -shared -o gettext.so tcl_gettext.o -lintl
|
|
|
|
(The system's or GNU gettext libintl.a must be found in the path
|
|
of the linker.)
|
|
|
|
3. Now we are ready to run:
|
|
|
|
bash> tclsh7.5
|
|
% load ./gettext.so Gettext
|
|
% textdomain "xxx"
|
|
% gettext "some string"
|
|
The translated form
|
|
% exit
|
|
bash>
|
|
|
|
|
|
If you have some ideas how to improve this or you found a bug, please
|
|
let me know.
|
|
|
|
Ulrich Drepper <drepper@gnu.ai.mit.edu>, 18. December 1995.
|
|
|