You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Rename file_name to filename
* Adding fuzzy flag to message parameterized in 'add_conflict'
* Replace usage scenarious to cmdline.rst
* Rename to ConcatenateCatalog
Copy file name to clipboardExpand all lines: docs/cmdline.rst
+56-4Lines changed: 56 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -326,13 +326,65 @@ The compendium can be used in two modes:
326
326
from the compendium take priority and replace those in the output file. If a translation
327
327
is used from the compendium, a comment noting the source is added
328
328
329
-
The ``input-files`` option includes def.po, a file with obsolete translations, and ref.pot,
329
+
The ``input-files`` option accepts exactly two arguments: a file with obsolete translations, and
330
330
the current template file for updating translations.
331
331
332
332
The ``compendium`` option can be specified multiple times to use several compendiums.
333
333
334
334
The ``backup`` option is used to create a backup copy of the def.po file, which contains
335
-
obsolete translations
335
+
obsolete translations.
336
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,
337
+
The ``suffix`` option allows you to specify a custom suffix for the backup file (defaulting to ``~``).
338
+
339
+
pybable concat and merge usage scenarios
340
+
======
341
+
342
+
1. Merging Multiple PO Files (`concat`)
343
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344
+
345
+
**Usage:**
346
+
`pybabel concat [options] <po_files>`
347
+
Suppose you manage a project with several PO files for the same language (for example, modules or plugins have their own translations), and you want to combine them into a single file for further work or for delivery to translators.
- If the same string has different translations in different files, the resulting file for that string will include a special comment ``#-#-#-#-# <file> (PROJECT VERSION) #-#-#-#-#`` and the message will be marked with the ``fuzzy`` flag—this is useful for later manual conflict resolution.
358
+
- You can keep only unique strings using the ``-u`` (`--less-than=2`) option.
359
+
- Use `--use-first` to take only the first encountered translation for each string, skipping automatic merging of multiple options.
360
+
- Output can be sorted alphabetically or by source file (options `-s`, `-F`).
361
+
362
+
**Typical Use Case:**
363
+
364
+
A project has translations from different teams. Before releasing, you need to gather all translations into one file, resolve possible conflicts, and provide the finalized version to translators for review.
365
+
366
+
367
+
2. Updating Translations with a Template and Compendium (`merge`)
You need to update an existing translation file (`def.po`) based on a new template (`ref.pot`), reusing translations from an additional translation memory (compendium).
- The compendium (`-C`) allows you to pull translations from a shared translation memory. Multiple compendiums can be used.
383
+
- By default, translations from the compendium are used only for new or missing entries in `def.po`.
384
+
- The `--compendium-overwrite` option allows overwriting existing translations with those found in the compendium (helpful for terminology standardization).
385
+
- When a translation from the compendium is used, a comment is automatically added (this can be disabled with `--no-compendium-comment`).
386
+
- The `--backup` flag saves a backup copy of your file before updating (`~` suffix by default, configurable with `--suffix`).
387
+
388
+
**Typical Use Case:**
389
+
390
+
After a release, a new translation template is provided. The team decides to enrich the translation by leveraging a common compendium in order to improve quality and unify terms. The merge command is run with the compendium and backup options enabled.
0 commit comments