Add option --version to Zanata pull_catalog

During translation phase it's required to pull different versions from
translation server instead only master branch.

Change-Id: I27ab5f678aae71846f5ec6191be08e05cf72e53e
This commit is contained in:
Frank Kloeker 2018-02-16 12:58:22 +01:00
parent 51378f7058
commit 06a63b4fdb
1 changed files with 7 additions and 1 deletions

View File

@ -23,9 +23,10 @@ ZANATA_LOCALES_URL = ("https://translate.openstack.org/rest/project"
DOMAINS = ['django', 'djangojs']
MODULES = ['horizon', 'openstack_dashboard']
PROJECT = 'horizon'
VERSION = 'master',
POFILE = "{module}/locale/{locale}/LC_MESSAGES/{domain}.po"
POFILE_URL = ("https://translate.openstack.org/rest/file/translation/{project}"
"/master/{language}/po?docId={module}%2Flocale%2F{domain}")
"/{version}/{language}/po?docId={module}%2Flocale%2F{domain}")
class Command(BaseCommand):
@ -57,6 +58,10 @@ class Command(BaseCommand):
"strings from e.g. 'openstack_dashboard'. "
"The default modules are 'horizon' and "
"'openstack_dashboard'"))
parser.add_argument('-v', '--version', type=str, default=VERSION,
help=("The version of the project to extract "
"strings from e.g. 'horizon'. The default "
"is 'master'"))
def handle(self, *args, **options):
for module in options['module']:
@ -75,6 +80,7 @@ class Command(BaseCommand):
new_po = requests.get((POFILE_URL).format(
language=language,
project=options['project'],
version=options['version'],
module=module,
domain=domain))