From 9c45115468a99a2ecee1d84b1eb73e78a53ffae8 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 28 May 2020 21:06:09 -0700 Subject: [PATCH] Upgrade translations download to use Lokalise CLI v2 (#36240) --- script/translations/const.py | 3 ++- script/translations/download.py | 19 ++++++++++++------- script/translations/upload.py | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/script/translations/const.py b/script/translations/const.py index ddb753ef1ca..ba4d7b39177 100644 --- a/script/translations/const.py +++ b/script/translations/const.py @@ -3,6 +3,7 @@ import pathlib CORE_PROJECT_ID = "130246255a974bd3b5e8a1.51616605" FRONTEND_PROJECT_ID = "3420425759f6d6d241f598.13594006" -DOCKER_IMAGE = "b8329d20280263cad04f65b843e54b9e8e6909a348a678eac959550b5ef5c75f" +CLI_1_DOCKER_IMAGE = "b8329d20280263cad04f65b843e54b9e8e6909a348a678eac959550b5ef5c75f" +CLI_2_DOCKER_IMAGE = "v2.3.0" INTEGRATIONS_DIR = pathlib.Path("homeassistant/components") FRONTEND_DIR = pathlib.Path("../frontend") diff --git a/script/translations/download.py b/script/translations/download.py index 364f309b644..8f17e057080 100755 --- a/script/translations/download.py +++ b/script/translations/download.py @@ -7,7 +7,7 @@ import re import subprocess from typing import Dict, List, Union -from .const import CORE_PROJECT_ID, DOCKER_IMAGE +from .const import CLI_2_DOCKER_IMAGE, CORE_PROJECT_ID from .error import ExitApp from .util import get_lokalise_token @@ -25,18 +25,23 @@ def run_download_docker(): "-v", f"{DOWNLOAD_DIR}:/opt/dest/locale", "--rm", - f"lokalise/lokalise-cli@sha256:{DOCKER_IMAGE}", + f"lokalise/lokalise-cli-2:{CLI_2_DOCKER_IMAGE}", # Lokalise command - "lokalise", + "lokalise2", "--token", get_lokalise_token(), - "export", + "--project-id", CORE_PROJECT_ID, - "--export_empty", + "file", + "download", + CORE_PROJECT_ID, + "--original-filenames=false", + "--replace-breaks=false", + "--export-empty-as", "skip", - "--type", + "--format", "json", - "--unzip_to", + "--unzip-to", "/opt/dest", ] ) diff --git a/script/translations/upload.py b/script/translations/upload.py index 844c706d064..a9dfa38f6c3 100755 --- a/script/translations/upload.py +++ b/script/translations/upload.py @@ -6,7 +6,7 @@ import pathlib import re import subprocess -from .const import CORE_PROJECT_ID, DOCKER_IMAGE, INTEGRATIONS_DIR +from .const import CLI_1_DOCKER_IMAGE, CORE_PROJECT_ID, INTEGRATIONS_DIR from .error import ExitApp from .util import get_current_branch, get_lokalise_token @@ -26,7 +26,7 @@ def run_upload_docker(): "-v", f"{LOCAL_FILE}:{CONTAINER_FILE}", "--rm", - f"lokalise/lokalise-cli@sha256:{DOCKER_IMAGE}", + f"lokalise/lokalise-cli@sha256:{CLI_1_DOCKER_IMAGE}", # Lokalise command "lokalise", "--token",