mirror of
https://github.com/home-assistant/core
synced 2024-09-06 10:29:55 +02:00
40 lines
1.2 KiB
Bash
Executable File
40 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Safe bash settings
|
|
# -e Exit on command fail
|
|
# -u Exit on unset variable
|
|
# -o pipefail Exit if piped command has error code
|
|
set -eu -o pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
if [ -z "${LOKALISE_TOKEN-}" ] && [ ! -f .lokalise_token ] ; then
|
|
echo "Lokalise API token is required to download the latest set of" \
|
|
"translations. Please create an account by using the following link:" \
|
|
"https://lokalise.co/signup/130246255a974bd3b5e8a1.51616605/all/" \
|
|
"Place your token in a new file \".lokalise_token\" in the repo" \
|
|
"root directory."
|
|
exit 1
|
|
fi
|
|
|
|
# Load token from file if not already in the environment
|
|
[ -z "${LOKALISE_TOKEN-}" ] && LOKALISE_TOKEN="$(<.lokalise_token)"
|
|
|
|
PROJECT_ID="130246255a974bd3b5e8a1.51616605"
|
|
LOCAL_DIR="$(pwd)/build/translations-download"
|
|
FILE_FORMAT=json
|
|
|
|
mkdir -p ${LOCAL_DIR}
|
|
|
|
docker run \
|
|
-v ${LOCAL_DIR}:/opt/dest/locale \
|
|
--rm \
|
|
lokalise/lokalise-cli@sha256:b8329d20280263cad04f65b843e54b9e8e6909a348a678eac959550b5ef5c75f lokalise \
|
|
--token ${LOKALISE_TOKEN} \
|
|
export ${PROJECT_ID} \
|
|
--export_empty skip \
|
|
--type json \
|
|
--unzip_to /opt/dest
|
|
|
|
script/translations_download_split.py
|