From 06a63b4fdb075d68d591a7121bf4fc98f3a4f8c9 Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Fri, 16 Feb 2018 12:58:22 +0100 Subject: [PATCH] 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 --- horizon/management/commands/pull_catalog.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/horizon/management/commands/pull_catalog.py b/horizon/management/commands/pull_catalog.py index cdac29a2db..285e441b9e 100644 --- a/horizon/management/commands/pull_catalog.py +++ b/horizon/management/commands/pull_catalog.py @@ -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))