Mercurial > babel > old > babel-test
annotate doc/setup.txt @ 378:d3d862b0d600
Use item access to catalog messages in tests, so that they can be easily ported back to the 0.9.x branch.
author | cmlenz |
---|---|
date | Tue, 08 Jul 2008 20:58:02 +0000 |
parents | 3aa01d0355f7 |
children | b49ee8e78d69 |
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 ... | |
252 | 22 cmdclass = {'compile_catalog': babel.compile_catalog, |
23 'extract_messages': babel.extract_messages, | |
24 'init_catalog': babel.init_catalog, | |
25 'update_catalog': babel.update_catalog} | |
2 | 26 ) |
27 | |
28 | |
29 .. contents:: Contents | |
30 :depth: 2 | |
31 .. sectnum:: | |
32 | |
33 | |
160 | 34 compile_catalog |
35 =============== | |
36 | |
37 The ``compile_catalog`` command is similar to the GNU ``msgfmt`` tool, in that | |
38 it takes a message catalog from a PO file and compiles it to a binary MO file. | |
39 | |
40 If the command has been correctly installed or registered, a project's | |
41 ``setup.py`` script should allow you to use the command:: | |
42 | |
43 $ ./setup.py compile_catalog --help | |
44 Global options: | |
45 --verbose (-v) run verbosely (default) | |
46 --quiet (-q) run quietly (turns verbosity off) | |
47 --dry-run (-n) don't actually do anything | |
48 --help (-h) show detailed help message | |
49 | |
50 Options for 'compile_catalog' command: | |
51 ... | |
52 | |
53 Running the command will produce a PO template file:: | |
54 | |
55 $ ./setup.py compile_catalog --directory foobar/locale --locale pt_BR | |
56 running compile_catalog | |
57 compiling catalog to to foobar/locale/pt_BR/LC_MESSAGES/messages.mo | |
58 | |
59 | |
60 Options | |
61 ------- | |
62 | |
63 The ``compile_catalog`` command accepts the following options: | |
64 | |
319 | 65 +-----------------------------+---------------------------------------------+ |
66 | Option | Description | | |
67 +=============================+=============================================+ | |
68 | ``--domain`` | domain of the PO file (defaults to | | |
69 | | lower-cased project name) | | |
70 +-----------------------------+---------------------------------------------+ | |
71 | ``--directory`` (``-d``) | name of the base directory | | |
72 +-----------------------------+---------------------------------------------+ | |
73 | ``--input-file`` (``-i``) | name of the input file | | |
74 +-----------------------------+---------------------------------------------+ | |
75 | ``--output-file`` (``-o``) | name of the output file | | |
76 +-----------------------------+---------------------------------------------+ | |
77 | ``--locale`` (``-l``) | locale for the new localized string | | |
78 +-----------------------------+---------------------------------------------+ | |
79 | ``--use-fuzzy`` (``-f``) | also include "fuzzy" translations | | |
80 +-----------------------------+---------------------------------------------+ | |
81 | ``--statistics`` | print statistics about translations | | |
82 +-----------------------------+---------------------------------------------+ | |
160 | 83 |
84 If ``directory`` is specified, but ``output-file`` is not, the default filename | |
85 of the output file will be:: | |
86 | |
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
|
87 <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
|
88 |
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
|
89 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
|
90 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
|
91 and compiles each of them to MO files in the same directory. |
160 | 92 |
93 These options can either be specified on the command-line, or in the | |
94 ``setup.cfg`` file. | |
95 | |
96 | |
2 | 97 extract_messages |
98 ================ | |
99 | |
90 | 100 The ``extract_messages`` command is comparable to the GNU ``xgettext`` program: |
2 | 101 it can extract localizable messages from a variety of difference source files, |
102 and generate a PO (portable object) template file from the collected messages. | |
103 | |
160 | 104 If the command has been correctly installed or registered, a project's |
2 | 105 ``setup.py`` script should allow you to use the command:: |
106 | |
107 $ ./setup.py extract_messages --help | |
108 Global options: | |
109 --verbose (-v) run verbosely (default) | |
110 --quiet (-q) run quietly (turns verbosity off) | |
111 --dry-run (-n) don't actually do anything | |
112 --help (-h) show detailed help message | |
77 | 113 |
2 | 114 Options for 'extract_messages' command: |
90 | 115 ... |
2 | 116 |
51
7f61453c1bea
Fixed a bug regarding plural msgid's handling when writing the `.pot` file.
palgarvio
parents:
49
diff
changeset
|
117 Running the command will produce a PO template file:: |
2 | 118 |
49
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
119 $ ./setup.py extract_messages --output-file foobar/locale/messages.pot |
2 | 120 running extract_messages |
49
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
121 extracting messages from foobar/__init__.py |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
122 extracting messages from foobar/core.py |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
123 ... |
51
7f61453c1bea
Fixed a bug regarding plural msgid's handling when writing the `.pot` file.
palgarvio
parents:
49
diff
changeset
|
124 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
|
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 Method Mapping |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
128 -------------- |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
129 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
130 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
|
131 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
|
132 ``--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
|
133 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
|
134 function: |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
135 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
136 .. code-block:: python |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
137 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
138 setup(... |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
139 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
140 message_extractors = { |
62
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
141 '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
|
142 ('**.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
|
143 ('**/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
|
144 ('**/templates/**.txt', 'genshi', { |
144 | 145 'template_class': 'genshi.template:TextTemplate' |
62
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
146 }) |
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
147 ], |
49
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
148 }, |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
149 |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
150 ... |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
151 ) |
2 | 152 |
153 | |
154 Options | |
155 ------- | |
156 | |
90 | 157 The ``extract_messages`` command accepts the following options: |
2 | 158 |
49
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
159 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
160 | Option | Description | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
161 +=============================+==============================================+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
162 | ``--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
|
163 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
164 | ``--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
|
165 | | in addition to the defaults | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
166 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
167 | ``--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
|
168 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
169 | ``--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
|
170 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
171 | ``--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
|
172 | | filename and line number | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
173 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
174 | ``--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
|
175 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
176 | ``--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
|
177 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
178 | ``--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
|
179 +-----------------------------+----------------------------------------------+ |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
180 | ``--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
|
181 | | the output line width, into several lines | |
daf35e2ad044
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
182 +-----------------------------+----------------------------------------------+ |
62
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
183 | ``--input-dirs`` | directories that should be scanned for | |
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
184 | | messages | |
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
185 +-----------------------------+----------------------------------------------+ |
90 | 186 | ``--sort-output`` | generate sorted output (default False) | |
187 +-----------------------------+----------------------------------------------+ | |
188 | ``--sort-by-file`` | sort output by file location (default False) | | |
189 +-----------------------------+----------------------------------------------+ | |
190 | ``--msgid-bugs-address`` | set email address for message bug reports | | |
191 +-----------------------------+----------------------------------------------+ | |
192 | ``--copyright-holder`` | set copyright holder in output | | |
193 +-----------------------------+----------------------------------------------+ | |
194 | ``--add-comments (-c)`` | place comment block with TAG (or those | | |
195 | | preceding keyword lines) in output file. | | |
196 | | Separate multiple TAGs with commas(,) | | |
197 +-----------------------------+----------------------------------------------+ | |
198 | |
199 These options can either be specified on the command-line, or in the | |
200 ``setup.cfg`` file. In the latter case, the options above become entries of the | |
201 section ``[extract_messages]``, and the option names are changed to use | |
202 underscore characters instead of dashes, for example: | |
203 | |
204 .. code-block:: ini | |
205 | |
206 [extract_messages] | |
207 keywords = _, gettext, ngettext | |
208 mapping_file = babel.cfg | |
209 width = 80 | |
210 | |
211 This would be equivalent to invoking the command from the command-line as | |
212 follows:: | |
213 | |
214 $ setup.py extract_messages -k _ -k gettext -k ngettext -F mapping.cfg -w 80 | |
215 | |
216 Any path names are interpreted relative to the location of the ``setup.py`` | |
217 file. For boolean options, use "true" or "false" values. | |
218 | |
219 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
220 init_catalog |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
221 ============ |
90 | 222 |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
223 The ``init_catalog`` command is basically equivalent to the GNU ``msginit`` |
90 | 224 program: it creates a new translation catalog based on a PO template file (POT). |
225 | |
160 | 226 If the command has been correctly installed or registered, a project's |
90 | 227 ``setup.py`` script should allow you to use the command:: |
228 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
229 $ ./setup.py init_catalog --help |
90 | 230 Global options: |
231 --verbose (-v) run verbosely (default) | |
232 --quiet (-q) run quietly (turns verbosity off) | |
233 --dry-run (-n) don't actually do anything | |
234 --help (-h) show detailed help message | |
235 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
236 Options for 'init_catalog' command: |
90 | 237 ... |
238 | |
239 Running the command will produce a PO file:: | |
240 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
241 $ ./setup.py init_catalog -l fr -i foobar/locales/messages.pot \ |
90 | 242 -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
|
243 running init_catalog |
90 | 244 creating catalog 'foobar/locales/fr/messages.po' based on 'foobar/locales/messages.pot' |
245 | |
246 | |
247 Options | |
248 ------- | |
249 | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
250 The ``init_catalog`` command accepts the following options: |
90 | 251 |
319 | 252 +-----------------------------+---------------------------------------------+ |
253 | Option | Description | | |
254 +=============================+=============================================+ | |
255 | ``--domain`` | domain of the PO file (defaults to | | |
256 | | lower-cased project name) | | |
257 +-----------------------------+---------------------------------------------+ | |
258 | ``--input-file`` (``-i``) | name of the input file | | |
259 +-----------------------------+---------------------------------------------+ | |
260 | ``--output-dir`` (``-d``) | name of the output directory | | |
261 +-----------------------------+---------------------------------------------+ | |
262 | ``--output-file`` (``-o``) | name of the output file | | |
263 +-----------------------------+---------------------------------------------+ | |
264 | ``--locale`` | locale for the new localized string | | |
265 +-----------------------------+---------------------------------------------+ | |
90 | 266 |
267 If ``output-dir`` is specified, but ``output-file`` is not, the default filename | |
268 of the output file will be:: | |
269 | |
270 <output_dir>/<locale>/LC_MESSAGES/<domain>.po | |
271 | |
272 These options can either be specified on the command-line, or in the | |
273 ``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
|
274 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
275 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
276 update_catalog |
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 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
|
280 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
|
281 file (POT). |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
282 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
283 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
|
284 ``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
|
285 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
286 $ ./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
|
287 Global options: |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
288 --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
|
289 --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
|
290 --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
|
291 --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
|
292 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
293 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
|
294 ... |
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 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
|
297 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
298 $ ./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
|
299 -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
|
300 running update_catalog |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
301 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
|
302 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
303 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
304 Options |
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 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
|
308 |
319 | 309 +-------------------------------------+-------------------------------------+ |
310 | Option | Description | | |
311 +=====================================+=====================================+ | |
312 | ``--domain`` | domain of the PO file (defaults to | | |
313 | | lower-cased project name) | | |
314 +-------------------------------------+-------------------------------------+ | |
315 | ``--input-file`` (``-i``) | name of the input file | | |
316 +-------------------------------------+-------------------------------------+ | |
317 | ``--output-dir`` (``-d``) | name of the output directory | | |
318 +-------------------------------------+-------------------------------------+ | |
319 | ``--output-file`` (``-o``) | name of the output file | | |
320 +-------------------------------------+-------------------------------------+ | |
321 | ``--locale`` | locale for the new localized string | | |
322 +-------------------------------------+-------------------------------------+ | |
323 | ``--ignore-obsolete`` | do not include obsolete messages in | | |
324 | | the output | | |
325 +-------------------------------------+-------------------------------------+ | |
326 | ``--no-fuzzy-matching`` (``-N``) | do not use fuzzy matching | | |
327 +-------------------------------------+-------------------------------------+ | |
328 | ``--previous`` | keep previous msgids of translated | | |
329 | | messages | | |
330 +-------------------------------------+-------------------------------------+ | |
181
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
331 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
332 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
|
333 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
|
334 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
335 <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
|
336 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
337 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
|
338 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
|
339 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
|
340 |
9a1acb41e7dd
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
341 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
|
342 ``setup.cfg`` file. |