This commit was generated by cvs2svn to compensate for changes in r150,
[gnokii.git] / Docs / gettext-howto
1 1. What do I need?
2
3 - a reasonably recent version of GNU gettext (e.g. 0.10.35)
4   Check the version using e.g. msgfmt -V
5
6 - autoconf
7
8 - gnokii distribution :-)
9
10 - if you have the variable LINGUAS in the environment
11   (most Red Hats have, no idea about other distributions),
12   unset it
13
14
15 2. How to make gnokii.pot file?
16
17 gnokii.pot file is a collection of all localizable strings
18 in the gnokii package. It will be generated automagically
19 and is included in the standard distribution package.
20
21 If you need to regenerate it, goto "po" directory,
22 remove gnokii.pot and say
23
24         make gnokii.pot
25
26
27 3.1 How to start translating for a new language?
28
29 First, you would like to contact the authors or write
30 to the mailing list - maybe there already is someone
31 working on this translation. 
32
33 If you get the OK from the maintainer, there are several
34 steps to do:
35
36 - add the code of your language to the ALL_LINGUAS line
37   in the configure.in file
38
39   Caution: the language code may differ from the country
40   code, e.g. czech language is cs, Czech Republic is cz 
41
42 - run autoconf to recreate configure script
43
44 - reconfigure the package (./configure)
45
46 - in the po directory, copy gnokii.pot to <country>.po
47
48 - start translating
49   
50
51 3.2 How to merge existing translations with the updated gnokii.pot?
52
53 This is simple. Rename the old file and use msgmerge to create
54 an updated one:
55
56         mv cs.po cs.po.bak
57         msgmerge -o cs.po cs.po.bak gnokii.pot
58
59
60 4. How to generate a .mo file
61
62 When you say make in the po directory, all existing
63 translations will be generated. The suffix will be .gmo.
64
65 If you want to do this manually, use the msgfmt utility, e.g.
66
67         msgfmt -o cs.mo -v cs.po 
68
69
70 5. How to install the files
71
72 Again, the makefile takes care of this. Simply use (as root)
73
74         make install
75
76 in the po directory. If you want to do this manually (and/or
77 for your language only), move the .mo file to
78 /usr/share/locale/<your locale>/LC_MESSAGES/gnokii.mo 
79
80
81 I'm from Czech republic, so I did (well, I did not, but if you would
82 like to localize gnokii, you should :-):
83
84         cd po
85         make gnokii.pot
86         cp gnokii.pot cs.po
87         <translating messages in cs.po>
88         <checking the translations using> msgfmt -o cs.mo -v cs.po
89         make
90         make install
91
92 And now:
93
94 SnowWhite:/tmp/gnokii$ export LC_MESSAGES=cs_CZ
95 SnowWhite:/tmp/gnokii$ ./gnokii --version
96 GNOKII Version 0.3.1 Copyright (C) Hugh Blemings 1999. <hugh@linuxcare.com>
97         Kompilace: 19:09:02 Mar 13 1999 pro model 6110 na portu /dev/ttyS0 
98 SnowWhite:/tmp/gnokii$ 
99
100 The second line is in czech language :-) There are some problems - for
101 example with "Mar" which is substitute by the C preprocessor.
102
103 6. How to use locale in the gnokii code
104
105 It's simple. Instead uf using:
106 "some string"
107 use:
108 _("some string")
109
110 In some cases _() cannot be used but the text still needs to be localized.
111 In such cases use:
112 N_("some string")
113 For more detailes refer to gettext info pages.
114
115 When sending us the patches and writing code for gnokii follow the rules:
116  - do NOT translate DEBUG output (usually done by dprintf()),
117  - translate all other output
118  - do not output to stdout, unless you are in the application level code
119  (gnokii/*.c, gnokiid/*.c, xgnokii/*.c, smsd/*.c)
120
121 -- 
122 $Id$
123 Pavel Janik
124 Pawel Kot