babel
babel copied to clipboard
Feature request: implement `pybabel lint`
A common error that translators do is translating the format field names, while they should remain untranslated. For example: translating "File {file} not found" by "Fichier {fichier} non trouvé" instead of "Fichier {file} non trouvé".
There is a script in this repository that checks for such errors: https://github.com/himdel/lint-po. However, it does its own PO file parsing that looks a bit fishy. I'd rather have this functionality in babel, with a well-tested PO parser.
That would be much appreciated.
Sounds like a great idea :)
FYI we implemented something like this in Indico: https://github.com/indico/indico/blob/5167d8c065e04ca468764babeffd9f5287a3af60/indico/cli/i18n.py#L666-L686 It's implemented on top of babel so it could serve as an inspiration :)
We also have a checker for mismatched HTML tags (mostly for QA but also to automatically catch attempts to inject e.g. script tags via translation files): https://github.com/indico/indico/blob/5167d8c065e04ca468764babeffd9f5287a3af60/indico/cli/i18n.py#L689-L714