1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-27 17:55:10 +03:00

add lang option in push/pull

This commit is contained in:
sundeep-co-in 2017-02-01 22:04:08 +05:30
parent eada4ce83f
commit 5af2f51bd9

View File

@ -24,11 +24,11 @@
# to update django.pot file, run: # to update django.pot file, run:
# $ python tools/scripts/manage_translations.py update # $ python tools/scripts/manage_translations.py update
# #
# to update both pot files, run: # to update both pot files locally, run:
# $ python tools/scripts/manage_translations.py update --both # $ python tools/scripts/manage_translations.py update --both
# #
# to push both pot files (update also), run: # to push both pot files (update also) and ja translations, run:
# $ python tools/scripts/manage_translations.py push --both # $ python tools/scripts/manage_translations.py push --both --lang ja
# #
# to pull both translations for Japanese and French, run: # to pull both translations for Japanese and French, run:
# $ python tools/scripts/manage_translations.py pull --both --lang ja,fr # $ python tools/scripts/manage_translations.py pull --both --lang ja,fr
@ -128,17 +128,21 @@ def push(lang=None, both=None):
(1) for angularjs - project_type should be gettext - {locale}.po format (1) for angularjs - project_type should be gettext - {locale}.po format
(2) for django - project_type should be podir - {locale}/{filename}.po format (2) for django - project_type should be podir - {locale}/{filename}.po format
(3) only required languages should be kept enabled (3) only required languages should be kept enabled
This will update/overwrite PO file with translations found for input lang(s)
[!] POT and PO must remain in sync as messages would overwrite as per POT file
""" """
command = "zanata push --project-config %(config)s --push-type both --force --lang %(lang)s --disable-ssl-cert"
command = "zanata push --project-config %(config)s --push-type both --force --disable-ssl-cert" lang = lang[0] if lang and len(lang) > 0 else 'en-us'
if both: if both:
p = Popen(command % {'config': ZNTA_CONFIG_FRONTEND_TRANS}, stdout=PIPE, stderr=PIPE, shell=True) p = Popen(command % {'config': ZNTA_CONFIG_FRONTEND_TRANS, 'lang': lang},
stdout=PIPE, stderr=PIPE, shell=True)
output, errors = p.communicate() output, errors = p.communicate()
if _handle_response(output, errors): if _handle_response(output, errors):
_print_zanata_project_url(ZNTA_CONFIG_FRONTEND_TRANS) _print_zanata_project_url(ZNTA_CONFIG_FRONTEND_TRANS)
p = Popen(command % {'config': ZNTA_CONFIG_BACKEND_TRANS}, stdout=PIPE, stderr=PIPE, shell=True) p = Popen(command % {'config': ZNTA_CONFIG_BACKEND_TRANS, 'lang': lang},
stdout=PIPE, stderr=PIPE, shell=True)
output, errors = p.communicate() output, errors = p.communicate()
if _handle_response(output, errors): if _handle_response(output, errors):
_print_zanata_project_url(ZNTA_CONFIG_BACKEND_TRANS) _print_zanata_project_url(ZNTA_CONFIG_BACKEND_TRANS)