I have multiple .po files in a standard directory structure of GNU gettext:
locales/
├── en_US
│ └── LC_MESSAGES
│ └── myapp.po
└── zh_TW
└── LC_MESSAGES
└── myapp.po
I knew that I could write a script that uses msgfmt
to generate .mo files from these .po files. Something like:
# generate-mo-files.sh
for PO_FILE in locales/*/LC_MESSAGES/*.po
do
MO_FILE="${PO_FILE/.po/.mo}"
msgfmt -o "$MO_FILE" "$PO_FILE"
done
However, writing this script for each project I work on is a bit tedious. Is there a ready-made script for such use case?