Mercurial > babel > mirror
annotate doc/setup.txt @ 316:c976934be834 stable-0.9.x
Ported [349] to 0.9.x branch.
author | cmlenz |
---|---|
date | Fri, 01 Feb 2008 15:25:20 +0000 |
parents | a6ffb18d0c39 |
children | b1201cfc4190 |
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
7dbcbc3f07e0
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 | |
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`` | locale for the new localized string | | |
78 +-----------------------------+----------------------------------------------+ | |
79 | ``--use-fuzzy`` | also include "fuzzy" translations | | |
80 +-----------------------------+----------------------------------------------+ | |
81 | |
82 If ``directory`` is specified, but ``output-file`` is not, the default filename | |
83 of the output file will be:: | |
84 | |
177
beb8a9eabe6d
* 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 <directory>/<locale>/LC_MESSAGES/<domain>.mo |
beb8a9eabe6d
* 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 |
beb8a9eabe6d
* 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 If neither the ``input_file`` nor the ``locale`` option is set, this command |
beb8a9eabe6d
* 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 looks for all catalog files in the base directory that match the given domain, |
beb8a9eabe6d
* 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 and compiles each of them to MO files in the same directory. |
160 | 90 |
91 These options can either be specified on the command-line, or in the | |
92 ``setup.cfg`` file. | |
93 | |
94 | |
2 | 95 extract_messages |
96 ================ | |
97 | |
90 | 98 The ``extract_messages`` command is comparable to the GNU ``xgettext`` program: |
2 | 99 it can extract localizable messages from a variety of difference source files, |
100 and generate a PO (portable object) template file from the collected messages. | |
101 | |
160 | 102 If the command has been correctly installed or registered, a project's |
2 | 103 ``setup.py`` script should allow you to use the command:: |
104 | |
105 $ ./setup.py extract_messages --help | |
106 Global options: | |
107 --verbose (-v) run verbosely (default) | |
108 --quiet (-q) run quietly (turns verbosity off) | |
109 --dry-run (-n) don't actually do anything | |
110 --help (-h) show detailed help message | |
77 | 111 |
2 | 112 Options for 'extract_messages' command: |
90 | 113 ... |
2 | 114 |
51
d484eb9a70d5
Fixed a bug regarding plural msgid's handling when writing the `.pot` file.
palgarvio
parents:
49
diff
changeset
|
115 Running the command will produce a PO template file:: |
2 | 116 |
49
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
117 $ ./setup.py extract_messages --output-file foobar/locale/messages.pot |
2 | 118 running extract_messages |
49
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
119 extracting messages from foobar/__init__.py |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
120 extracting messages from foobar/core.py |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
121 ... |
51
d484eb9a70d5
Fixed a bug regarding plural msgid's handling when writing the `.pot` file.
palgarvio
parents:
49
diff
changeset
|
122 writing PO template file to foobar/locale/messages.pot |
49
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
123 |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
124 |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
125 Method Mapping |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
126 -------------- |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
127 |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
128 The mapping of file patterns to extraction methods (and options) can be |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
129 specified using a configuration file that is pointed to using the |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
130 ``--mapping-file`` option shown above. Alternatively, you can configure the |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
131 mapping directly in ``setup.py`` using a keyword argument to the ``setup()`` |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
132 function: |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
133 |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
134 .. code-block:: python |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
135 |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
136 setup(... |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
137 |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
138 message_extractors = { |
62
2df27f49c320
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
139 'foobar': [ |
117
e1dffa3423a0
Made new frontend tests more ''unit-y'', i.e. calling the APIs directly instead of launching the scripts.
cmlenz
parents:
90
diff
changeset
|
140 ('**.py', 'python', None), |
e1dffa3423a0
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/**.html', 'genshi', None), |
e1dffa3423a0
Made new frontend tests more ''unit-y'', i.e. calling the APIs directly instead of launching the scripts.
cmlenz
parents:
90
diff
changeset
|
142 ('**/templates/**.txt', 'genshi', { |
144 | 143 'template_class': 'genshi.template:TextTemplate' |
62
2df27f49c320
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
144 }) |
2df27f49c320
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
145 ], |
49
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
146 }, |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
147 |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
148 ... |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
149 ) |
2 | 150 |
151 | |
152 Options | |
153 ------- | |
154 | |
90 | 155 The ``extract_messages`` command accepts the following options: |
2 | 156 |
49
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
157 +-----------------------------+----------------------------------------------+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
158 | Option | Description | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
159 +=============================+==============================================+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
160 | ``--charset`` | charset to use in the output file | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
161 +-----------------------------+----------------------------------------------+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
162 | ``--keywords`` (``-k``) | space-separated list of keywords to look for | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
163 | | in addition to the defaults | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
164 +-----------------------------+----------------------------------------------+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
165 | ``--no-default-keywords`` | do not include the default keywords | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
166 +-----------------------------+----------------------------------------------+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
167 | ``--mapping-file`` (``-F``) | path to the mapping configuration file | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
168 +-----------------------------+----------------------------------------------+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
169 | ``--no-location`` | do not include location comments with | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
170 | | filename and line number | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
171 +-----------------------------+----------------------------------------------+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
172 | ``--omit-header`` | do not include msgid "" entry in header | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
173 +-----------------------------+----------------------------------------------+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
174 | ``--output-file`` (``-o``) | name of the output file | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
175 +-----------------------------+----------------------------------------------+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
176 | ``--width`` (``-w``) | set output line width (default 76) | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
177 +-----------------------------+----------------------------------------------+ |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
178 | ``--no-wrap`` | do not break long message lines, longer than | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
179 | | the output line width, into several lines | |
37bd476dafe4
Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents:
40
diff
changeset
|
180 +-----------------------------+----------------------------------------------+ |
62
2df27f49c320
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
181 | ``--input-dirs`` | directories that should be scanned for | |
2df27f49c320
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
182 | | messages | |
2df27f49c320
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
54
diff
changeset
|
183 +-----------------------------+----------------------------------------------+ |
90 | 184 | ``--sort-output`` | generate sorted output (default False) | |
185 +-----------------------------+----------------------------------------------+ | |
186 | ``--sort-by-file`` | sort output by file location (default False) | | |
187 +-----------------------------+----------------------------------------------+ | |
188 | ``--msgid-bugs-address`` | set email address for message bug reports | | |
189 +-----------------------------+----------------------------------------------+ | |
190 | ``--copyright-holder`` | set copyright holder in output | | |
191 +-----------------------------+----------------------------------------------+ | |
192 | ``--add-comments (-c)`` | place comment block with TAG (or those | | |
193 | | preceding keyword lines) in output file. | | |
194 | | Separate multiple TAGs with commas(,) | | |
195 +-----------------------------+----------------------------------------------+ | |
196 | |
197 These options can either be specified on the command-line, or in the | |
198 ``setup.cfg`` file. In the latter case, the options above become entries of the | |
199 section ``[extract_messages]``, and the option names are changed to use | |
200 underscore characters instead of dashes, for example: | |
201 | |
202 .. code-block:: ini | |
203 | |
204 [extract_messages] | |
205 keywords = _, gettext, ngettext | |
206 mapping_file = babel.cfg | |
207 width = 80 | |
208 | |
209 This would be equivalent to invoking the command from the command-line as | |
210 follows:: | |
211 | |
212 $ setup.py extract_messages -k _ -k gettext -k ngettext -F mapping.cfg -w 80 | |
213 | |
214 Any path names are interpreted relative to the location of the ``setup.py`` | |
215 file. For boolean options, use "true" or "false" values. | |
216 | |
217 | |
181
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
218 init_catalog |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
219 ============ |
90 | 220 |
181
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
221 The ``init_catalog`` command is basically equivalent to the GNU ``msginit`` |
90 | 222 program: it creates a new translation catalog based on a PO template file (POT). |
223 | |
160 | 224 If the command has been correctly installed or registered, a project's |
90 | 225 ``setup.py`` script should allow you to use the command:: |
226 | |
181
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
227 $ ./setup.py init_catalog --help |
90 | 228 Global options: |
229 --verbose (-v) run verbosely (default) | |
230 --quiet (-q) run quietly (turns verbosity off) | |
231 --dry-run (-n) don't actually do anything | |
232 --help (-h) show detailed help message | |
233 | |
181
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
234 Options for 'init_catalog' command: |
90 | 235 ... |
236 | |
237 Running the command will produce a PO file:: | |
238 | |
181
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
239 $ ./setup.py init_catalog -l fr -i foobar/locales/messages.pot \ |
90 | 240 -o foobar/locales/fr/messages.po |
181
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
241 running init_catalog |
90 | 242 creating catalog 'foobar/locales/fr/messages.po' based on 'foobar/locales/messages.pot' |
243 | |
244 | |
245 Options | |
246 ------- | |
247 | |
181
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
248 The ``init_catalog`` command accepts the following options: |
90 | 249 |
250 +-----------------------------+----------------------------------------------+ | |
251 | Option | Description | | |
252 +=============================+==============================================+ | |
253 | ``--domain`` | domain of the PO file (defaults to | | |
254 | | lower-cased project name) | | |
255 +-----------------------------+----------------------------------------------+ | |
256 | ``--input-file`` (``-i``) | name of the input file | | |
257 +-----------------------------+----------------------------------------------+ | |
258 | ``--output-dir`` (``-d``) | name of the output directory | | |
259 +-----------------------------+----------------------------------------------+ | |
260 | ``--output-file`` (``-o``) | name of the output file | | |
261 +-----------------------------+----------------------------------------------+ | |
262 | ``--locale`` | locale for the new localized string | | |
263 +-----------------------------+----------------------------------------------+ | |
264 | ``--omit-header`` | do not include msgid "" entry in header | | |
265 +-----------------------------+----------------------------------------------+ | |
266 | ``--first-author`` | name of the first author | | |
267 +-----------------------------+----------------------------------------------+ | |
268 | ``--first-author-email`` | email address of the first author | | |
269 +-----------------------------+----------------------------------------------+ | |
270 | |
271 If ``output-dir`` is specified, but ``output-file`` is not, the default filename | |
272 of the output file will be:: | |
273 | |
274 <output_dir>/<locale>/LC_MESSAGES/<domain>.po | |
275 | |
276 These options can either be specified on the command-line, or in the | |
277 ``setup.cfg`` file. | |
181
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
278 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
279 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
280 update_catalog |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
281 ============== |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
282 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
283 The ``update_catalog`` command is basically equivalent to the GNU ``msgmerge`` |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
284 program: it updates an existing translations catalog based on a PO template |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
285 file (POT). |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
286 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
287 If the command has been correctly installed or registered, a project's |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
288 ``setup.py`` script should allow you to use the command:: |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
289 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
290 $ ./setup.py update_catalog --help |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
291 Global options: |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
292 --verbose (-v) run verbosely (default) |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
293 --quiet (-q) run quietly (turns verbosity off) |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
294 --dry-run (-n) don't actually do anything |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
295 --help (-h) show detailed help message |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
296 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
297 Options for 'update_catalog' command: |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
298 ... |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
299 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
300 Running the command will update a PO file:: |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
301 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
302 $ ./setup.py update_catalog -l fr -i foobar/locales/messages.pot \ |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
303 -o foobar/locales/fr/messages.po |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
304 running update_catalog |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
305 updating catalog 'foobar/locales/fr/messages.po' based on 'foobar/locales/messages.pot' |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
306 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
307 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
308 Options |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
309 ------- |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
310 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
311 The ``update_catalog`` command accepts the following options: |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
312 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
313 +-----------------------------+----------------------------------------------+ |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
314 | Option | Description | |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
315 +=============================+==============================================+ |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
316 | ``--domain`` | domain of the PO file (defaults to | |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
317 | | lower-cased project name) | |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
318 +-----------------------------+----------------------------------------------+ |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
319 | ``--input-file`` (``-i``) | name of the input file | |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
320 +-----------------------------+----------------------------------------------+ |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
321 | ``--output-dir`` (``-d``) | name of the output directory | |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
322 +-----------------------------+----------------------------------------------+ |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
323 | ``--output-file`` (``-o``) | name of the output file | |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
324 +-----------------------------+----------------------------------------------+ |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
325 | ``--locale`` | locale for the new localized string | |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
326 +-----------------------------+----------------------------------------------+ |
191
c171a0041ad2
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 | ``--ignore-obsolete`` | do not include obsolete messages in the | |
c171a0041ad2
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 | | output | |
c171a0041ad2
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
|
329 +-----------------------------+----------------------------------------------+ |
181
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
330 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
331 If ``output-dir`` is specified, but ``output-file`` is not, the default filename |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
332 of the output file will be:: |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
333 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
334 <output_dir>/<locale>/LC_MESSAGES/<domain>.po |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
335 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
336 If neither the ``input_file`` nor the ``locale`` option is set, this command |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
337 looks for all catalog files in the base directory that match the given domain, |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
338 and updates each of them. |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
339 |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
340 These options can either be specified on the command-line, or in the |
8a762ce37bf7
The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents:
177
diff
changeset
|
341 ``setup.cfg`` file. |