Skip to content

Instantly share code, notes, and snippets.

@tobiasmcnulty
Created February 19, 2019 01:30
Show Gist options
  • Save tobiasmcnulty/732e014bc140be504efd1afb81e217b4 to your computer and use it in GitHub Desktop.
Save tobiasmcnulty/732e014bc140be504efd1afb81e217b4 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -ex
tx push -s -r dashboard-djangoproject-com.main
tx push -s -r django-docs.website-strings
# loop through all the languages that currently have translations
for LANG in af sq fr pt_BR sr pl uk tr ru ja it; do
PO_FILE="locale/$LANG/LC_MESSAGES/django.po"
PO_DIR="$(dirname $PO_FILE)"
# fetch the translation from the original / main project in Transifex
tx pull -f -l $LANG -r djangoproject-dot-com.main
for APP in dashboard docs; do
# copy the original translation into $APP
mkdir -p $APP/$PO_DIR
cp $PO_FILE $APP/$PO_FILE
cd $APP
# use Django's makemessages to filter out the strings from other apps
# (they will all be commented out with #~ at the end of the file)
django-admin.py makemessages -l $LANG --no-location
cd -
done
for RESOURCE in dashboard-djangoproject-com.main django-docs.website-strings; do
# push up the filtered translation file
tx push -t -l $LANG -r $RESOURCE
# pull back the clean one (with the #~ lines removed) for inspection
tx pull -f -l $LANG -r $RESOURCE
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment