Skip to content

Commit a09e879

Browse files
committed
Push translation files to Transifex
Currently, when commits to master add new strings, this has to be manually pushed to Transifex - a process that traditionally only happens before releases. This puts unnecessarily high pressure on translators to translate the new strings in time for a release. This is achieved with a little script and Travis' secret environment variables protecting the account password of the Transifex account.
1 parent 5537471 commit a09e879

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

.travis.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
language: python
22
python:
3-
- 2.6
4-
- 2.7
3+
- '2.6'
4+
- '2.7'
55
env:
6-
# NOTE: easy_install *will* downgrade if setup.py specifies a max version
7-
# This causes the tests to run with the wrong Django version
8-
- DJANGO_VERSION=1.4.5
9-
- DJANGO_VERSION=1.5
6+
global:
7+
# $TRANSIFEX_PASSWORD for oscar_bot (used in transifex.sh)
8+
secure: FuIlzEsGJiAwhaIRBmRNsq9eXmuzs25fX6BChknW4lDyVAySWMp0+Zps9Bd0JgfFYUG3Ip+OTmksYIoTUsG25ZJS9cq1IFt3QKUAN70YCI/4ZBLeIdICPEyxq+Km179+NeEXmBUug17RLMLxh3MWfO+RKUHK9yHIPNNpq0dNyoo=
9+
matrix:
10+
- DJANGO_VERSION=1.4.8
11+
- DJANGO_VERSION=1.5.4
1012
install:
11-
- easy_install Django==$DJANGO_VERSION
13+
- easy_install Django==$DJANGO_VERSION
1214
script:
13-
- make travis
15+
- make travis
1416
after_success:
15-
- coveralls
17+
- coveralls
18+
- ./transifex.sh

transifex.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
# pushes source and translation files to Transifex
3+
# called after every successful build on Travis CI
4+
# relies on $TRANSIFEX_PASSWORD being set in .travis.yml
5+
6+
# only run once, and only on master
7+
echo $TRAVIS_JOB_NUMBER | grep "\.1$"
8+
if [ $? -eq 0 ] && [ $TRAVIS_BRANCH == master ]
9+
then
10+
make messages
11+
# write .transifexrc file
12+
echo "[https://www.transifex.com]
13+
hostname = https://www.transifex.com
14+
password = $TRANSIFEX_PASSWORD
15+
token =
16+
username = oscar_bot" > ~/.transifexrc
17+
tx push --source --translations --no-interactive
18+
fi
19+

0 commit comments

Comments
 (0)