1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-24 04:39:01 +00:00

Accept Lokalise token from environment (#598)

This commit is contained in:
Adam Mills
2017-11-08 23:59:10 -05:00
committed by GitHub
parent bac3d8c17e
commit 5722b6bbdb
2 changed files with 10 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ set -eu -o pipefail
cd "$(dirname "$0")/.."
if [ ! -f .lokalise_token ] ; then
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/3420425759f6d6d241f598.13594006/all/" \
@@ -17,7 +17,9 @@ if [ ! -f .lokalise_token ] ; then
exit 1
fi
API_TOKEN="$(<.lokalise_token)"
# Load token from file if not already in the environment
[ -z "${LOKALISE_TOKEN-}" ] && LOKALISE_TOKEN="$(<.lokalise_token)"
PROJECT_ID="3420425759f6d6d241f598.13594006"
LOCAL_DIR="$(pwd)/translations"
DOWNLOAD_FILE="${LOCAL_DIR}/Home_Assistant_-_Polymer_frontend-locale.zip"
@@ -29,7 +31,7 @@ mkdir -p ${LOCAL_DIR}
docker run \
-v ${LOCAL_DIR}:/opt/dest \
lokalise/lokalise-cli lokalise \
--token ${API_TOKEN} \
--token ${LOKALISE_TOKEN} \
export ${PROJECT_ID} \
--export_empty skip \
--type json \

View File

@@ -8,7 +8,7 @@ set -eu -o pipefail
cd "$(dirname "$0")/.."
if [ ! -f .lokalise_token ] ; then
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/3420425759f6d6d241f598.13594006/all/" \
@@ -17,7 +17,9 @@ if [ ! -f .lokalise_token ] ; then
exit 1
fi
API_TOKEN="$(<.lokalise_token)"
# Load token from file if not already in the environment
[ -z "${LOKALISE_TOKEN-}" ] && LOKALISE_TOKEN="$(<.lokalise_token)"
PROJECT_ID="3420425759f6d6d241f598.13594006"
LOCAL_FILE="$(pwd)/src/translations/en.json"
LANG_ISO=en
@@ -33,7 +35,7 @@ fi
docker run \
-v ${LOCAL_FILE}:/opt/src/${LOCAL_FILE} \
lokalise/lokalise-cli lokalise \
--token ${API_TOKEN} \
--token ${LOKALISE_TOKEN} \
import ${PROJECT_ID} \
--file /opt/src/${LOCAL_FILE} \
--lang_iso ${LANG_ISO}