Upgrade translations download to use Lokalise CLI v2 (#36240)

pull/36247/head
Paulus Schoutsen 2020-05-28 21:06:09 -07:00 committed by GitHub
parent 564fb1d1e5
commit 9c45115468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View File

@ -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")

View File

@ -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",
]
)

View File

@ -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",