Skip to content

Commit 1817bce

Browse files
committed
Add info about pybable concat and pybabel merge into docs
1 parent 3f37414 commit 1817bce

2 files changed

Lines changed: 90 additions & 1 deletion

File tree

babel/messages/frontend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ def run(self):
854854

855855

856856
class ConcatenateCatalog(CommandMixin):
857-
description = 'concatenates and merges the specified PO files'
857+
description = 'concatenates the specified PO files into single one'
858858
user_options = [
859859
('input-files', None, 'input files'),
860860
('output-file=', 'o', 'write output to specified file'),

docs/cmdline.rst

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,92 @@ filename of the output file will be::
247247
If neither the ``output_file`` nor the ``locale`` option is set, this command
248248
looks for all catalog files in the base directory that match the given domain,
249249
and updates each of them.
250+
251+
concat
252+
======
253+
254+
The `concat` command merges multiple PO files into a single one. If a message has
255+
different translations in different PO files, the conflicting translations are
256+
marked with a conflict comment::
257+
#-#-#-#-# <file> (PROJECT VERSION) #-#-#-#-#
258+
and the message itself is marked with a `fuzzy` flag::
259+
260+
$ pybabel concat --help
261+
Usage: pybabel concat [options] <input-files>
262+
263+
concatenates the specified PO files into single one
264+
265+
Options:
266+
-h, --help show this help message and exit
267+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE
268+
write output to specified file
269+
--less-than=NUMBER print messages with less than this many
270+
definitions, defaults to infinite if not set
271+
--more-than=NUMBER print messages with more than this many
272+
definitions, defaults to 0 if not set
273+
-u, unique shorthand for --less-than=2, requests
274+
that only unique messages be printed
275+
--use-first use first available translation for each
276+
message, don't merge several translations
277+
--no-location do not write '#: filename:line' lines
278+
-w WIDTH, --width=WIDTH
279+
set output page width
280+
--no-wrap do not break long message lines, longer than
281+
the output page width, into several lines
282+
-s, --sort-output generate sorted output
283+
-F, --sort-by-file sort output by file location
284+
285+
merge
286+
======
287+
288+
The `merge` command allows updating files using a compendium as a translation memory::
289+
290+
$ pybabel concat --help
291+
Usage: pybabel merge [options] <input-files>
292+
293+
updates translation PO file by merging them with updated template
294+
POT file with using compendium
295+
296+
Options:
297+
-C COMPENDIUM_FILE, --compendium=COMPENDIUM_FILE
298+
additional library of message translations, may
299+
be specified more than once
300+
--compendium-overwrite
301+
overwrite mode of compendium
302+
--no-compendium-comment
303+
do not add a comment indicating that the message is
304+
taken from the compendium
305+
-U, --update update def.po, do nothing if def.po already up to date,
306+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE
307+
write output to specified file, the results are written
308+
to standard output if no output file is specified
309+
--backup make a backup of def.po
310+
--suffix=SUFFIX override the usual backup suffix (default '~')
311+
-N, --no-fuzzy-matching
312+
do not use fuzzy matching
313+
--no-location suppress '#: filename:line' lines'
314+
-w WIDTH, --width=WIDTH
315+
set output page width
316+
--no-wrap do not break long message lines, longer
317+
than the output page width, into several lines
318+
-s, --sort-output generate sorted output
319+
-F --sort-by-file sort output by file location
320+
321+
The compendium can be used in two modes:
322+
- Default mode: the translations from the compendium are used
323+
only if they are missing in the output file.
324+
325+
- Compendium overwrite mode: when using the ``compendium-overwrite`` option, translations
326+
from the compendium take priority and replace those in the output file. If a translation
327+
is used from the compendium, a comment noting the source is added
328+
329+
The ``input-files`` option includes def.po, a file with obsolete translations, and ref.pot,
330+
the current template file for updating translations.
331+
332+
The ``compendium`` option can be specified multiple times to use several compendiums.
333+
334+
The ``backup`` option is used to create a backup copy of the def.po file, which contains
335+
obsolete translations
336+
337+
The ``suffix`` option allows you to specify a custom suffix for the backup file
338+
By default, a standard suffix ``~`` is appended to the backup file's name,

0 commit comments

Comments
 (0)