forked from jazzband/django-admin2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
46 lines (31 loc) · 1.13 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from fabric.api import local, lcd
from fabric.contrib.console import confirm
DIRS = ['djadmin2', 'example/blog', 'example2/polls']
def _run(command, directory):
with lcd(directory):
print('\n### Processing %s...' % directory)
local(command)
def makemessages():
command = 'django-admin.py makemessages -a'
for d in DIRS:
_run(command, d)
def compilemessages():
command = 'django-admin.py compilemessages'
for d in DIRS:
_run(command, d)
def checkmessages():
command = 'ls -1 locale/*/LC_MESSAGES/django.po | xargs -I {} msgfmt -c {}'
for d in DIRS:
_run(command, d)
def pulltx():
print('\n### Pulling new translations from Transifex...')
local('tx pull -a')
def pushtx():
print('\n### Pushing translations and sources to Transifex...')
print('Warning: This might destroy existing translations. Probably you should pull first.')
if confirm('Continue anyways?', default=False):
local('tx push -s -t')
else:
print('Aborting.')