def update(user, password, lang=None):
langs = getlangs(lang)
puts(u"Updating %s" % ', '.join(langs))
for loc in langs:
with indent(2):
puts(u"Downloading PO for %s" % loc)
url = (u'https://www.transifex.com/projects/p/formhub/'
u'resource/django/l/%(lang)s/download/for_use/' % {'lang': loc})
try:
tmp_po_file = download_with_login(url, TX_LOGIN_URL,
login=user, password=password,
ext='po',
username_field='identification',
password_field='password',
form_id=1)
po_file = os.path.join(REPO_ROOT, 'locale', loc,
'LC_MESSAGES', 'django.po')
with indent(2):
puts(u"Copying downloaded file to %s" % po_file)
shutil.move(tmp_po_file, po_file)
except Exception as e:
puts(colored.red(u"Unable to update %s "
u"from Transifex: %r" % (loc, e)))
puts(colored.green("sucesssfuly retrieved %s" % loc))
compile_mo(langs)
评论列表
文章目录