Mercurial > babel > old > babel-test
annotate doc/setup.txt @ 227:01dd895f396c
Fix tests broken by [233], and add new tests.
author | cmlenz |
---|---|
date | Fri, 20 Jul 2007 16:20:43 +0000 |
parents | cf09490f22b3 |
children | 318394721dc6 |
rev | line source |
---|---|
2 | 1 .. -*- mode: rst; encoding: utf-8 -*- |
2 | |
3 ================================ | |
4 Distutils/Setuptools Integration | |
5 ================================ | |
6 | |
7 Babel provides commands for integration into ``setup.py`` scripts, based on | |
8 either the ``distutils`` package that is part of the Python standard library, | |
9 or the third-party ``setuptools`` package. | |
10 | |
11 These commands are available by default when Babel has been properly installed, | |
12 and ``setup.py`` is using ``setuptools``. For projects that use plain old | |
40 | 13 ``distutils``, the commands need to be registered explicitly, for example: |
14 | |
15 .. code-block:: python | |
2 | 16 |
17 from distutils.core import setup | |
54
b3395b285104
Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents:
51
diff
changeset
|
18 from babel.messages import frontend as babel |
2 | 19 |
20 setup( | |
21 ... | |
160 | 22 cmd_class = {'compile_catalog': babel.compile_catalog, |
23 'extract_messages': babel.extract_messages, | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
24 'init_catalog': babel.init_catalog} |
2 | 25 ) |
26 | |
27 | |
28 .. contents:: Contents | |
29 :depth: 2 | |
30 .. sectnum:: | |
31 | |
32 | |
160 | 33 compile_catalog |
34 =============== | |
35 | |
36 The ``compile_catalog`` command is similar to the GNU ``msgfmt`` tool, in that | |
37 it takes a message catalog from a PO file and compiles it to a binary MO file. | |
38 | |
39 If the command has been correctly installed or registered, a project's | |
40 ``setup.py`` script should allow you to use the command:: | |
41 | |
42 $ ./setup.py compile_catalog --help | |
43 Global options: | |
44 --verbose (-v) run verbosely (default) | |
45 --quiet (-q) run quietly (turns verbosity off) | |
46 --dry-run (-n) don't actually do anything | |
47 --help (-h) show detailed help message | |
48 | |
49 Options for 'compile_catalog' command: | |
50 ... | |
51 | |
52 Running the command will produce a PO template file:: | |
53 | |
54 $ ./setup.py compile_catalog --directory foobar/locale --locale pt_BR | |
55 running compile_catalog | |
56 compiling catalog to to foobar/locale/pt_BR/LC_MESSAGES/messages.mo | |
57 | |
58 | |
59 Options | |
60 ------- | |
61 | |
62 The ``compile_catalog`` command accepts the following options: | |
63 | |
64 +-----------------------------+----------------------------------------------+ | |
65 | Option | Description | | |
66 +=============================+==============================================+ | |
67 | ``--domain`` | domain of the PO file (defaults to | | |
68 | | lower-cased project name) | | |
69 +-----------------------------+----------------------------------------------+ | |
70 | ``--directory`` (``-d``) | name of the base directory | | |
71 +-----------------------------+----------------------------------------------+ | |
72 | ``--input-file`` (``-i``) | name of the input file | | |
73 +-----------------------------+----------------------------------------------+ | |
74 | ``--output-file`` (``-o``) | name of the output file | | |
75 +-----------------------------+----------------------------------------------+ | |
76 | ``--locale`` | locale for the new localized string | | |
77 +-----------------------------+----------------------------------------------+ | |
78 | ``--use-fuzzy`` | also include "fuzzy" translations | | |
79 +-----------------------------+----------------------------------------------+ | |
80 | |
81 If ``directory`` is specified, but ``output-file`` is not, the default filename | |
82 of the output file will be:: | |
83 | |
177
a7766f92f944
* Instead of an extra `compile-all` option on the `compile` (or `compile_catalog`) command, compilation of all catalogs is performed when neither an `input_file` nor a `locale` is specified.
cmlenz
parents:
160
diff
changeset
|
84 <directory>/<locale>/LC_MESSAGES/<domain>.mo |
a7766f92f944
* Instead of an extra `compile-all` option on the `compile` (or `compile_catalog`) command, compilation of all catalogs is performed when neither an `input_file` nor a `locale` is specified.
cmlenz
parents:
160
diff
changeset
|
85 |
a7766f92f944
* Instead of an extra `compile-all` option on the `compile` (or `compile_catalog`) command, compilation of all catalogs is performed when neither an `input_file` nor a `locale` is specified.
cmlenz
parents:
160
diff
changeset
|
86 If neither the ``input_file`` nor the ``locale`` option is set, this command |
a7766f92f944
* Instead of an extra `compile-all` option on the `compile` (or `compile_catalog`) command, compilation of all catalogs is performed when neither an `input_file` nor a `locale` is specified.
cmlenz
parents:
160
diff
changeset
|
87 looks for all catalog files in the base directory that match the given domain, |
a7766f92f944
* Instead of an extra `compile-all` option on the `compile` (or `compile_catalog`) command, compilation of all catalogs is performed when neither an `input_file` nor a `locale` is specified.
cmlenz
parents:
160
diff
changeset
|
88 and compiles each of them to MO files in the same directory. |
160 | 89 |
90 These options can either be specified on the command-line, or in the | |
91 ``setup.cfg`` file. | |
92 | |
93 | |
2 | 94 extract_messages |
95 ================ | |
96 | |
90 | 97 The ``extract_messages`` command is comparable to the GNU ``xgettext`` program: |
2 | 98 it can extract localizable messages from a variety of difference source files, |
99 and generate a PO (portable object) template file from the collected messages. | |
100 | |
160 | 101 If the command has been correctly installed or registered, a project's |
2 | 102 ``setup.py`` script should allow you to use the command:: |
103 | |
104 $ ./setup.py extract_messages --help | |
105 Global options: | |
106 --verbose (-v) run verbosely (default) | |
107 --quiet (-q) run quietly (turns verbosity off) | |
108 --dry-run (-n) don't actually do anything | |
109 --help (-h) show detailed help message | |
77 | 110 |
2 | 111 Options for 'extract_messages' command: |
90 | 112 ... |
2 | 113 |
51
7f61453c1bea
Fixed a bug regarding plural msgid's handling when writing the `.pot` file.
palgarvio
parents:
49
diff
changeset
|
114 Running the command will produce a PO template file:: |
2 | 115 |
49
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
116 $ ./setup.py extract_messages --output-file foobar/locale/messages.pot |
2 | 117 running extract_messages |
49
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
118 extracting messages from foobar/__init__.py |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
119 extracting messages from foobar/core.py |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
120 ... |
51
7f61453c1bea
Fixed a bug regarding plural msgid's handling when writing the `.pot` file.
palgarvio
parents:
49
diff
changeset
|
121 writing PO template file to foobar/locale/messages.pot |
49
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
122 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
123 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
124 Method Mapping |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
125 -------------- |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
126 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
127 The mapping of file patterns to extraction methods (and options) can be |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
128 specified using a configuration file that is pointed to using the |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
129 ``--mapping-file`` option shown above. Alternatively, you can configure the |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
130 mapping directly in ``setup.py`` using a keyword argument to the ``setup()`` |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
131 function: |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
132 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
133 .. code-block:: python |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
134 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
135 setup(... |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
136 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
137 message_extractors = { |
62
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
138 'foobar': [ |
117
41506e62701f
Made new frontend tests more ''unit-y'', i.e. calling the APIs directly instead of launching the scripts.
cmlenz
parents:
90
diff
changeset
|
139 ('**.py', 'python', None), |
41506e62701f
Made new frontend tests more ''unit-y'', i.e. calling the APIs directly instead of launching the scripts.
cmlenz
parents:
90
diff
changeset
|
140 ('**/templates/**.html', 'genshi', None), |
41506e62701f
Made new frontend tests more ''unit-y'', i.e. calling the APIs directly instead of launching the scripts.
cmlenz
parents:
90
diff
changeset
|
141 ('**/templates/**.txt', 'genshi', { |
144 | 142 'template_class': 'genshi.template:TextTemplate' |
62
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
143 }) |
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
144 ], |
49
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
145 }, |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
146 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
147 ... |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
148 ) |
2 | 149 |
150 | |
151 Options | |
152 ------- | |
153 | |
90 | 154 The ``extract_messages`` command accepts the following options: |
2 | 155 |
49
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
156 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
157 | Option | Description | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
158 +=============================+==============================================+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
159 | ``--charset`` | charset to use in the output file | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
160 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
161 | ``--keywords`` (``-k``) | space-separated list of keywords to look for | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
162 | | in addition to the defaults | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
163 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
164 | ``--no-default-keywords`` | do not include the default keywords | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
165 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
166 | ``--mapping-file`` (``-F``) | path to the mapping configuration file | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
167 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
168 | ``--no-location`` | do not include location comments with | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
169 | | filename and line number | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
170 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
171 | ``--omit-header`` | do not include msgid "" entry in header | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
172 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
173 | ``--output-file`` (``-o``) | name of the output file | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
174 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
175 | ``--width`` (``-w``) | set output line width (default 76) | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
176 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
177 | ``--no-wrap`` | do not break long message lines, longer than | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
178 | | the output line width, into several lines | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
179 +-----------------------------+----------------------------------------------+ |
62
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
180 | ``--input-dirs`` | directories that should be scanned for | |
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
181 | | messages | |
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
182 +-----------------------------+----------------------------------------------+ |
90 | 183 | ``--sort-output`` | generate sorted output (default False) | |
184 +-----------------------------+----------------------------------------------+ | |
185 | ``--sort-by-file`` | sort output by file location (default False) | | |
186 +-----------------------------+----------------------------------------------+ | |
187 | ``--msgid-bugs-address`` | set email address for message bug reports | | |
188 +-----------------------------+----------------------------------------------+ | |
189 | ``--copyright-holder`` | set copyright holder in output | | |
190 +-----------------------------+----------------------------------------------+ | |
191 | ``--add-comments (-c)`` | place comment block with TAG (or those | | |
192 | | preceding keyword lines) in output file. | | |
193 | | Separate multiple TAGs with commas(,) | | |
194 +-----------------------------+----------------------------------------------+ | |
195 | |
196 These options can either be specified on the command-line, or in the | |
197 ``setup.cfg`` file. In the latter case, the options above become entries of the | |
198 section ``[extract_messages]``, and the option names are changed to use | |
199 underscore characters instead of dashes, for example: | |
200 | |
201 .. code-block:: ini | |
202 | |
203 [extract_messages] | |
204 keywords = _, gettext, ngettext | |
205 mapping_file = babel.cfg | |
206 width = 80 | |
207 | |
208 This would be equivalent to invoking the command from the command-line as | |
209 follows:: | |
210 | |
211 $ setup.py extract_messages -k _ -k gettext -k ngettext -F mapping.cfg -w 80 | |
212 | |
213 Any path names are interpreted relative to the location of the ``setup.py`` | |
214 file. For boolean options, use "true" or "false" values. | |
215 | |
216 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
217 init_catalog |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
218 ============ |
90 | 219 |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
220 The ``init_catalog`` command is basically equivalent to the GNU ``msginit`` |
90 | 221 program: it creates a new translation catalog based on a PO template file (POT). |
222 | |
160 | 223 If the command has been correctly installed or registered, a project's |
90 | 224 ``setup.py`` script should allow you to use the command:: |
225 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
226 $ ./setup.py init_catalog --help |
90 | 227 Global options: |
228 --verbose (-v) run verbosely (default) | |
229 --quiet (-q) run quietly (turns verbosity off) | |
230 --dry-run (-n) don't actually do anything | |
231 --help (-h) show detailed help message | |
232 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
233 Options for 'init_catalog' command: |
90 | 234 ... |
235 | |
236 Running the command will produce a PO file:: | |
237 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
238 $ ./setup.py init_catalog -l fr -i foobar/locales/messages.pot \ |
90 | 239 -o foobar/locales/fr/messages.po |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
240 running init_catalog |
90 | 241 creating catalog 'foobar/locales/fr/messages.po' based on 'foobar/locales/messages.pot' |
242 | |
243 | |
244 Options | |
245 ------- | |
246 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
247 The ``init_catalog`` command accepts the following options: |
90 | 248 |
249 +-----------------------------+----------------------------------------------+ | |
250 | Option | Description | | |
251 +=============================+==============================================+ | |
252 | ``--domain`` | domain of the PO file (defaults to | | |
253 | | lower-cased project name) | | |
254 +-----------------------------+----------------------------------------------+ | |
255 | ``--input-file`` (``-i``) | name of the input file | | |
256 +-----------------------------+----------------------------------------------+ | |
257 | ``--output-dir`` (``-d``) | name of the output directory | | |
258 +-----------------------------+----------------------------------------------+ | |
259 | ``--output-file`` (``-o``) | name of the output file | | |
260 +-----------------------------+----------------------------------------------+ | |
261 | ``--locale`` | locale for the new localized string | | |
262 +-----------------------------+----------------------------------------------+ | |
263 | ``--omit-header`` | do not include msgid "" entry in header | | |
264 +-----------------------------+----------------------------------------------+ | |
265 | ``--first-author`` | name of the first author | | |
266 +-----------------------------+----------------------------------------------+ | |
267 | ``--first-author-email`` | email address of the first author | | |
268 +-----------------------------+----------------------------------------------+ | |
269 | |
270 If ``output-dir`` is specified, but ``output-file`` is not, the default filename | |
271 of the output file will be:: | |
272 | |
273 <output_dir>/<locale>/LC_MESSAGES/<domain>.po | |
274 | |
275 These options can either be specified on the command-line, or in the | |
276 ``setup.cfg`` file. | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
277 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
278 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
279 update_catalog |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
280 ============== |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
281 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
282 The ``update_catalog`` command is basically equivalent to the GNU ``msgmerge`` |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
283 program: it updates an existing translations catalog based on a PO template |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
284 file (POT). |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
285 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
286 If the command has been correctly installed or registered, a project's |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
287 ``setup.py`` script should allow you to use the command:: |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
288 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
289 $ ./setup.py update_catalog --help |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
290 Global options: |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
291 --verbose (-v) run verbosely (default) |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
292 --quiet (-q) run quietly (turns verbosity off) |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
293 --dry-run (-n) don't actually do anything |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
294 --help (-h) show detailed help message |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
295 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
296 Options for 'update_catalog' command: |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
297 ... |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
298 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
299 Running the command will update a PO file:: |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
300 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
301 $ ./setup.py update_catalog -l fr -i foobar/locales/messages.pot \ |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
302 -o foobar/locales/fr/messages.po |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
303 running update_catalog |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
304 updating catalog 'foobar/locales/fr/messages.po' based on 'foobar/locales/messages.pot' |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
305 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
306 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
307 Options |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
308 ------- |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
309 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
310 The ``update_catalog`` command accepts the following options: |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
311 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
312 +-----------------------------+----------------------------------------------+ |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
313 | Option | Description | |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
314 +=============================+==============================================+ |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
315 | ``--domain`` | domain of the PO file (defaults to | |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
316 | | lower-cased project name) | |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
317 +-----------------------------+----------------------------------------------+ |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
318 | ``--input-file`` (``-i``) | name of the input file | |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
319 +-----------------------------+----------------------------------------------+ |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
320 | ``--output-dir`` (``-d``) | name of the output directory | |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
321 +-----------------------------+----------------------------------------------+ |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
322 | ``--output-file`` (``-o``) | name of the output file | |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
323 +-----------------------------+----------------------------------------------+ |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
324 | ``--locale`` | locale for the new localized string | |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
325 +-----------------------------+----------------------------------------------+ |
191
cf09490f22b3
Add an option to the frontend commands for catalog updating that removes completely any obsolete messages, instead of putting them comments.
cmlenz
parents:
181
diff
changeset
|
326 | ``--ignore-obsolete`` | do not include obsolete messages in the | |
cf09490f22b3
Add an option to the frontend commands for catalog updating that removes completely any obsolete messages, instead of putting them comments.
cmlenz
parents:
181
diff
changeset
|
327 | | output | |
cf09490f22b3
Add an option to the frontend commands for catalog updating that removes completely any obsolete messages, instead of putting them comments.
cmlenz
parents:
181
diff
changeset
|
328 +-----------------------------+----------------------------------------------+ |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
329 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
330 If ``output-dir`` is specified, but ``output-file`` is not, the default filename |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
331 of the output file will be:: |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
332 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
333 <output_dir>/<locale>/LC_MESSAGES/<domain>.po |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
334 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
335 If neither the ``input_file`` nor the ``locale`` option is set, this command |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
336 looks for all catalog files in the base directory that match the given domain, |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
337 and updates each of them. |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
338 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
339 These options can either be specified on the command-line, or in the |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
340 ``setup.cfg`` file. |