fmtmsg - Linux


fmtmsg is a utility to convert binary message files generated by the xgettext program to the native character set on the system. These message files contain internationalization strings to be used by software.


fmtmsg [options] [inputfile [outputfile]]


| Option | Description | Default |
| -c | Do not convert to native character set | false |
| -d | Write debug messages to stderr | false |
| -e | Write error messages to stderr | true |
| -h | Display usage and exit | false |
| -l | Specify the input encoding | null |
| -m | Do not remove obsolete messages | false |
| -o | Specify output file | stdout |
| -s | Print statistics to stdout | false |
| -v | Print version and exit | false |


Simple Usage

Convert a binary message file to the native character set:

fmtmsg my_messages.po

Specifying Input and Output Files

Convert a file encoded in UTF-8 to ISO-8859-1:

fmtmsg -l utf-8 -o my_messages_iso.po my_messages.po

Debug Mode

Enable debug messages and write errors to stderr:

fmtmsg -d -e my_messages.po

Common Issues

Invalid Output Encoding

If the specified output encoding is not supported, fmtmsg will print an error and exit. Verify that the encoding is valid and installed on the system.


fmtmsg integrates with other internationalization tools such as xgettext, msgmerge, and msgfmt. Use it as part of your software localization workflow to prepare message files for use in multilingual applications.

Related Commands

  • xgettext: Extract strings from source code for internationalization
  • msgmerge: Merge and update multiple message files
  • msgfmt: Generate binary message files from text-based files