summaryrefslogtreecommitdiff
path: root/gettext-tools/doc/gettextize.texi
blob: 8254b114ed8b4feebab190d3f94be1c7b8f83b25 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
The @code{gettextize} program is an interactive tool that helps the
maintainer of a package internationalized through GNU @code{gettext}.
It is used for two purposes:

@itemize @bullet
@item
As a wizard, when a package is modified to use GNU @code{gettext} for
the first time.

@item
As a migration tool, for upgrading the GNU @code{gettext} support in
a package from a previous to a newer version of GNU @code{gettext}.
@end itemize

This program performs the following tasks:

@itemize @bullet
@item
It copies into the package some files that are consistently and
identically needed in every package internationalized through
GNU @code{gettext}.

@item It performs as many of the tasks mentioned in the next section
@ref{Adjusting Files} as can be performed automatically.

@item It removes obsolete files and idioms used for previous GNU
@code{gettext} versions to the form recommended for the current GNU
@code{gettext} version.

@item It prints a summary of the tasks that ought to be done manually
and could not be done automatically by @code{gettextize}.
@end itemize

It can be invoked as follows:

@pindex gettextize
@cindex @code{gettextize} program, usage
@example
gettextize [ @var{option}@dots{} ] [ @var{directory} ]
@end example

@noindent
and accepts the following options:

@table @samp
@item -f
@itemx --force
@opindex -f@r{, @code{gettextize} option}
@opindex --force@r{, @code{gettextize} option}
Force replacement of files which already exist.

@item --intl
@opindex --intl@r{, @code{gettextize} option}
Install the libintl sources in a subdirectory named @file{intl/}.
This libintl will be used to provide internationalization on systems
that don't have GNU libintl installed.  If this option is omitted,
the call to @code{AM_GNU_GETTEXT} in @file{configure.ac} should read:
@samp{AM_GNU_GETTEXT([external])}, and internationalization will not
be enabled on systems lacking GNU gettext.

@item --po-dir=@var{dir}
@opindex --po-dir@r{, @code{gettextize} option}
Specify a directory containing PO files.  Such a directory contains the
translations into various languages of a particular POT file.  This
option can be specified multiple times, once for each translation domain.
If it is not specified, the directory named @file{po/} is updated.

@item --no-changelog
@opindex --no-changelog@r{, @code{gettextize} option}
Don't update or create ChangeLog files.  By default, @code{gettextize}
logs all changes (file additions, modifications and removals) in a
file called @samp{ChangeLog} in each affected directory.

@item --symlink
@opindex --symlink@r{, @code{gettextize} option}
Make symbolic links instead of copying the needed files.  This can be
useful to save a few kilobytes of disk space, but it requires extra
effort to create self-contained tarballs, it may disturb some mechanism
the maintainer applies to the sources, and it is likely to introduce
bugs when a newer version of @code{gettext} is installed on the system.

@item -n
@itemx --dry-run
@opindex -d@r{, @code{gettextize} option}
@opindex --dry-run@r{, @code{gettextize} option}
Print modifications but don't perform them.  All actions that
@code{gettextize} would normally execute are inhibited and instead only
listed on standard output.

@item --help
@opindex --help@r{, @code{gettextize} option}
Display this help and exit.

@item --version
@opindex --version@r{, @code{gettextize} option}
Output version information and exit.

@end table

If @var{directory} is given, this is the top level directory of a
package to prepare for using GNU @code{gettext}.  If not given, it
is assumed that the current directory is the top level directory of
such a package.

The program @code{gettextize} provides the following files.  However,
no existing file will be replaced unless the option @code{--force}
(@code{-f}) is specified.

@enumerate
@item
The @file{ABOUT-NLS} file is copied in the main directory of your package,
the one being at the top level.  This file gives the main indications
about how to install and use the Native Language Support features
of your program.  You might elect to use a more recent copy of this
@file{ABOUT-NLS} file than the one provided through @code{gettextize},
if you have one handy.  You may also fetch a more recent copy of file
@file{ABOUT-NLS} from Translation Project sites, and from most GNU
archive sites.

@item
A @file{po/} directory is created for eventually holding
all translation files, but initially only containing the file
@file{po/Makefile.in.in} from the GNU @code{gettext} distribution
(beware the double @samp{.in} in the file name) and a few auxiliary
files.  If the @file{po/} directory already exists, it will be preserved
along with the files it contains, and only @file{Makefile.in.in} and
the auxiliary files will be overwritten.

If @samp{--po-dir} has been specified, this holds for every directory
specified through @samp{--po-dir}, instead of @file{po/}.

@item
Only if @samp{--intl} has been specified:
A @file{intl/} directory is created and filled with most of the files
originally in the @file{intl/} directory of the GNU @code{gettext}
distribution.  Also, if option @code{--force} (@code{-f}) is given,
the @file{intl/} directory is emptied first.

@item
The file @file{config.rpath} is copied into the directory containing
configuration support files.  It is needed by the @code{AM_GNU_GETTEXT}
autoconf macro.

@item
Only if the project is using GNU @code{automake}:
A set of @code{autoconf} macro files is copied into the package's
@code{autoconf} macro repository, usually in a directory called @file{m4/}.
@end enumerate

If your site support symbolic links, @code{gettextize} will not
actually copy the files into your package, but establish symbolic
links instead.  This avoids duplicating the disk space needed in
all packages.  Merely using the @samp{-h} option while creating the
@code{tar} archive of your distribution will resolve each link by an
actual copy in the distribution archive.  So, to insist, you really
should use @samp{-h} option with @code{tar} within your @code{dist}
goal of your main @file{Makefile.in}.

Furthermore, @code{gettextize} will update all @file{Makefile.am} files
in each affected directory, as well as the top level @file{configure.ac}
or @file{configure.in} file.

It is interesting to understand that most new files for supporting
GNU @code{gettext} facilities in one package go in @file{intl/},
@file{po/} and @file{m4/} subdirectories.  One distinction between
@file{intl/} and the two other directories is that @file{intl/} is
meant to be completely identical in all packages using GNU @code{gettext},
while the other directories will mostly contain package dependent
files.

The @code{gettextize} program makes backup files for all files it
replaces or changes, and also write ChangeLog entries about these
changes.  This way, the careful maintainer can check after running
@code{gettextize} whether its changes are acceptable to him, and
possibly adjust them.  An exception to this rule is the @file{intl/}
directory, which is added or replaced or removed as a whole.

It is important to understand that @code{gettextize} can not do the
entire job of adapting a package for using GNU @code{gettext}.  The
amount of remaining work depends on whether the package uses GNU
@code{automake} or not.  But in any case, the maintainer should still
read the section @ref{Adjusting Files} after invoking @code{gettextize}.

In particular, if after using @samp{gettexize}, you get an error
@samp{AC_COMPILE_IFELSE was called before AC_GNU_SOURCE} or
@samp{AC_RUN_IFELSE was called before AC_GNU_SOURCE}, you can fix it
by modifying @file{configure.ac}, as described in @ref{configure.ac}.

It is also important to understand that @code{gettextize} is not part
of the GNU build system, in the sense that it should not be invoked
automatically, and not be invoked by someone who doesn't assume the
responsibilities of a package maintainer.  For the latter purpose, a
separate tool is provided, see @ref{autopoint Invocation}.