summaryrefslogtreecommitdiffstats
path: root/misc/README-Tcl
blob: 7b9f6f95bd1b21d5fb195394dc4e249933114be8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
		       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.