Automatically translate the contents of your Flask-Babel .po
files.
- Dryscrape (
pip3 install dryscrape
). Requirements may differ per system. Check the link.
Having to manually translate the contents on the generated messages.po
files is tedious. Wanted a way to automate the translation.
This script does this, leveraging on Google Translate.
- Install
dryscrape
as directed above. - Edit the
babelizer.py
script and point thepo_folder
to where the portable object (.po
) files are located. Mine looks something like this, hence mypo_folder
:
- Simply run
python3 babelizer.py
and the.po
file (messages.po
) will be updated with the translated text.
The below shows the generated .po
files after conversion
- Use
argparse
to pass translations folder as argument. (Maybe???)