gettext-spellchecker is a Python script which checks the spell of msgid or msgstr strings in a gettext .po or .pot file.
It uses hunspell dictionaries.
It outputs the results to a CSV file or to colored output in the terminal.
python3 check.py --path /usr/share/hunspell --lang=de_DE -i ../examples/example_simple.po --check=msgstr--versionprints the script version.--paththe path to hunspell dictionaries. Default: "/usr/share/hunspell".--langthe code of the language the strings in the form xx_YY where xx is in ISO 639-1 format and YY in ISO 3166-1 alpha-2 format.-i,--inputthe path of the .po or .pot file.-o,--outputoptional path of the output file in CSV format.--checkwhich string do you want the script to check: 'msgid' or 'msgstr'. Default="msgid".
This script uses hunspell dictionaries.
In Debian and derivatives you install them with apt, for instance:
apt install hunspell-frRead your operating system's documentation to know how to install those packages from its repositories, or visit hunspell if you need to compile them by hand.
This script depends on the following Python modules:
- argparse
- spellchecker
- colorama
- csv
- polib
- hunspell
- pycountry
- string
You can install them using your operating system package manager or pip in a venv.
- Sample .po and .pot files are included in the
examplesdirectory. - Why gettext?
- First and most relevant reason: it uses the full strings in the original language as key, so I don't have to be searching for weird keys such as "page.title.hello" or "item.specification". If one translation doesn't exist, the original key string is used.
- It's a GNU standard, tried and trusted.
Copyright 2025 Rodolfo González González.
Apache License 2.0. Please read the LICENSE file.