LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

msgfmt

compiles message catalog files from human-readable PO format to binary MO

TLDR

Compile PO file to MO
$ msgfmt -o [messages.mo] [messages.po]
copy
Check PO file for errors
$ msgfmt --check [messages.po]
copy
Verbose output
$ msgfmt -v -o [messages.mo] [messages.po]
copy
Generate statistics
$ msgfmt --statistics [messages.po]
copy
Compile all PO files
$ for f in *.po; do msgfmt -o "${f%.po}.mo" "$f"; done
copy

SYNOPSIS

msgfmt [options] file.po ...

DESCRIPTION

msgfmt compiles message catalog files from human-readable PO (Portable Object) format to binary MO (Machine Object) format used by gettext at runtime.This is a key step in localizing applications using GNU gettext.

PARAMETERS

-o file

Output file.
-c, --check
Check for errors.
-v, --verbose
Verbose output.
--statistics
Show translation statistics.
-f, --use-fuzzy
Include fuzzy translations.
--strict
Strict mode.

WORKFLOW

$ xgettext → POT file (template)
msginit  → PO file (translations)
msgfmt   → MO file (binary)
copy

EXAMPLE

$ # Compile with checking
msgfmt --check --statistics -o locale/de/LC_MESSAGES/app.mo de.po

# Result: 150 translated, 3 fuzzy, 2 untranslated
copy

INSTALL

sudo apt install gettext
copy
sudo dnf install gettext
copy
sudo pacman -S gettext
copy
sudo apk add gettext
copy
brew install gettext
copy
nix profile install nixpkgs#gettext
copy

CAVEATS

Syntax errors in PO prevent compilation. Fuzzy translations excluded by default. Output encoding must match system.

HISTORY

msgfmt is part of GNU gettext, the standard internationalization system for Unix, developed as part of the GNU Project.

SEE ALSO

xgettext(1), msginit(1), msgmerge(1), gettext(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid