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:
parent
51378f7058
commit
06a63b4fdb
@ -23,9 +23,10 @@ ZANATA_LOCALES_URL = ("https://translate.openstack.org/rest/project"
|
|||||||
DOMAINS = ['django', 'djangojs']
|
DOMAINS = ['django', 'djangojs']
|
||||||
MODULES = ['horizon', 'openstack_dashboard']
|
MODULES = ['horizon', 'openstack_dashboard']
|
||||||
PROJECT = 'horizon'
|
PROJECT = 'horizon'
|
||||||
|
VERSION = 'master',
|
||||||
POFILE = "{module}/locale/{locale}/LC_MESSAGES/{domain}.po"
|
POFILE = "{module}/locale/{locale}/LC_MESSAGES/{domain}.po"
|
||||||
POFILE_URL = ("https://translate.openstack.org/rest/file/translation/{project}"
|
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):
|
class Command(BaseCommand):
|
||||||
@ -57,6 +58,10 @@ class Command(BaseCommand):
|
|||||||
"strings from e.g. 'openstack_dashboard'. "
|
"strings from e.g. 'openstack_dashboard'. "
|
||||||
"The default modules are 'horizon' and "
|
"The default modules are 'horizon' and "
|
||||||
"'openstack_dashboard'"))
|
"'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):
|
def handle(self, *args, **options):
|
||||||
for module in options['module']:
|
for module in options['module']:
|
||||||
@ -75,6 +80,7 @@ class Command(BaseCommand):
|
|||||||
new_po = requests.get((POFILE_URL).format(
|
new_po = requests.get((POFILE_URL).format(
|
||||||
language=language,
|
language=language,
|
||||||
project=options['project'],
|
project=options['project'],
|
||||||
|
version=options['version'],
|
||||||
module=module,
|
module=module,
|
||||||
domain=domain))
|
domain=domain))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user