Pontoon integration
October 12, 2022 ยท View on GitHub
Pontoon is Mozilla's Localization Platform. We use it to translate our donation platform (prod only).
Configuration
Settings
SSH Configuration:
Django based strings are translated on Pontoon, pushed directly to the donate-wagtail repo, and deployed with the rest of the code. For Wagtail based strings, we need an intermediate repo, mozilla-donate-content, that gets the latest translations from Pontoon and the newest strings to translate from donate-wagtail. To push to that repo, we need to add a deploy key with write access on GitHub. On Heroku, we need to run a script (.profile) that reads the SSH_KEY and SSH_CONFIG from the environment variables and write them as files. This script runs every time a dyno is created.
Pontoon sync:
A scheduled task runs every 20 minutes to sync the donate platform with the mozilla-donate-content repo. Users can trigger a sync in the Pontoon settings of the CMS admin.
Environment Variables:
USE_PONTOON: set atTrueto use Pontoon. If set toFalse, the SSH configuration script won't run.SSH_KEY: SSH key to be able to push tomozilla-donate-content.SSH_CONFIG: must be set toStrictHostKeyChecking=no.
Heroku requirements:
- A worker dyno running
python manage.py rqworker wagtail_localize_pontoon.sync, Heroku Redisadd-on,Heroku schedulerrunningpython manage.py enqueue_pontoon_syncevery 20 min.
First run
The initial sync needs to be run manually:
- If the content repo is empty:
touch README.mdand push this file to the main branch of the content repo. - run
heroku login. - run
heroku run bash -a donate-wagtail-production. - run
python manage.py sync_languages: createsLanguageobjects for all languages defined in theLANGUAGESsection ofsettings.py. - run
python manage.py submit_whole_site_to_pontoon: generates submissions for all live translatable pages. - run
python manage.py sync_pontoon: pushes the source strings tomozilla-donate-content.
Thunderbird donate website
Thunderbird donate stack is also using Pontoon. The configuration is the same as Mozilla donate, the only difference being the content repo: thunderbird-donate-content.