HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

msgcat — Concatenate and merge multiple `.po` translation files. Useful in software localization pipelines to

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandmultipleandmsgcatconcatenateclimergetranslation

Problem

How to use the msgcat command: Concatenate and merge multiple .po translation files. Useful in software localization pipelines to combine message catalogs with filtering options. More information: <https://www.gnu.org/software/gettext/manual/gettext.html#msgcat-Invocation>.

Solution

msgcat — Concatenate and merge multiple .po translation files. Useful in software localization pipelines to combine message catalogs with filtering options. More information: <https://www.gnu.org/software/gettext/manual/gettext.html#msgcat-Invocation>.

Combine multiple .po files into one:
msgcat {{file1.po file2.po ...}} {{[-o|--output-file]}} {{combined.po}}


Combine input files listed in a text file:
msgcat {{[-f|--files-from]}} {{path/to/file_list.txt}} {{[-o|--output-file]}} {{combined.po}}


Set the output encoding (e.g. UTF-8):
msgcat {{[-t|--to-code]}} {{UTF-8}} {{input.po}} {{[-o|--output-file]}} {{output.po}}


Output only unique messages (appearing in one file only):
msgcat {{[-u|--unique]}} {{file1.po file2.po ...}} {{[-o|--output-file]}} {{unique.po}}


Use the first available translation for duplicate entries:
msgcat --use-first {{file1.po file2.po ...}} {{[-o|--output-file]}} {{output.po}}


Display help:
msgcat {{[-h|--help]}}

Code Snippets

Combine multiple `.po` files into one

msgcat {{file1.po file2.po ...}} {{[-o|--output-file]}} {{combined.po}}

Combine input files listed in a text file

msgcat {{[-f|--files-from]}} {{path/to/file_list.txt}} {{[-o|--output-file]}} {{combined.po}}

Set the output encoding (e.g. UTF-8)

msgcat {{[-t|--to-code]}} {{UTF-8}} {{input.po}} {{[-o|--output-file]}} {{output.po}}

Output only unique messages (appearing in one file only)

msgcat {{[-u|--unique]}} {{file1.po file2.po ...}} {{[-o|--output-file]}} {{unique.po}}

Use the first available translation for duplicate entries

msgcat --use-first {{file1.po file2.po ...}} {{[-o|--output-file]}} {{output.po}}

Context

tldr-pages: common/msgcat

Revisions (0)

No revisions yet.