msgcmp
Compare message catalogs (.po) with source code
SYNOPSIS
msgcmp [OPTION]... FILE1 FILE2
PARAMETERS
-s, --silent
Suppress output of differences; only set exit status based on comparison.
-v, --verbose
Print differences. This is the default behavior.
--textdomain=TEXTDOMAIN
Specify the textdomain for MO files, overriding the default.
--directory=DIR
Add DIR to the list of directories to search for MO files.
--output-po-file=FILE
Write a PO file containing the identified differences to FILE.
--output-mo-file=FILE
Write an MO file containing the identified differences to FILE.
--output-file=FILE
An alias for --output-po-file=FILE.
--color[=WHEN]
Control colored output. WHEN can be 'always', 'never', or 'auto'.
--debug
Show debug information, useful for troubleshooting.
--help
Display a help message and exit.
--version
Output version information and exit.
DESCRIPTION
The msgcmp command is a utility from the GNU gettext toolset, designed to compare two message catalog files. It can compare two .po (Portable Object) files, or one .po file and one .mo (Machine Object) file. Its primary function is to identify differences in message IDs, their corresponding translations, or plural forms between the specified files. This is invaluable for developers and localizers to ensure the consistency and accuracy of translated content, especially when verifying if a .po file correctly reflects the strings within a compiled .mo file, or to track divergences between different versions of translation files. msgcmp aids in maintaining the integrity of internationalized applications.
CAVEATS
Operates exclusively with GNU gettext .po and .mo file formats. It is a comparison tool, not a merging utility; for merging, use msgmerge(1). The exit status is crucial for scripting purposes to determine comparison results.
EXIT STATUS SIGNIFICANCE
msgcmp is often used in scripts due to its meaningful exit status:
• 0 if the files are identical.
• 1 if differences are found.
• greater than 1 if an error occurred during processing.
FILE FORMAT SPECIFICITY
This command is designed for use with GNU gettext's specific .po (Portable Object) and .mo (Machine Object) file formats, which are standard for internationalizing software using the gettext framework.
HISTORY
As a core component of the GNU gettext project, msgcmp has been integral to the internationalization and localization workflow since the early stages of gettext's development. It provides a standardized way to verify the consistency of translation files, evolving alongside the gettext standard itself to support various features and best practices.